Commit Graph

23 Commits

Author SHA1 Message Date
Alex Maitland 3b1c46aab9 Code Cleanup - Minor code cleanup
- Add Microsoft.CodeAnalysis.NetAnalyzers package
- Make some classes sealed
- Fix/Add xml doc
2022-02-01 14:07:01 +10:00
Alex Maitland 6194fe674d Core - MethodRunnerQueue add additional IsCancellationRequested checks 2021-06-25 16:42:01 +10:00
Alex Maitland ab8223d4b9 Core - Add IAsyncMethodInterceptor (#3296)
Core - Add IAsyncMethodInterceptor
  - Add IAsyncMethodInterceptor
    Extension of IMethodInterceptor to allow for easier evaluation of async taskScheduler
  - Add Additional unit tests
  - Add JavascriptBindingSettings.AlwaysInterceptAsynchronously for cases where you'd like all method calls to use 
    IAsyncMethodInterceptor.InterceptAsync

Follow up to PR #3291

Co-authored-by: Andrew Sampson <andrew@rainway.com>
Co-authored-by: Emily Hudson <emily33901@gmail.com>
2021-01-09 13:17:50 +10:00
amaitland 55af252d91 Core - Refactor JavascriptObjectRepository to IJavascriptObjectRepositoryInternal
Basic refactoring in preparation for allowing users(advanced) to provide their own custom JavascriptObjectRepository implementation
2020-11-25 15:23:29 +10:00
Alex Maitland 83ae9399dd Core - MethodRunnerQueue use TaskCreationOptions.HideScheduler to
To prevent subtasks from attempting to use our LimitedConcurrencyLevelTaskScheduler we need to
specify TaskCreationOptions.HideScheduler when creating the Task

Resolves #3293
2020-11-25 15:16:57 +10:00
amaitland 56f801705d Core - Move LimitedConcurrencyLevelTaskScheduler to CefSharp namespace
In preparation for generating Ref assemblies which will expose some of our internal classes at least initially.
Move into our own namespace to avoid any conflict
2020-08-05 14:20:29 +10:00
Alex Maitland b5a83f526e Enhancement - Pluggable Javascript Naming (#3141)
* Core - Move NameConverter to IJavascriptObjectRepository

- Move NameConverter property from BindingOptions to IJavascriptObjectRepository
- Remove BindingOptions.CamelCaseJavascriptNames

**Breaking Change**

Follow up to https://github.com/cefsharp/CefSharp/commit/898ca38e7a7261b3a42c33b2abf5eac6c022ddde

* Core - Javascript Binding Pluggable Naming Improvements

- Added some basic unit tests (more required)
- DefaultBinder now accepts a IJavascriptNameConverter passed into the constructor
  to allow for conversion of names

* Core - Replace WeakReference with WeakReference<T>
2020-07-27 20:13:16 +10:00
amaitland 25ab209380 MethodRunnerQueue/ConcurrentMethodRunnerQueue - Remove custom task execution queue
- ConcurrentMethodRunnerQueue we now directly queue tasks on TaskScheduler.Default
- MethodRunnerQueue now uses LimitedConcurrencyLevelTaskScheduler (example from Microsoft) to limit execution to one concurrent task
- MethodRunnerQueue tasks are now run on the ThreadPool directly instead of our own custom thread, should have some threading implications
for user
- IMethodRunnerQueue now implements IDisposable

Resolves #2873
2019-09-06 11:05:18 +10:00
Alex Maitland fe98124c9b 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
2019-06-08 17:21:49 +10:00
Chris bef5dd37c4 Maintenance - Fixed formatting, file encoding, and copyright year (#2504)
* Applied formatting

* Fixed file encoding + Updated copyright year

* Updated License

* Fixed more file encoding

* Copyright notice now shows the year the file was created
2018-09-10 10:41:13 +10:00
Chris 244aab0408 Fixed a deadlock and a possible race condition in MethodRunnerQueue
Resolves #2105
2017-08-30 23:48:23 +02:00
amaitland 767b478dc6 Add Experimental option where bound async methods are queued on TaskScheduler.Default.
Set `CefSharpSettings.ConcurrentTaskExecution = true;` to enable this feature, should be set before the first ChromiumWebBrowser instance is created.
2017-05-04 12:53:48 +10:00
Chris cd934267c6 Updated copyright year and made sure it used same format everywhere (#1966) 2017-03-06 08:44:37 +10:00
dga 86c3ec547e Target default scheduler to fix #1630 2016-03-17 21:58:14 +01:00
amaitland bae3c28e92 Update copyright to 2016 2016-01-11 14:11:30 +10:00
amaitland 2f3d9f868f Make js callbacks and async methods Frame aware - add FrameId so they can be executed on a specific frame
Resolves a problem where multiple contexts are created and only the first one is dealt with properly (each frame has it's own V8 context)
2015-10-11 20:41:17 +10:00
amaitland 8a8da5b35a Async JSB now working in popups
Still have the issue of callbacks not working as expect, for some reason it can't find the context
2015-09-24 20:08:15 +10:00
amaitland 562d6ea51c Catch OperationCanceledException otherwise VS will break (if you have break on user unhandled exceptions enabled)
Add in braces and extra lines (simple formating)
2015-08-03 14:52:58 +10:00
cefsharp-ms f804ca48ec added missing copyright notices 2015-07-31 17:17:04 +02:00
cefsharp-ms 5651aadd5b MethodRunnerQueue consumer thread modified to run tasks on the same thread instead of the threadpool. 2015-07-31 17:16:57 +02:00
cefsharp-ms bf08e671ff MethodRunnerQueue made a bit smarter 2015-07-23 15:13:12 +02:00
cefsharp-ms a8db666642 added async bound method result callback on browser process side 2015-07-23 15:12:28 +02:00
cefsharp-ms 7744b7197f async bindings are dispatched to a background thread for each browser 2015-07-23 15:12:05 +02:00