Async JavascriptBinding - Add support for returning Task (#2771)

* Async JavascriptBinding - Add support for returning Task

Remove Parallel Task execution code from MethodRunnerQueue
Add ParallelMethodRunnerQueue
  - For the new code path the Func is executed, if the Result is a generic Task we wait for it's completion
  - If the task is not generic then we return immediately

This is only enabled when CefSharpSettings.ConcurrentTaskExecution = true;
* MethodRunnerQueue - Display error message when method returns Task
* ParallelMethodRunnerQueue - Rename to ConcurrentMethodRunnerQueue
* MethodRunnerQueue - Improve formatting of error message when method returns Task
* Async JavascriptBinding Return Task - Add Basic xUnit Test

Very quick test, needs to be refined a little. The basics are working as expected.

* Add Binding Test Async Task Example to the WPF Example menu

* Async JSB Task - Add additional tests and improve error messaging
This commit is contained in:
Alex Maitland
2019-06-08 17:21:49 +10:00
committed by GitHub
parent a1eec28f13
commit fe98124c9b
19 changed files with 587 additions and 70 deletions
+3 -1
View File
@@ -17,6 +17,7 @@ namespace CefSharp.Example
public const string DefaultUrl = BaseUrl + "/home.html";
public const string BindingTestUrl = BaseUrl + "/BindingTest.html";
public const string BindingTestSingleUrl = BaseUrl + "/BindingTestSingle.html";
public const string BindingTestsAsyncTaskUrl = BaseUrl + "/BindingTestsAsyncTask.html";
public const string LegacyBindingTestUrl = BaseUrl + "/LegacyBindingTest.html";
public const string PostMessageTestUrl = BaseUrl + "/PostMessageTest.html";
public const string PluginsTestUrl = BaseUrl + "/plugins.html";
@@ -188,7 +189,8 @@ namespace CefSharp.Example
//This must be set before Cef.Initialized is called
CefSharpSettings.FocusedNodeChangedEnabled = true;
//Experimental option where bound async methods are queued on TaskScheduler.Default.
//Async Javascript Binding - methods are queued on TaskScheduler.Default.
//Set this to true to when you have methods that return Task<T>
//CefSharpSettings.ConcurrentTaskExecution = true;
//Legacy Binding Behaviour doesn't work for cross-site navigation (navigating to a different domain)