summaryrefslogtreecommitdiffstats
path: root/chrome_frame/update_launcher.cc
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 /chrome_frame/update_launcher.cc
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 'chrome_frame/update_launcher.cc')
-rw-r--r--chrome_frame/update_launcher.cc14
1 files changed, 6 insertions, 8 deletions
diff --git a/chrome_frame/update_launcher.cc b/chrome_frame/update_launcher.cc
index b2d23123..439626d 100644
--- a/chrome_frame/update_launcher.cc
+++ b/chrome_frame/update_launcher.cc
@@ -7,6 +7,7 @@
#include <windows.h>
#include <Shellapi.h>
+#include "base/win/scoped_com_initializer.h"
#include "google_update/google_update_idl.h"
namespace {
@@ -54,15 +55,14 @@ std::wstring GetUpdateCommandFromArguments(const wchar_t* command_line) {
DWORD LaunchUpdateCommand(const std::wstring& command) {
DWORD exit_code = kLaunchFailureExitCode;
- HRESULT hr = ::CoInitialize(NULL);
-
- if (SUCCEEDED(hr)) {
+ base::win::ScopedCOMInitializer com_initializer;
+ if (com_initializer.succeeded()) {
IProcessLauncher* ipl = NULL;
HANDLE process = NULL;
- hr = ::CoCreateInstance(__uuidof(ProcessLauncherClass), NULL,
- CLSCTX_ALL, __uuidof(IProcessLauncher),
- reinterpret_cast<void**>(&ipl));
+ HRESULT hr = ::CoCreateInstance(__uuidof(ProcessLauncherClass), NULL,
+ CLSCTX_ALL, __uuidof(IProcessLauncher),
+ reinterpret_cast<void**>(&ipl));
if (SUCCEEDED(hr)) {
ULONG_PTR phandle = NULL;
@@ -80,8 +80,6 @@ DWORD LaunchUpdateCommand(const std::wstring& command) {
::CloseHandle(process);
if (ipl)
ipl->Release();
-
- ::CoUninitialize();
}
return exit_code;