Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5325)

Unified Diff: chrome_frame/update_launcher.cc

Issue 11050009: Use ScopedCOMInitializer in more places. While this doesn't always simplify code, it does mean we … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome_frame/update_launcher.cc
===================================================================
--- chrome_frame/update_launcher.cc (revision 159813)
+++ chrome_frame/update_launcher.cc (working copy)
@@ -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 @@
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 @@
::CloseHandle(process);
if (ipl)
ipl->Release();
-
- ::CoUninitialize();
}
return exit_code;

Powered by Google App Engine
This is Rietveld 408576698