Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1817)

Unified Diff: content/browser/renderer_host/render_process_host_impl.cc

Issue 11050009: Use ScopedCOMInitializer in more places. While this doesn't always simplify code, it does mean we … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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 {

Powered by Google App Engine
This is Rietveld 408576698