Chromium Code Reviews| 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); |