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"
11 ScopedOleInitializer::ScopedOleInitializer()
14 // Using the windows API directly to avoid dependency on platform_thread.
15 thread_id_(GetCurrentThreadId()),
17 hr_(OleInitialize(NULL
)) {
20 LOG(ERROR
) << "Multiple OleInitialize() calls for thread " << thread_id_
;
22 DCHECK_NE(OLE_E_WRONGCOMPOBJ
, hr_
) << "Incompatible DLLs on machine";
23 DCHECK_NE(RPC_E_CHANGED_MODE
, hr_
) << "Invalid COM thread model change";
28 ScopedOleInitializer::~ScopedOleInitializer() {
30 DCHECK_EQ(thread_id_
, GetCurrentThreadId());