summaryrefslogtreecommitdiffstats
path: root/ui
diff options
context:
space:
mode:
authorpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-03 17:14:48 +0000
committerpkasting@chromium.org <pkasting@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-10-03 17:14:48 +0000
commit451fd90d924b6fd4e6f208952b525cab2029cd6d (patch)
tree6cf9bec9c237224f6d70de9ea5c1cee7d31cd63f /ui
parent748d7a09fe3c109b5a829ebabdc97edd347f42e6 (diff)
downloadchromium_src-451fd90d924b6fd4e6f208952b525cab2029cd6d.zip
chromium_src-451fd90d924b6fd4e6f208952b525cab2029cd6d.tar.gz
chromium_src-451fd90d924b6fd4e6f208952b525cab2029cd6d.tar.bz2
Use ScopedCOMInitializer in more places. While this doesn't always simplify code, it does mean we do consistent logging and error-checking at all these sites.
BUG=none TEST=none Review URL: https://codereview.chromium.org/11050009 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@159908 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui')
-rw-r--r--ui/base/dialogs/base_shell_dialog_win.cc13
1 files changed, 6 insertions, 7 deletions
diff --git a/ui/base/dialogs/base_shell_dialog_win.cc b/ui/base/dialogs/base_shell_dialog_win.cc
index 8d6072d..fa339cb 100644
--- a/ui/base/dialogs/base_shell_dialog_win.cc
+++ b/ui/base/dialogs/base_shell_dialog_win.cc
@@ -7,6 +7,7 @@
#include <algorithm>
#include "base/threading/thread.h"
+#include "base/win/scoped_com_initializer.h"
namespace {
@@ -17,11 +18,12 @@ class ShellDialogThread : public base::Thread {
ShellDialogThread() : base::Thread("Chrome_ShellDialogThread") { }
~ShellDialogThread();
- protected:
+ private:
void Init();
void CleanUp();
- private:
+ scoped_ptr<base::win::ScopedCOMInitializer> com_initializer_;
+
DISALLOW_COPY_AND_ASSIGN(ShellDialogThread);
};
@@ -30,14 +32,11 @@ ShellDialogThread::~ShellDialogThread() {
}
void ShellDialogThread::Init() {
- // Initializes the COM library on the current thread.
- CoInitialize(NULL);
+ com_initializer_.reset(new base::win::ScopedCOMInitializer());
}
void ShellDialogThread::CleanUp() {
- // Closes the COM library on the current thread. CoInitialize must
- // be balanced by a corresponding call to CoUninitialize.
- CoUninitialize();
+ com_initializer_.reset();
}
} // namespace