Chromium Code Reviews| Index: base/threading/com_thread_win.cc |
| =================================================================== |
| --- base/threading/com_thread_win.cc (revision 0) |
| +++ base/threading/com_thread_win.cc (working copy) |
| @@ -0,0 +1,38 @@ |
| +// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| +// Use of this source code is governed by a BSD-style license that can be |
| +// found in the LICENSE file. |
| + |
| +#include "base/threading/com_thread.h" |
| + |
| +namespace base { |
| + |
| +ComThread::ComThread(const char* name, bool use_mta) |
| + : Thread(name), |
| + use_mta_(use_mta) { |
| +} |
| + |
| +ComThread::~ComThread() { |
| + Stop(); |
| +} |
| + |
| +bool ComThread::Start() { |
| + if (!use_mta_) |
|
Jamie
2012/10/03 23:46:04
Is this test correct? It's doing the opposite to w
Peter Kasting
2012/10/03 23:47:12
No, it's wrong. Sigh. Thanks :(
|
| + return Thread::Start(); |
| + |
| + // STA COM objects require a UI message loop in order to pump Windows |
| + // messages, which they may use for various purposes. |
| + Thread::Options thread_options(MessageLoop::TYPE_UI, 0); |
| + return StartWithOptions(thread_options); |
| +} |
| + |
| +void ComThread::Init() { |
| + com_initializer_.reset(use_mta_ ? |
| + new win::ScopedCOMInitializer(win::ScopedCOMInitializer::kMTA) : |
| + new win::ScopedCOMInitializer()); |
| +} |
| + |
| +void ComThread::CleanUp() { |
| + com_initializer_.reset(); |
| +} |
| + |
| +} // namespace base |
| Property changes on: base/threading/com_thread_win.cc |
| ___________________________________________________________________ |
| Added: svn:eol-style |
| ## -0,0 +1 ## |
| +LF |
| \ No newline at end of property |