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

Unified Diff: chrome_frame/utils.h

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: chrome_frame/utils.h
===================================================================
--- chrome_frame/utils.h (revision 159813)
+++ chrome_frame/utils.h (working copy)
@@ -17,6 +17,7 @@
#include "base/metrics/histogram.h"
#include "base/string16.h"
#include "base/threading/thread.h"
+#include "base/win/scoped_com_initializer.h"
#include "base/win/scoped_comptr.h"
#include "googleurl/src/gurl.h"
#include "ui/gfx/rect.h"
@@ -399,22 +400,27 @@
class STAThread : public base::Thread {
public:
explicit STAThread(const char *name) : Thread(name) {}
- ~STAThread() {
+ virtual ~STAThread() {
Stop();
}
+
bool Start() {
return StartWithOptions(Options(MessageLoop::TYPE_UI, 0));
}
+
protected:
- // Called just prior to starting the message loop
virtual void Init() {
grt (UTC plus 2) 2012/10/03 13:37:28 OVERRIDE
- ::CoInitialize(0);
+ com_initializer_.reset(new base::win::ScopedCOMInitializer());
}
- // Called just after the message loop ends
virtual void CleanUp() {
grt (UTC plus 2) 2012/10/03 13:37:28 OVERRIDE
- ::CoUninitialize();
+ com_initializer_.reset();
}
+
+ private:
+ scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_;
+
+ DISALLOW_COPY_AND_ASSIGN(STAThread);
};
std::wstring GuidToString(const GUID& guid);

Powered by Google App Engine
This is Rietveld 408576698