summaryrefslogtreecommitdiffstats
path: root/chrome/common/win_util.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chrome/common/win_util.cc')
-rw-r--r--chrome/common/win_util.cc9
1 files changed, 9 insertions, 0 deletions
diff --git a/chrome/common/win_util.cc b/chrome/common/win_util.cc
index 1c552a2..6af0db8 100644
--- a/chrome/common/win_util.cc
+++ b/chrome/common/win_util.cc
@@ -82,6 +82,15 @@ UINT_PTR CALLBACK SaveAsDialogHook(HWND dialog, UINT message,
} // namespace
+ScopedCOMInitializer::ScopedCOMInitializer() : hr_(CoInitialize(NULL)) {
+ DCHECK(hr_ != RPC_E_CHANGED_MODE) << "thread already initialized as MTA";
+}
+
+ScopedCOMInitializer::~ScopedCOMInitializer() {
+ if (SUCCEEDED(hr_))
+ CoUninitialize();
+}
+
std::wstring FormatSystemTime(const SYSTEMTIME& time,
const std::wstring& format) {
// If the format string is empty, just use the default format.