summaryrefslogtreecommitdiffstats
path: root/chrome/installer
diff options
context:
space:
mode:
authortfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-13 05:16:16 +0000
committertfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-02-13 05:16:16 +0000
commit5ba268e57ef721f763a708d4bc01c49254d9cb87 (patch)
tree44e79b1cd45e07ba18bbcc3fbbe535445e144ecf /chrome/installer
parent08809f551659fc17d36f752a0cb81c0af126b4c7 (diff)
downloadchromium_src-5ba268e57ef721f763a708d4bc01c49254d9cb87.zip
chromium_src-5ba268e57ef721f763a708d4bc01c49254d9cb87.tar.gz
chromium_src-5ba268e57ef721f763a708d4bc01c49254d9cb87.tar.bz2
chrome/installer: Make InitializeCrashReporting() return a scoped_ptr.
The idea came first while I found this code was using google_breakpad's scoped_ptr version rather than base's version. Then I saw in win8/ that this function could return a scoped_ptr to make it clear the ownership to caller, i.e., this function passes the ownership of ExceptionHandler to the caller, so it should own the pointer to release it when it is done. BUG=None TEST=None R=grt@chromium.org Review URL: https://codereview.chromium.org/160283002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@250957 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/installer')
-rw-r--r--chrome/installer/setup/setup_main.cc16
1 files changed, 8 insertions, 8 deletions
diff --git a/chrome/installer/setup/setup_main.cc b/chrome/installer/setup/setup_main.cc
index 6df112f..32c26ea 100644
--- a/chrome/installer/setup/setup_main.cc
+++ b/chrome/installer/setup/setup_main.cc
@@ -18,6 +18,7 @@
#include "base/file_version_info.h"
#include "base/files/file_path.h"
#include "base/files/scoped_temp_dir.h"
+#include "base/memory/scoped_ptr.h"
#include "base/path_service.h"
#include "base/process/launch.h"
#include "base/strings/string16.h"
@@ -1278,16 +1279,16 @@ google_breakpad::CustomClientInfo* GetCustomInfo(const wchar_t* exe_path) {
// Initialize crash reporting for this process. This involves connecting to
// breakpad, etc.
-google_breakpad::ExceptionHandler* InitializeCrashReporting(
+scoped_ptr<google_breakpad::ExceptionHandler> InitializeCrashReporting(
bool system_install) {
// Only report crashes if the user allows it.
if (!GoogleUpdateSettings::GetCollectStatsConsent())
- return NULL;
+ return scoped_ptr<google_breakpad::ExceptionHandler>();
// Get the alternate dump directory. We use the temp path.
base::FilePath temp_directory;
if (!base::GetTempDir(&temp_directory) || temp_directory.empty())
- return NULL;
+ return scoped_ptr<google_breakpad::ExceptionHandler>();
wchar_t exe_path[MAX_PATH * 2] = {0};
GetModuleFileName(NULL, exe_path, arraysize(exe_path));
@@ -1299,19 +1300,18 @@ google_breakpad::ExceptionHandler* InitializeCrashReporting(
if (!system_install) {
if (!base::win::GetUserSidString(&user_sid)) {
- return NULL;
+ return scoped_ptr<google_breakpad::ExceptionHandler>();
}
}
base::string16 pipe_name = kGoogleUpdatePipeName;
pipe_name += user_sid;
- google_breakpad::ExceptionHandler* breakpad =
+ return scoped_ptr<google_breakpad::ExceptionHandler>(
new google_breakpad::ExceptionHandler(
temp_directory.value(), NULL, NULL, NULL,
google_breakpad::ExceptionHandler::HANDLER_ALL, kLargerDumpType,
- pipe_name.c_str(), GetCustomInfo(exe_path));
- return breakpad;
+ pipe_name.c_str(), GetCustomInfo(exe_path)));
}
// Uninstalls multi-install Chrome Frame if the current operation is a
@@ -1695,7 +1695,7 @@ int WINAPI wWinMain(HINSTANCE instance, HINSTANCE prev_instance,
prefs.GetBool(installer::master_preferences::kSystemLevel, &system_install);
VLOG(1) << "system install is " << system_install;
- google_breakpad::scoped_ptr<google_breakpad::ExceptionHandler> breakpad(
+ scoped_ptr<google_breakpad::ExceptionHandler> breakpad(
InitializeCrashReporting(system_install));
InstallationState original_state;