OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2011 Google Inc. | 2 * Copyright 2011 Google Inc. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
6 */ | 6 */ |
7 | 7 |
8 #include "SkTypes.h" | 8 #include "SkTypes.h" |
9 #if defined(SK_BUILD_FOR_WIN32) | 9 #if defined(SK_BUILD_FOR_WIN32) |
10 | 10 |
| 11 #include "SkAutoCoInitialize.h" |
11 | 12 |
12 #define WIN32_LEAN_AND_MEAN | 13 #include <objbase.h> |
13 #include <windows.h> | 14 #include <winerror.h> |
14 #include <ole2.h> | |
15 #include "SkAutoCoInitialize.h" | |
16 | 15 |
17 SkAutoCoInitialize::SkAutoCoInitialize() : | 16 SkAutoCoInitialize::SkAutoCoInitialize() : |
18 fHR( | 17 fHR( |
19 CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DD
E) | 18 CoInitializeEx(nullptr, COINIT_APARTMENTTHREADED | COINIT_DISABLE_OLE1DD
E) |
20 ) | 19 ) |
21 { } | 20 { } |
22 | 21 |
23 SkAutoCoInitialize::~SkAutoCoInitialize() { | 22 SkAutoCoInitialize::~SkAutoCoInitialize() { |
24 if (SUCCEEDED(this->fHR)) { | 23 if (SUCCEEDED(this->fHR)) { |
25 CoUninitialize(); | 24 CoUninitialize(); |
26 } | 25 } |
27 } | 26 } |
28 | 27 |
29 bool SkAutoCoInitialize::succeeded() { | 28 bool SkAutoCoInitialize::succeeded() { |
30 return SUCCEEDED(this->fHR) || RPC_E_CHANGED_MODE == this->fHR; | 29 return SUCCEEDED(this->fHR) || RPC_E_CHANGED_MODE == this->fHR; |
31 } | 30 } |
32 | 31 |
33 #endif//defined(SK_BUILD_FOR_WIN32) | 32 #endif//defined(SK_BUILD_FOR_WIN32) |
OLD | NEW |