diff --git a/CefSharp.BrowserSubprocess/Program.cs b/CefSharp.BrowserSubprocess/Program.cs
index f7bfc2c8f..bac6820ca 100644
--- a/CefSharp.BrowserSubprocess/Program.cs
+++ b/CefSharp.BrowserSubprocess/Program.cs
@@ -2,6 +2,7 @@
using System.Diagnostics;
using System.Runtime.InteropServices;
using System.Windows.Forms;
+using CefSharp.Wrappers;
namespace CefSharp.BrowserSubprocess
{
@@ -14,7 +15,7 @@ namespace CefSharp.BrowserSubprocess
{
var hInstance = Process.GetCurrentProcess().Handle;
LogCommandLine(args);
- MessageBox.Show("Please attach debugger now");
+ //MessageBox.Show("Please attach debugger now");
return ExecuteCefRenderProcess(hInstance);
}
diff --git a/CefSharp.BrowserSubprocess/SubprocessCefApp.cs b/CefSharp.BrowserSubprocess/SubprocessCefApp.cs
index d2d614bc1..b0031d46c 100644
--- a/CefSharp.BrowserSubprocess/SubprocessCefApp.cs
+++ b/CefSharp.BrowserSubprocess/SubprocessCefApp.cs
@@ -1,6 +1,8 @@
-namespace CefSharp.BrowserSubprocess
+using CefSharp.Wrappers;
+
+namespace CefSharp.BrowserSubprocess
{
- internal class SubprocessCefApp : WrappedCefApp
+ internal class SubprocessCefApp : CefAppWrapper
{
}
}
\ No newline at end of file
diff --git a/CefSharp/CefSharp.vcxproj b/CefSharp/CefSharp.vcxproj
index e2e68be12..fd3922d8e 100644
--- a/CefSharp/CefSharp.vcxproj
+++ b/CefSharp/CefSharp.vcxproj
@@ -214,7 +214,6 @@
-
@@ -232,12 +231,15 @@
+
+
+
diff --git a/CefSharp/CefSharp.vcxproj.filters b/CefSharp/CefSharp.vcxproj.filters
index 2d43f8be7..232d4ec60 100644
--- a/CefSharp/CefSharp.vcxproj.filters
+++ b/CefSharp/CefSharp.vcxproj.filters
@@ -21,7 +21,7 @@
{4bc3c074-5cd6-4061-a5b8-b1b43688a707}
-
+
{b5511138-8f2e-4ace-9e68-76929de8c004}
@@ -68,8 +68,11 @@
Source Files
-
- Source Files\CefWrappers
+
+ Source Files\Wrappers
+
+
+ Source Files\Wrappers
@@ -202,5 +205,8 @@
Header Files
+
+ Source Files\Wrappers
+
\ No newline at end of file
diff --git a/CefSharp/CefWrappers/GlobalMethods.cpp b/CefSharp/CefWrappers/GlobalMethods.cpp
deleted file mode 100644
index 5058a6110..000000000
--- a/CefSharp/CefWrappers/GlobalMethods.cpp
+++ /dev/null
@@ -1,34 +0,0 @@
-// Copyright © 2010-2013 The CefSharp Project. All rights reserved.
-//
-// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
-
-// This class exposes "global" CEF methods.
-
-#include "Stdafx.h"
-#include "include/cef_app.h"
-
-using namespace System;
-
-// TODO: Support the stuff that CefApp has. One important question is whether we go with the C++ API or make the (seemingly a bit
-// strange) move to start using the C API instead. It may actually make it possible to write our code in a cleaner fashion. Worth
-// thinking about.
-public ref class WrappedCefApp
-{
- CefRefPtr* cefRefPtr;
-
-public:
- void* GetUnmanaged()
- {
- return cefRefPtr;
- }
-};
-
-public ref class GlobalMethods
-{
-public:
- static int CefExecuteProcess(IntPtr hInstance, WrappedCefApp^ cefApp)
- {
- CefMainArgs mainArgs((HINSTANCE)hInstance.ToPointer());
- return ::CefExecuteProcess(mainArgs, *(CefRefPtr*)cefApp->GetUnmanaged());
- }
-};
diff --git a/CefSharp/Wrappers/CefAppWrapper.cpp b/CefSharp/Wrappers/CefAppWrapper.cpp
new file mode 100644
index 000000000..f1d989402
--- /dev/null
+++ b/CefSharp/Wrappers/CefAppWrapper.cpp
@@ -0,0 +1,34 @@
+// Copyright © 2010-2013 The CefSharp Project. All rights reserved.
+//
+// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
+
+#include "Stdafx.h"
+#include "CefAppWrapper.h"
+
+namespace CefSharp
+{
+ namespace Wrappers
+ {
+ CefAppWrapper::CefAppWrapper()
+ {
+ cefApp = new CefRefPtr(new CefAppUnmanagedWrapper());
+ }
+
+ CefAppWrapper::~CefAppWrapper()
+ {
+ if (is_disposed) return;
+ this->!CefAppWrapper();
+ is_disposed = true;
+ }
+
+ void* CefAppWrapper::GetUnmanaged()
+ {
+ return cefApp;
+ }
+
+ CefAppWrapper::!CefAppWrapper()
+ {
+ delete cefApp;
+ }
+ };
+}
diff --git a/CefSharp/Wrappers/CefAppWrapper.h b/CefSharp/Wrappers/CefAppWrapper.h
new file mode 100644
index 000000000..3425021f9
--- /dev/null
+++ b/CefSharp/Wrappers/CefAppWrapper.h
@@ -0,0 +1,35 @@
+// Copyright © 2010-2013 The CefSharp Project. All rights reserved.
+//
+// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
+
+#include "Stdafx.h"
+#include "include/cef_app.h"
+
+namespace CefSharp
+{
+ namespace Wrappers
+ {
+ private class CefAppUnmanagedWrapper : CefApp
+ {
+ IMPLEMENT_REFCOUNTING(CefAppUnmanagedWrapper);
+ };
+
+ // TODO: Support the stuff that CefApp has. One important question is whether we go with the C++ API or make the (seemingly a bit
+ // strange) move to start using the C API instead. It may actually make it possible to write our code in a cleaner fashion. Worth
+ // thinking about.
+ public ref class CefAppWrapper
+ {
+ private:
+ CefRefPtr* cefApp;
+ bool is_disposed;
+
+ public:
+ CefAppWrapper();
+ ~CefAppWrapper();
+ void* GetUnmanaged();
+
+ private:
+ !CefAppWrapper();
+ };
+ }
+}
diff --git a/CefSharp/Wrappers/GlobalMethods.cpp b/CefSharp/Wrappers/GlobalMethods.cpp
new file mode 100644
index 000000000..71cf2b5f4
--- /dev/null
+++ b/CefSharp/Wrappers/GlobalMethods.cpp
@@ -0,0 +1,27 @@
+// Copyright © 2010-2013 The CefSharp Project. All rights reserved.
+//
+// Use of this source code is governed by a BSD-style license that can be found in the LICENSE file.
+
+// This class exposes "global" CEF methods.
+
+#include "Stdafx.h"
+#include "CefAppWrapper.h"
+#include "include/capi/cef_app_capi.h"
+
+using namespace System;
+
+namespace CefSharp
+{
+ namespace Wrappers
+ {
+ public ref class GlobalMethods
+ {
+ public:
+ static int CefExecuteProcess(IntPtr hInstance, CefAppWrapper^ cefApp)
+ {
+ CefMainArgs cefMainArgs((HINSTANCE)hInstance.ToPointer());
+ return ::CefExecuteProcess(cefMainArgs, *(CefRefPtr*)cefApp->GetUnmanaged());
+ }
+ };
+ }
+}
\ No newline at end of file