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

Unified Diff: remoting/base/auto_thread.h

Issue 11348087: Add AutoThread types for Windows that initialize COM. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Separate COM init type from thread type. Created 8 years, 1 month 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
« no previous file with comments | « no previous file | remoting/base/auto_thread.cc » ('j') | remoting/base/auto_thread.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/base/auto_thread.h
diff --git a/remoting/base/auto_thread.h b/remoting/base/auto_thread.h
index 4a349766bf082463cb65d9a738974359040d00ff..6242839359de7b1ef73356c17ecc5ed550077229 100644
--- a/remoting/base/auto_thread.h
+++ b/remoting/base/auto_thread.h
@@ -40,13 +40,24 @@ class AutoThread : base::PlatformThread::Delegate {
const char* name,
scoped_refptr<AutoThreadTaskRunner> joiner);
+#if defined(OS_WIN)
+ // Create an AutoThread initialized for COM. |com_init_type| specifies the
+ // type of COM apartment to initialize.
+ enum ComInitType { COM_INIT_NONE, COM_INIT_STA, COM_INIT_MTA };
+ static scoped_refptr<AutoThreadTaskRunner> CreateWithLoopAndComInitTypes(
+ const char* name,
+ scoped_refptr<AutoThreadTaskRunner> joiner,
+ MessageLoop::Type loop_type,
+ ComInitType com_init_type);
+#endif
+
// Construct the AutoThread. |name| identifies the thread for debugging.
explicit AutoThread(const char* name);
// Waits for the thread to exit, and then destroys it.
virtual ~AutoThread();
- // Starts a the thread, running the specified type of MessageLoop. Returns
+ // Starts the thread, running the specified type of MessageLoop. Returns
// an AutoThreadTaskRunner through which tasks may be posted to the thread
// if successful, or NULL on failure.
//
@@ -58,8 +69,11 @@ class AutoThread : base::PlatformThread::Delegate {
// thread will exit when no references to the TaskRunner remain.
scoped_refptr<AutoThreadTaskRunner> StartWithType(MessageLoop::Type type);
- // Shorthand for StartWithType(MessageLoop::TYPE_DEFAULT).
- scoped_refptr<AutoThreadTaskRunner> Start();
+#if defined(OS_WIN)
+ // Configures the thread to initialize the specified COM apartment type.
+ // SetComInitType() must be called before Start().
+ void SetComInitType(ComInitType com_init_type);
+#endif
private:
AutoThread(const char* name, AutoThreadTaskRunner* joiner);
@@ -74,6 +88,11 @@ class AutoThread : base::PlatformThread::Delegate {
struct StartupData;
StartupData* startup_data_;
+#if defined(OS_WIN)
+ // Specifies which kind of COM apartment to initialize, if any.
+ ComInitType com_init_type_;
+#endif
+
// The thread's handle.
base::PlatformThreadHandle thread_;
« no previous file with comments | « no previous file | remoting/base/auto_thread.cc » ('j') | remoting/base/auto_thread.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698