Index: content/browser/renderer_host/render_process_host_impl.cc |
=================================================================== |
--- content/browser/renderer_host/render_process_host_impl.cc (revision 159813) |
+++ content/browser/renderer_host/render_process_host_impl.cc (working copy) |
@@ -7,10 +7,6 @@ |
#include "content/browser/renderer_host/render_process_host_impl.h" |
-#if defined(OS_WIN) |
-#include <objbase.h> // For CoInitialize/CoUninitialize. |
-#endif |
- |
#include <algorithm> |
#include <limits> |
#include <vector> |
@@ -122,6 +118,7 @@ |
#include "webkit/plugins/plugin_switches.h" |
#if defined(OS_WIN) |
+#include "base/win/scoped_com_initializer.h" |
#include "content/common/font_cache_dispatcher_win.h" |
#endif |
@@ -142,14 +139,14 @@ |
channel_id_(channel_id) { |
} |
- ~RendererMainThread() { |
+ virtual ~RendererMainThread() { |
Stop(); |
} |
protected: |
virtual void Init() { |
#if defined(OS_WIN) |
- CoInitialize(NULL); |
+ com_initializer_.reset(new base::win::ScopedCOMInitializer()); |
#endif |
render_process_.reset(new RenderProcessImpl()); |
@@ -160,7 +157,7 @@ |
render_process_.reset(); |
#if defined(OS_WIN) |
- CoUninitialize(); |
+ com_initializer_.reset(); |
#endif |
// It's a little lame to manually set this flag. But the single process |
// RendererThread will receive the WM_QUIT. We don't need to assert on |
@@ -176,7 +173,12 @@ |
private: |
std::string channel_id_; |
+#if defined(OS_WIN) |
+ scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_; |
+#endif |
scoped_ptr<RenderProcess> render_process_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(RendererMainThread); |
}; |
namespace { |