Net Core - Support for compiling with .Net Core 3.1

- Make Wpf/WinForms/OffScreen projects target AnyCPU
Only the VC++ projects are platform specific now.
- Remove BrowserSubProcess project reference
Not needed as we now have a standalone exe
- Add OffScreen example
- Add WPF Example project
- Fix some compile errors for main solution
- Add BrowserSubProcess executable
- JavascriptObjectRepository remove isAsync param
Rather than throw exception remove the option
- BrowserSubprocess Exclude the WCF specific code from the netCore project
- Add some ifdef/ifndef to exclude the WCF specific implementation
- Move WCF implementation into separate namespace
This commit is contained in:
amaitland
2020-07-18 13:30:54 +10:00
parent a0d90788aa
commit e8cf336bf3
42 changed files with 420 additions and 181 deletions
@@ -6,7 +6,9 @@
#include "include/cef_v8.h"
#include "JavascriptCallbackRegistry.h"
#ifndef NETCOREAPP
#include "JavascriptObjectWrapper.h"
#endif
#include "Async/JavascriptAsyncObjectWrapper.h"
using namespace System::Runtime::Serialization;
@@ -14,6 +16,9 @@ using namespace System::Linq;
using namespace System::Collections::Generic;
using namespace CefSharp::Internals::Async;
#ifndef NETCOREAPP
using namespace CefSharp::Internals::Wcf;
#endif
namespace CefSharp
{
@@ -28,10 +33,14 @@ namespace CefSharp
//Is static so ids are unique to this process https://github.com/cefsharp/CefSharp/issues/2792
static int64 _lastCallback;
#ifndef NETCOREAPP
initonly List<JavascriptObjectWrapper^>^ _wrappedObjects;
#endif
initonly List<JavascriptAsyncObjectWrapper^>^ _wrappedAsyncObjects;
initonly Dictionary<int64, JavascriptAsyncMethodCallback^>^ _methodCallbacks;
#ifndef NETCOREAPP
IBrowserProcess^ _browserProcess;
#endif
// The entire set of possible JavaScript functions to
// call directly into.
JavascriptCallbackRegistry^ _callbackRegistry;
@@ -45,10 +54,16 @@ namespace CefSharp
}
public:
#ifdef NETCOREAPP
JavascriptRootObjectWrapper(int browserId)
#else
JavascriptRootObjectWrapper(int browserId, IBrowserProcess^ browserProcess)
#endif
{
#ifndef NETCOREAPP
_browserProcess = browserProcess;
_wrappedObjects = gcnew List<JavascriptObjectWrapper^>();
#endif
_wrappedAsyncObjects = gcnew List<JavascriptAsyncObjectWrapper^>();
_callbackRegistry = gcnew JavascriptCallbackRegistry(browserId);
_methodCallbacks = gcnew Dictionary<int64, JavascriptAsyncMethodCallback^>();
@@ -62,12 +77,15 @@ namespace CefSharp
_callbackRegistry = nullptr;
}
#ifndef NETCOREAPP
for each (JavascriptObjectWrapper^ var in _wrappedObjects)
{
delete var;
}
_wrappedObjects->Clear();
#endif
for each (JavascriptAsyncObjectWrapper^ var in _wrappedAsyncObjects)
{
delete var;