Cast: Stop logging kVideoFrameSentToEncoder and rename a couple events.
[chromium-blink-merge.git] / ui / base / win / scoped_ole_initializer.cc
blob48361aa08965037a62a48cbae47f7436dea99bcd
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.
5 #include "ui/base/win/scoped_ole_initializer.h"
7 #include "base/logging.h"
9 namespace ui {
11 ScopedOleInitializer::ScopedOleInitializer()
13 #ifndef NDEBUG
14 // Using the windows API directly to avoid dependency on platform_thread.
15 thread_id_(GetCurrentThreadId()),
16 #endif
17 hr_(OleInitialize(NULL)) {
18 #ifndef NDEBUG
19 if (hr_ == S_FALSE) {
20 LOG(ERROR) << "Multiple OleInitialize() calls for thread " << thread_id_;
21 } else {
22 DCHECK_NE(OLE_E_WRONGCOMPOBJ, hr_) << "Incompatible DLLs on machine";
23 DCHECK_NE(RPC_E_CHANGED_MODE, hr_) << "Invalid COM thread model change";
25 #endif
28 ScopedOleInitializer::~ScopedOleInitializer() {
29 #ifndef NDEBUG
30 DCHECK_EQ(thread_id_, GetCurrentThreadId());
31 #endif
32 if (SUCCEEDED(hr_))
33 OleUninitialize();
36 } // namespace ui