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

Side by Side Diff: base/threading/com_thread.h

Issue 11048029: Allow Thread to initialize COM for Windows consumers who need it (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 months 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 unified diff | Download patch | Annotate | Revision Log
Property Changes:
Added: svn:eol-style
## -0,0 +1 ##
+LF
\ No newline at end of property
OLDNEW
(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 // ComThread is a Thread which, on Windows, initializes COM on the spawned
6 // thread when it's created and shuts down COM just before the spawned thread is
7 // destroyed. On non-Windows, ComThread is identical to Thread. This allows
8 // consumers to use ComThread in cross-platform code without having to do any
9 // conditional #includes or typedefs of their own.
10
11 #ifndef BASE_THREADING_COM_THREAD_H_
12 #define BASE_THREADING_COM_THREAD_H_
13
14 #include "base/threading/thread.h"
15
16 #if defined(OS_WIN)
17 #include "base/memory/scoped_ptr.h"
18 #include "base/win/scoped_com_initializer.h"
19 #endif
20
21 namespace base {
22
23 class BASE_EXPORT ComThread : public Thread {
24 public:
25 ComThread(const char* name, bool use_mta) : Thread(name), use_mta_(use_mta) {}
26 virtual ~ComThread() { Stop(); }
27
28 #if defined(OS_WIN)
29 bool Start();
30
31 protected:
32 virtual void Init() OVERRIDE; // Creates com_initializer_.
33 virtual void CleanUp() OVERRIDE; // Destroys com_initializer_.
34
35 private:
36 scoped_ptr<win::ScopedCOMInitializer> com_initializer_;
37 #endif
38
39 private:
40 bool use_mta_;
41
42 DISALLOW_COPY_AND_ASSIGN(ComThread);
43 };
44
45 } // namespace base
46
47 #endif // BASE_THREADING_COM_THREAD_H_
OLDNEW
« no previous file with comments | « base/base.gypi ('k') | base/threading/com_thread_win.cc » ('j') | chrome_frame/utils.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698