| Index: base/threading/com_thread.h
|
| ===================================================================
|
| --- base/threading/com_thread.h (revision 0)
|
| +++ base/threading/com_thread.h (working copy)
|
| @@ -0,0 +1,47 @@
|
| +// 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.
|
| +
|
| +// ComThread is a Thread which, on Windows, initializes COM on the spawned
|
| +// thread when it's created and shuts down COM just before the spawned thread is
|
| +// destroyed. On non-Windows, ComThread is identical to Thread. This allows
|
| +// consumers to use ComThread in cross-platform code without having to do any
|
| +// conditional #includes or typedefs of their own.
|
| +
|
| +#ifndef BASE_THREADING_COM_THREAD_H_
|
| +#define BASE_THREADING_COM_THREAD_H_
|
| +
|
| +#include "base/threading/thread.h"
|
| +
|
| +#if defined(OS_WIN)
|
| +#include "base/memory/scoped_ptr.h"
|
| +#include "base/win/scoped_com_initializer.h"
|
| +#endif
|
| +
|
| +namespace base {
|
| +
|
| +class BASE_EXPORT ComThread : public Thread {
|
| + public:
|
| + ComThread(const char* name, bool use_mta) : Thread(name), use_mta_(use_mta) {}
|
| + virtual ~ComThread() { Stop(); }
|
| +
|
| +#if defined(OS_WIN)
|
| + bool Start();
|
| +
|
| + protected:
|
| + virtual void Init() OVERRIDE; // Creates com_initializer_.
|
| + virtual void CleanUp() OVERRIDE; // Destroys com_initializer_.
|
| +
|
| + private:
|
| + scoped_ptr<win::ScopedCOMInitializer> com_initializer_;
|
| +#endif
|
| +
|
| + private:
|
| + bool use_mta_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(ComThread);
|
| +};
|
| +
|
| +} // namespace base
|
| +
|
| +#endif // BASE_THREADING_COM_THREAD_H_
|
|
|
| Property changes on: base/threading/com_thread.h
|
| ___________________________________________________________________
|
| Added: svn:eol-style
|
| ## -0,0 +1 ##
|
| +LF
|
| \ No newline at end of property
|
|
|