summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-23 04:33:52 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-23 04:33:52 +0000
commit458e9521995681381912ece90eb2a8ea210ae07d (patch)
treed5eeabdee1104f65f42990bbd7edc238a57480d5
parent1822c9949f19195ca0000f0be929a5398a7c24e6 (diff)
downloadchromium_src-458e9521995681381912ece90eb2a8ea210ae07d.zip
chromium_src-458e9521995681381912ece90eb2a8ea210ae07d.tar.gz
chromium_src-458e9521995681381912ece90eb2a8ea210ae07d.tar.bz2
Add methods to base::Thread to allow Windows consumers to ask for COM to be intialized on the Thread.
This makes one functional change: when COM is initialized in STA mode, the Thread is forced to use a TYPE_UI message loop. Most of the modified consumers here didn't previously do that, but after discussion with cpu and siggi, it seems safest, even though it's more heavyweight. BUG=none TEST=none Review URL: https://codereview.chromium.org/11048029 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@163503 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--base/threading/thread.cc36
-rw-r--r--base/threading/thread.h31
-rw-r--r--chrome_frame/buggy_bho_handling.cc3
-rw-r--r--chrome_frame/urlmon_url_request.cc21
-rw-r--r--chrome_frame/urlmon_url_request.h22
-rw-r--r--chrome_frame/utils.h28
-rw-r--r--content/browser/renderer_host/media/media_stream_manager.cc24
-rw-r--r--content/browser/renderer_host/media/media_stream_manager.h29
-rw-r--r--media/audio/audio_input_device_unittest.cc1
-rw-r--r--media/audio/audio_input_volume_unittest.cc1
-rw-r--r--media/audio/audio_manager_base.cc26
-rw-r--r--media/audio/audio_manager_base.h27
-rw-r--r--media/audio/fake_audio_output_stream.cc1
-rw-r--r--remoting/host/setup/daemon_controller_win.cc42
-rw-r--r--ui/base/dialogs/base_shell_dialog_win.cc35
15 files changed, 92 insertions, 235 deletions
diff --git a/base/threading/thread.cc b/base/threading/thread.cc
index 1ba6053..f4ba3ff 100644
--- a/base/threading/thread.cc
+++ b/base/threading/thread.cc
@@ -11,6 +11,10 @@
#include "base/threading/thread_restrictions.h"
#include "base/synchronization/waitable_event.h"
+#if defined(OS_WIN)
+#include "base/win/scoped_com_initializer.h"
+#endif
+
namespace base {
namespace {
@@ -45,7 +49,11 @@ struct Thread::StartupData {
};
Thread::Thread(const char* name)
- : started_(false),
+ :
+#if defined(OS_WIN)
+ com_status_(NONE),
+#endif
+ started_(false),
stopping_(false),
running_(false),
startup_data_(NULL),
@@ -60,11 +68,20 @@ Thread::~Thread() {
}
bool Thread::Start() {
- return StartWithOptions(Options());
+ Options options;
+#if defined(OS_WIN)
+ if (com_status_ == STA)
+ options.message_loop_type = MessageLoop::TYPE_UI;
+#endif
+ return StartWithOptions(options);
}
bool Thread::StartWithOptions(const Options& options) {
DCHECK(!message_loop_);
+#if defined(OS_WIN)
+ DCHECK((com_status_ != STA) ||
+ (options.message_loop_type == MessageLoop::TYPE_UI));
+#endif
SetThreadWasQuitProperly(false);
@@ -90,7 +107,7 @@ bool Thread::StartWithOptions(const Options& options) {
}
void Thread::Stop() {
- if (!thread_was_started())
+ if (!started_)
return;
StopSoon();
@@ -157,6 +174,15 @@ void Thread::ThreadMain() {
message_loop.set_thread_name(name_);
message_loop_ = &message_loop;
+#if defined(OS_WIN)
+ scoped_ptr<win::ScopedCOMInitializer> com_initializer;
+ if (com_status_ != NONE) {
+ com_initializer.reset((com_status_ == STA) ?
+ new win::ScopedCOMInitializer() :
+ new win::ScopedCOMInitializer(win::ScopedCOMInitializer::kMTA));
+ }
+#endif
+
// Let the thread do extra initialization.
// Let's do this before signaling we are started.
Init();
@@ -172,6 +198,10 @@ void Thread::ThreadMain() {
// Let the thread do extra cleanup.
CleanUp();
+#if defined(OS_WIN)
+ com_initializer.reset();
+#endif
+
// Assert that MessageLoop::Quit was called by ThreadQuitHelper.
DCHECK(GetThreadWasQuitProperly());
diff --git a/base/threading/thread.h b/base/threading/thread.h
index 1d24cf3..645e67c 100644
--- a/base/threading/thread.h
+++ b/base/threading/thread.h
@@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef BASE_THREAD_H_
-#define BASE_THREAD_H_
+#ifndef BASE_THREADING_THREAD_H_
+#define BASE_THREADING_THREAD_H_
#include <string>
@@ -57,6 +57,18 @@ class BASE_EXPORT Thread : PlatformThread::Delegate {
// before it is destructed.
virtual ~Thread();
+#if defined(OS_WIN)
+ // Causes the thread to initialize COM. This must be called before calling
+ // Start() or StartWithOptions(). If |use_mta| is false, the thread is also
+ // started with a TYPE_UI message loop. It is an error to call
+ // init_com_with_mta(false) and then StartWithOptions() with any message loop
+ // type other than TYPE_UI.
+ void init_com_with_mta(bool use_mta) {
+ DCHECK(!started_);
+ com_status_ = use_mta ? MTA : STA;
+ }
+#endif
+
// Starts the thread. Returns true if the thread was successfully started;
// otherwise, returns false. Upon successful return, the message_loop()
// getter will return non-null.
@@ -148,11 +160,22 @@ class BASE_EXPORT Thread : PlatformThread::Delegate {
}
private:
- bool thread_was_started() const { return started_; }
+#if defined(OS_WIN)
+ enum ComStatus {
+ NONE,
+ STA,
+ MTA,
+ };
+#endif
// PlatformThread::Delegate methods:
virtual void ThreadMain() OVERRIDE;
+#if defined(OS_WIN)
+ // Whether this thread needs to initialize COM, and if so, in what mode.
+ ComStatus com_status_;
+#endif
+
// Whether we successfully started the thread.
bool started_;
@@ -187,4 +210,4 @@ class BASE_EXPORT Thread : PlatformThread::Delegate {
} // namespace base
-#endif // BASE_THREAD_H_
+#endif // BASE_THREADING_THREAD_H_
diff --git a/chrome_frame/buggy_bho_handling.cc b/chrome_frame/buggy_bho_handling.cc
index aab4e69..9d00528 100644
--- a/chrome_frame/buggy_bho_handling.cc
+++ b/chrome_frame/buggy_bho_handling.cc
@@ -4,10 +4,11 @@
#include "chrome_frame/buggy_bho_handling.h"
+#include <algorithm>
+
#include "base/logging.h"
#include "base/process_util.h"
#include "base/win/scoped_comptr.h"
-
#include "chrome_frame/exception_barrier.h"
#include "chrome_frame/function_stub.h"
#include "chrome_frame/utils.h"
diff --git a/chrome_frame/urlmon_url_request.cc b/chrome_frame/urlmon_url_request.cc
index 535debb..6d33e551 100644
--- a/chrome_frame/urlmon_url_request.cc
+++ b/chrome_frame/urlmon_url_request.cc
@@ -15,6 +15,7 @@
#include "base/string_number_conversions.h"
#include "base/stringprintf.h"
#include "base/threading/platform_thread.h"
+#include "base/threading/thread.h"
#include "base/utf_string_conversions.h"
#include "chrome/common/automation_messages.h"
#include "chrome_frame/bind_context_info.h"
@@ -1401,8 +1402,8 @@ UrlmonUrlRequestManager::UrlmonUrlRequestManager()
privileged_mode_(false),
container_(NULL),
background_worker_thread_enabled_(true) {
- background_thread_.reset(new ResourceFetcherThread(
- "cf_iexplore_background_thread"));
+ background_thread_.reset(new base::Thread("cf_iexplore_background_thread"));
+ background_thread_->init_com_with_mta(false);
background_worker_thread_enabled_ =
GetConfigBool(true, kUseBackgroundThreadForSubResources);
if (background_worker_thread_enabled_) {
@@ -1445,19 +1446,3 @@ void UrlmonUrlRequestManager::AddPrivacyDataForUrl(
0);
}
}
-
-UrlmonUrlRequestManager::ResourceFetcherThread::ResourceFetcherThread(
- const char* name) : base::Thread(name) {
-}
-
-UrlmonUrlRequestManager::ResourceFetcherThread::~ResourceFetcherThread() {
- Stop();
-}
-
-void UrlmonUrlRequestManager::ResourceFetcherThread::Init() {
- com_initializer_.reset(new base::win::ScopedCOMInitializer());
-}
-
-void UrlmonUrlRequestManager::ResourceFetcherThread::CleanUp() {
- com_initializer_.reset();
-}
diff --git a/chrome_frame/urlmon_url_request.h b/chrome_frame/urlmon_url_request.h
index 94027ff..3ec3a9e 100644
--- a/chrome_frame/urlmon_url_request.h
+++ b/chrome_frame/urlmon_url_request.h
@@ -11,15 +11,12 @@
#include <map>
#include <string>
-#include "base/threading/thread.h"
#include "chrome_frame/plugin_url_request.h"
#include "chrome_frame/urlmon_moniker.h"
#include "chrome_frame/utils.h"
namespace base {
-namespace win {
-class ScopedCOMInitializer;
-}
+class Thread;
}
class UrlmonUrlRequest;
@@ -28,21 +25,6 @@ class UrlmonUrlRequestManager
: public PluginUrlRequestManager,
public PluginUrlRequestDelegate {
public:
- // Sub resources on the pages in chrome frame are fetched on this thread.
- class ResourceFetcherThread : public base::Thread {
- public:
- explicit ResourceFetcherThread(const char* name);
- virtual ~ResourceFetcherThread();
-
- virtual void Init();
- virtual void CleanUp();
-
- private:
- scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_;
-
- DISALLOW_COPY_AND_ASSIGN(ResourceFetcherThread);
- };
-
// Contains the privacy information for all requests issued by this instance.
struct PrivacyInfo {
public:
@@ -151,7 +133,7 @@ class UrlmonUrlRequestManager
base::Lock* request_map_lock);
scoped_refptr<UrlmonUrlRequest> pending_request_;
- scoped_ptr<ResourceFetcherThread> background_thread_;
+ scoped_ptr<base::Thread> background_thread_;
bool stopping_;
diff --git a/chrome_frame/utils.h b/chrome_frame/utils.h
index 389a8f5..2204571 100644
--- a/chrome_frame/utils.h
+++ b/chrome_frame/utils.h
@@ -16,8 +16,6 @@
#include "base/logging.h"
#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"
@@ -396,32 +394,6 @@ STDMETHODIMP QueryInterfaceIfDelegateSupports(void* obj, REFIID iid,
#define COM_INTERFACE_BLIND_DELEGATE() \
COM_INTERFACE_ENTRY_FUNC_BLIND(0, CheckOutgoingInterface<_ComMapClass>)
-// Thread that enters STA and has a UI message loop.
-class STAThread : public base::Thread {
- public:
- explicit STAThread(const char *name) : Thread(name) {}
- virtual ~STAThread() {
- Stop();
- }
-
- bool Start() {
- return StartWithOptions(Options(MessageLoop::TYPE_UI, 0));
- }
-
- private:
- virtual void Init() OVERRIDE {
- com_initializer_.reset(new base::win::ScopedCOMInitializer());
- }
-
- virtual void CleanUp() OVERRIDE {
- com_initializer_.reset();
- }
-
- scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_;
-
- DISALLOW_COPY_AND_ASSIGN(STAThread);
-};
-
std::wstring GuidToString(const GUID& guid);
// The urls retrieved from the IMoniker interface don't contain the anchor
diff --git a/content/browser/renderer_host/media/media_stream_manager.cc b/content/browser/renderer_host/media/media_stream_manager.cc
index c3245c8..c8b25bc 100644
--- a/content/browser/renderer_host/media/media_stream_manager.cc
+++ b/content/browser/renderer_host/media/media_stream_manager.cc
@@ -10,6 +10,7 @@
#include "base/compiler_specific.h"
#include "base/logging.h"
#include "base/rand_util.h"
+#include "base/threading/thread.h"
#include "content/browser/renderer_host/media/audio_input_device_manager.h"
#include "content/browser/renderer_host/media/media_stream_requester.h"
#include "content/browser/renderer_host/media/media_stream_ui_controller.h"
@@ -61,24 +62,6 @@ static bool Requested(const StreamOptions& options,
options.video_type == stream_type);
}
-#if defined(OS_WIN)
-DeviceThread::DeviceThread(const char* name) : base::Thread(name) {
-}
-
-DeviceThread::~DeviceThread() {
- Stop();
-}
-
-void DeviceThread::Init() {
- com_initializer_.reset(new base::win::ScopedCOMInitializer(
- base::win::ScopedCOMInitializer::kMTA));
-}
-
-void DeviceThread::CleanUp() {
- com_initializer_.reset();
-}
-#endif
-
// TODO(xians): Merge DeviceRequest with MediaStreamRequest.
class MediaStreamManager::DeviceRequest {
public:
@@ -588,7 +571,10 @@ void MediaStreamManager::EnsureDeviceManagersStarted() {
if (device_thread_.get())
return;
- device_thread_.reset(new DeviceThread("MediaStreamDeviceThread"));
+ device_thread_.reset(new base::Thread("MediaStreamDeviceThread"));
+#if defined(OS_WIN)
+ device_thread_->init_com_with_mta(true);
+#endif
CHECK(device_thread_->Start());
audio_input_device_manager_ =
diff --git a/content/browser/renderer_host/media/media_stream_manager.h b/content/browser/renderer_host/media/media_stream_manager.h
index 7db8a37..405f19d 100644
--- a/content/browser/renderer_host/media/media_stream_manager.h
+++ b/content/browser/renderer_host/media/media_stream_manager.h
@@ -31,20 +31,15 @@
#include "base/memory/ref_counted.h"
#include "base/message_loop.h"
#include "base/system_monitor/system_monitor.h"
-#include "base/threading/thread.h"
#include "content/browser/renderer_host/media/media_stream_provider.h"
#include "content/browser/renderer_host/media/media_stream_settings_requester.h"
#include "content/common/media/media_stream_options.h"
#include "content/common/content_export.h"
#include "content/public/browser/browser_thread.h"
-#if defined(OS_WIN)
namespace base {
-namespace win {
-class ScopedCOMInitializer;
+class Thread;
}
-}
-#endif
namespace content {
class MediaStreamUIController;
@@ -61,26 +56,6 @@ class MediaStreamDeviceSettings;
class MediaStreamRequester;
class VideoCaptureManager;
-// Thread that enters MTA on Windows.
-#if defined(OS_WIN)
-class DeviceThread : public base::Thread {
- public:
- explicit DeviceThread(const char* name);
- virtual ~DeviceThread();
-
- protected:
- virtual void Init() OVERRIDE;
- virtual void CleanUp() OVERRIDE;
-
- private:
- scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_;
-
- DISALLOW_COPY_AND_ASSIGN(DeviceThread);
-};
-#else
-typedef base::Thread DeviceThread;
-#endif
-
// MediaStreamManager is used to generate and close new media devices, not to
// start the media flow.
// The classes requesting new media streams are answered using
@@ -253,7 +228,7 @@ class CONTENT_EXPORT MediaStreamManager
void StopMonitoring();
// Device thread shared by VideoCaptureManager and AudioInputDeviceManager.
- scoped_ptr<DeviceThread> device_thread_;
+ scoped_ptr<base::Thread> device_thread_;
scoped_ptr<content::MediaStreamUIController> ui_controller_;
diff --git a/media/audio/audio_input_device_unittest.cc b/media/audio/audio_input_device_unittest.cc
index 6eb6dfb..dc211a4 100644
--- a/media/audio/audio_input_device_unittest.cc
+++ b/media/audio/audio_input_device_unittest.cc
@@ -3,6 +3,7 @@
// found in the LICENSE file.
#include "base/environment.h"
+#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "media/audio/audio_manager.h"
#include "media/audio/audio_manager_base.h"
diff --git a/media/audio/audio_input_volume_unittest.cc b/media/audio/audio_input_volume_unittest.cc
index 9d241b8..8fc68b4 100644
--- a/media/audio/audio_input_volume_unittest.cc
+++ b/media/audio/audio_input_volume_unittest.cc
@@ -4,6 +4,7 @@
#include <cmath>
+#include "base/logging.h"
#include "base/memory/scoped_ptr.h"
#include "media/audio/audio_io.h"
#include "media/audio/audio_manager_base.h"
diff --git a/media/audio/audio_manager_base.cc b/media/audio/audio_manager_base.cc
index 0a095ff..1963a61 100644
--- a/media/audio/audio_manager_base.cc
+++ b/media/audio/audio_manager_base.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/command_line.h"
#include "base/message_loop_proxy.h"
+#include "base/threading/thread.h"
#include "media/audio/audio_output_dispatcher_impl.h"
#include "media/audio/audio_output_proxy.h"
#include "media/audio/audio_output_resampler.h"
@@ -38,24 +39,6 @@ static const int kMaxInputChannels = 2;
const char AudioManagerBase::kDefaultDeviceName[] = "Default";
const char AudioManagerBase::kDefaultDeviceId[] = "default";
-#if defined(OS_WIN)
-AudioThread::AudioThread(const char* name) : base::Thread(name) {
-}
-
-AudioThread::~AudioThread() {
- Stop();
-}
-
-void AudioThread::Init() {
- com_initializer_.reset(new base::win::ScopedCOMInitializer(
- base::win::ScopedCOMInitializer::kMTA));
-}
-
-void AudioThread::CleanUp() {
- com_initializer_.reset();
-}
-#endif
-
AudioManagerBase::AudioManagerBase()
: num_active_input_streams_(0),
max_num_output_streams_(kDefaultMaxOutputStreams),
@@ -80,7 +63,10 @@ AudioManagerBase::~AudioManagerBase() {
void AudioManagerBase::Init() {
base::AutoLock lock(audio_thread_lock_);
DCHECK(!audio_thread_.get());
- audio_thread_.reset(new AudioThread("AudioThread"));
+ audio_thread_.reset(new base::Thread("AudioThread"));
+#if defined(OS_WIN)
+ audio_thread_->init_com_with_mta(true);
+#endif
CHECK(audio_thread_->Start());
message_loop_ = audio_thread_->message_loop_proxy();
}
@@ -274,7 +260,7 @@ bool AudioManagerBase::IsRecordingInProcess() {
void AudioManagerBase::Shutdown() {
// To avoid running into deadlocks while we stop the thread, shut it down
// via a local variable while not holding the audio thread lock.
- scoped_ptr<AudioThread> audio_thread;
+ scoped_ptr<base::Thread> audio_thread;
{
base::AutoLock lock(audio_thread_lock_);
audio_thread_.swap(audio_thread);
diff --git a/media/audio/audio_manager_base.h b/media/audio/audio_manager_base.h
index 8d06ab8..3c06522 100644
--- a/media/audio/audio_manager_base.h
+++ b/media/audio/audio_manager_base.h
@@ -13,37 +13,20 @@
#include "base/memory/scoped_ptr.h"
#include "base/observer_list.h"
#include "base/synchronization/lock.h"
-#include "base/threading/thread.h"
#include "media/audio/audio_manager.h"
#if defined(OS_WIN)
#include "base/win/scoped_com_initializer.h"
#endif
+namespace base {
+class Thread;
+}
+
namespace media {
class AudioOutputDispatcher;
-// Thread that enters MTA on Windows.
-#if defined(OS_WIN)
-class AudioThread : public base::Thread {
- public:
- explicit AudioThread(const char* name);
- virtual ~AudioThread();
-
- protected:
- virtual void Init() OVERRIDE;
- virtual void CleanUp() OVERRIDE;
-
- private:
- scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_;
-
- DISALLOW_COPY_AND_ASSIGN(AudioThread);
-};
-#else
-typedef base::Thread AudioThread;
-#endif
-
// AudioManagerBase provides AudioManager functions common for all platforms.
class MEDIA_EXPORT AudioManagerBase : public AudioManager {
public:
@@ -168,7 +151,7 @@ class MEDIA_EXPORT AudioManagerBase : public AudioManager {
ObserverList<AudioDeviceListener> output_listeners_;
// Thread used to interact with audio streams created by this audio manager.
- scoped_ptr<AudioThread> audio_thread_;
+ scoped_ptr<base::Thread> audio_thread_;
mutable base::Lock audio_thread_lock_;
// The message loop of the audio thread this object runs on. Set on Init().
diff --git a/media/audio/fake_audio_output_stream.cc b/media/audio/fake_audio_output_stream.cc
index fe03859..38b5437 100644
--- a/media/audio/fake_audio_output_stream.cc
+++ b/media/audio/fake_audio_output_stream.cc
@@ -7,6 +7,7 @@
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/logging.h"
+#include "base/message_loop.h"
#include "media/audio/audio_manager_base.h"
namespace media {
diff --git a/remoting/host/setup/daemon_controller_win.cc b/remoting/host/setup/daemon_controller_win.cc
index 3b1a571..fd96af2 100644
--- a/remoting/host/setup/daemon_controller_win.cc
+++ b/remoting/host/setup/daemon_controller_win.cc
@@ -22,7 +22,6 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
#include "base/win/scoped_bstr.h"
-#include "base/win/scoped_com_initializer.h"
#include "base/win/scoped_comptr.h"
#include "base/win/windows_version.h"
#include "remoting/base/scoped_sc_handle_win.h"
@@ -64,23 +63,6 @@ const int kPrivilegedTimeoutSec = 5 * 60;
// that the old binary will go away sooner.
const int kUnprivilegedTimeoutSec = 60;
-// A base::Thread implementation that initializes COM on the new thread.
-class ComThread : public base::Thread {
- public:
- explicit ComThread(const char* name);
- virtual ~ComThread();
-
- bool Start();
-
- private:
- virtual void Init() OVERRIDE;
- virtual void CleanUp() OVERRIDE;
-
- scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_;
-
- DISALLOW_COPY_AND_ASSIGN(ComThread);
-};
-
class DaemonControllerWin : public remoting::DaemonController {
public:
DaemonControllerWin();
@@ -165,38 +147,18 @@ class DaemonControllerWin : public remoting::DaemonController {
HWND window_handle_;
// The worker thread used for servicing long running operations.
- ComThread worker_thread_;
+ base::Thread worker_thread_;
scoped_ptr<DaemonInstallerWin> installer_;
DISALLOW_COPY_AND_ASSIGN(DaemonControllerWin);
};
-ComThread::ComThread(const char* name) : base::Thread(name) {
-}
-
-ComThread::~ComThread() {
- Stop();
-}
-
-bool ComThread::Start() {
- // N.B. The single threaded COM apartment must be run on a UI message loop.
- base::Thread::Options thread_options(MessageLoop::TYPE_UI, 0);
- return StartWithOptions(thread_options);
-}
-
-void ComThread::Init() {
- com_initializer_.reset(new base::win::ScopedCOMInitializer());
-}
-
-void ComThread::CleanUp() {
- com_initializer_.reset();
-}
-
DaemonControllerWin::DaemonControllerWin()
: control_is_elevated_(false),
window_handle_(NULL),
worker_thread_(kDaemonControllerThreadName) {
+ worker_thread_.init_com_with_mta(false);
if (!worker_thread_.Start()) {
LOG(FATAL) << "Failed to start the Daemon Controller worker thread.";
}
diff --git a/ui/base/dialogs/base_shell_dialog_win.cc b/ui/base/dialogs/base_shell_dialog_win.cc
index fa339cb..39bbbb7 100644
--- a/ui/base/dialogs/base_shell_dialog_win.cc
+++ b/ui/base/dialogs/base_shell_dialog_win.cc
@@ -9,38 +9,6 @@
#include "base/threading/thread.h"
#include "base/win/scoped_com_initializer.h"
-namespace {
-
-// Helpers to show certain types of Windows shell dialogs in a way that doesn't
-// block the UI of the entire app.
-class ShellDialogThread : public base::Thread {
- public:
- ShellDialogThread() : base::Thread("Chrome_ShellDialogThread") { }
- ~ShellDialogThread();
-
- private:
- void Init();
- void CleanUp();
-
- scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_;
-
- DISALLOW_COPY_AND_ASSIGN(ShellDialogThread);
-};
-
-ShellDialogThread::~ShellDialogThread() {
- Stop();
-}
-
-void ShellDialogThread::Init() {
- com_initializer_.reset(new base::win::ScopedCOMInitializer());
-}
-
-void ShellDialogThread::CleanUp() {
- com_initializer_.reset();
-}
-
-} // namespace
-
namespace ui {
// static
@@ -95,7 +63,8 @@ void BaseShellDialogImpl::DisableOwner(HWND owner) {
// static
base::Thread* BaseShellDialogImpl::CreateDialogThread() {
- base::Thread* thread = new ShellDialogThread;
+ base::Thread* thread = new base::Thread("Chrome_ShellDialogThread");
+ thread->init_com_with_mta(false);
bool started = thread->Start();
DCHECK(started);
return thread;