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 #ifndef UI_BASE_WIN_SCOPED_OLE_INITIALIZER_H_ 6 #define UI_BASE_WIN_SCOPED_OLE_INITIALIZER_H_ 7 8 #include <ole2.h> 9 10 #include "base/basictypes.h" 11 #include "ui/base/ui_export.h" 12 13 namespace ui { 14 15 class UI_EXPORT ScopedOleInitializer { 16 public: 17 ScopedOleInitializer(); 18 ~ScopedOleInitializer(); 19 20 private: 21 #ifndef NDEBUG 22 // In debug builds we use this variable to catch a potential bug where a 23 // ScopedOleInitializer instance is deleted on a different thread than it 24 // was initially created on. If that ever happens it can have bad 25 // consequences and the cause can be tricky to track down. 26 DWORD thread_id_; 27 #endif 28 HRESULT hr_; 29 30 DISALLOW_COPY_AND_ASSIGN(ScopedOleInitializer); 31 }; 32 33 } // namespace 34 35 #endif // UI_BASE_WIN_SCOPED_OLE_INITIALIZER_H_ 36