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

Issue 8275030: Support MTA as well in the scoped COM initializer. (Closed)

Created:
9 years, 2 months ago by tommi (sloooow) - chröme
Modified:
9 years, 2 months ago
CC:
chromium-reviews, brettw-cc_chromium.org
Visibility:
Public.

Description

Support MTA as well in the scoped COM initializer. BUG=none Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=105811

Patch Set 1 #

Unified diffs Side-by-side diffs Delta from patch set Stats (+16 lines, -1 line) Patch
M base/win/scoped_com_initializer.h View 2 chunks +16 lines, -1 line 0 comments Download

Messages

Total messages: 3 (0 generated)
tommi (sloooow) - chröme
Hi reviewers, There are a couple of upcoming changes in the media folder that use ...
9 years, 2 months ago (2011-10-14 09:51:42 UTC) #1
cpu_(ooo_6.6-7.5)
lgtm
9 years, 2 months ago (2011-10-14 22:14:03 UTC) #2
tommi (sloooow) - chröme
9 years, 2 months ago (2011-10-17 14:39:08 UTC) #3
Submitting later today as Brett is on leave.  Thanks CPU.

On Fri, Oct 14, 2011 at 11:51 AM, <tommi@chromium.org> wrote:

> Reviewers: cpu, brettw,
>
> Message:
> Hi reviewers,
>
> There are a couple of upcoming changes in the media folder that use the
> MTA.
> Instead of adding another wrapper class for initializing COM (e.g. like
> ScopedXPSInitializer) I figured adding it to the one and only
> ScopedCOMInitializer would be better and suggest using that instead. Is
> there
> any reason not to?
>
> Tommi
>
> Description:
> Support MTA as well in the scoped COM initializer.
>
> BUG=none
>
> Please review this at
http://codereview.chromium.**org/8275030/<http://codereview.chromium.org/8275...
>
> SVN Base:
svn://svn.chromium.org/chrome/**trunk/src/<http://svn.chromium.org/chrome/trunk/src/>
>
> Affected files:
>  M     base/win/scoped_com_**initializer.h
>
>
> Index: base/win/scoped_com_**initializer.h
> ==============================**==============================**=======
> --- base/win/scoped_com_**initializer.h   (revision 105060)
> +++ base/win/scoped_com_**initializer.h   (working copy)
> @@ -16,18 +16,29 @@
>  namespace base {
>  namespace win {
>
> -// Initializes COM in the constructor (STA), and uninitializes COM in the
> +// Initializes COM in the constructor (STA or MTA), and uninitializes COM
> in the
>  // destructor.
>  class ScopedCOMInitializer {
>  public:
> +  // Enum value provided to initialize the thread as an MTA instead of
> STA.
> +  enum SelectMTA { kMTA };
> +
> +  // Constructor for STA initialization.
>   ScopedCOMInitializer() : hr_(CoInitialize(NULL)) {
>   }
>
> +  // Constructor for MTA initialization.
> +  explicit ScopedCOMInitializer(SelectMTA mta)
> +    : hr_(CoInitializeEx(NULL, COINIT_MULTITHREADED)) {
> +  }
> +
>   ScopedCOMInitializer::~**ScopedCOMInitializer() {
>     if (SUCCEEDED(hr_))
>       CoUninitialize();
>   }
>
> +  bool succeeded() const { return SUCCEEDED(hr_); }
> +
>  private:
>   HRESULT hr_;
>
> @@ -45,9 +56,13 @@
>  // Do-nothing class for other platforms.
>  class ScopedCOMInitializer {
>  public:
> +  enum SelectMTA { kMTA };
>   ScopedCOMInitializer() {}
> +  explicit ScopedCOMInitializer(SelectMTA mta) {}
>   ~ScopedCOMInitializer() {}
>
> +  bool succeeded() const { return true; }
> +
>  private:
>   DISALLOW_COPY_AND_ASSIGN(**ScopedCOMInitializer);
>  };
>
>
>

Powered by Google App Engine
This is Rietveld 408576698