OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "base/threading/com_thread.h" |
| 6 |
| 7 namespace base { |
| 8 |
| 9 bool ComThread::Start() { |
| 10 if (!use_mta_) |
| 11 return Thread::Start(); |
| 12 |
| 13 // STA COM objects require a UI message loop in order to pump Windows |
| 14 // messages, which they may use for various purposes. |
| 15 Thread::Options thread_options(MessageLoop::TYPE_UI, 0); |
| 16 return StartWithOptions(thread_options); |
| 17 } |
| 18 |
| 19 void ComThread::Init() { |
| 20 com_initializer_.reset(use_mta_ ? |
| 21 new win::ScopedCOMInitializer(win::ScopedCOMInitializer::kMTA) : |
| 22 new win::ScopedCOMInitializer()); |
| 23 } |
| 24 |
| 25 void ComThread::CleanUp() { |
| 26 com_initializer_.reset(); |
| 27 } |
| 28 |
| 29 } // namespace base |
OLD | NEW |