Index: components/crash/content/app/crashpad_win.cc |
diff --git a/components/crash/content/app/crashpad_win.cc b/components/crash/content/app/crashpad_win.cc |
index 7c45badb8ea39120443f19f9e841156a2bdc2262..2144818d15ce4f6abdc3ee2960779a36164acdaf 100644 |
--- a/components/crash/content/app/crashpad_win.cc |
+++ b/components/crash/content/app/crashpad_win.cc |
@@ -9,6 +9,7 @@ |
#include "base/environment.h" |
#include "base/lazy_instance.h" |
#include "base/numerics/safe_conversions.h" |
+#include "base/path_service.h" |
#include "base/strings/string16.h" |
#include "base/strings/string_number_conversions.h" |
#include "base/strings/utf_string_conversions.h" |
@@ -33,11 +34,12 @@ |
void GetPlatformCrashpadAnnotations( |
std::map<std::string, std::string>* annotations) { |
CrashReporterClient* crash_reporter_client = GetCrashReporterClient(); |
- wchar_t exe_file[MAX_PATH] = {}; |
- CHECK(::GetModuleFileName(nullptr, exe_file, arraysize(exe_file))); |
+ base::FilePath exe_file; |
+ CHECK(PathService::Get(base::FILE_EXE, &exe_file)); |
base::string16 product_name, version, special_build, channel_name; |
crash_reporter_client->GetProductNameAndVersion( |
- exe_file, &product_name, &version, &special_build, &channel_name); |
+ exe_file.value(), &product_name, &version, &special_build, |
+ &channel_name); |
(*annotations)["prod"] = base::UTF16ToUTF8(product_name); |
(*annotations)["ver"] = base::UTF16ToUTF8(version); |
(*annotations)["channel"] = base::UTF16ToUTF8(channel_name); |
@@ -54,11 +56,12 @@ |
bool browser_process, |
bool embedded_handler) { |
base::FilePath database_path; // Only valid in the browser process. |
- bool result = false; |
+ bool result; |
const char kPipeNameVar[] = "CHROME_CRASHPAD_PIPE_NAME"; |
const char kServerUrlVar[] = "CHROME_CRASHPAD_SERVER_URL"; |
std::unique_ptr<base::Environment> env(base::Environment::Create()); |
+ |
if (initial_client) { |
CrashReporterClient* crash_reporter_client = GetCrashReporterClient(); |
@@ -79,11 +82,8 @@ |
// isn't present in the environment then the default URL will remain. |
env->GetVar(kServerUrlVar, &url); |
- wchar_t exe_file_path[MAX_PATH] = {}; |
- CHECK( |
- ::GetModuleFileName(nullptr, exe_file_path, arraysize(exe_file_path))); |
- |
- base::FilePath exe_file(exe_file_path); |
+ base::FilePath exe_file; |
+ CHECK(PathService::Get(base::FILE_EXE, &exe_file)); |
bool is_per_user_install = |
crash_reporter_client->GetIsPerUserInstall(exe_file.value()); |
@@ -100,14 +100,18 @@ |
std::vector<std::string> arguments; |
if (embedded_handler) { |
arguments.push_back(std::string("--type=") + switches::kCrashpadHandler); |
- // The prefetch argument added here has to be documented in |
- // chrome_switches.cc, below the kPrefetchArgument* constants. A |
- // constant can't be used here because crashpad can't depend on Chrome. |
- arguments.push_back("/prefetch:7"); |
+ |
+ if (startup_metric_utils::GetPreReadOptions().use_prefetch_argument) { |
+ // The prefetch argument added here has to be documented in |
+ // chrome_switches.cc, below the kPrefetchArgument* constants. A |
+ // constant can't be used here because crashpad can't depend on Chrome. |
+ arguments.push_back("/prefetch:7"); |
+ } |
} else { |
base::FilePath exe_dir = exe_file.DirName(); |
exe_file = exe_dir.Append(FILE_PATH_LITERAL("crashpad_handler.exe")); |
} |
+ |
// TODO(scottmg): See https://crashpad.chromium.org/bug/23. |
arguments.push_back("--no-rate-limit"); |
@@ -131,6 +135,7 @@ |
if (result) { |
result = g_crashpad_client.Get().UseHandler(); |
} |
+ |
return database_path; |
} |
@@ -198,15 +203,15 @@ |
HANDLE __declspec(dllexport) __cdecl InjectDumpProcessWithoutCrash( |
HANDLE process) { |
return CreateRemoteThread( |
- process, nullptr, 0, |
- crash_reporter::internal::DumpProcessWithoutCrashThread, 0, 0, nullptr); |
+ process, NULL, 0, crash_reporter::internal::DumpProcessWithoutCrashThread, |
+ 0, 0, NULL); |
} |
HANDLE __declspec(dllexport) __cdecl InjectDumpForHangDebugging( |
HANDLE process) { |
return CreateRemoteThread( |
- process, nullptr, 0, crash_reporter::internal::DumpForHangDebuggingThread, |
- 0, 0, nullptr); |
+ process, NULL, 0, crash_reporter::internal::DumpForHangDebuggingThread, 0, |
+ 0, NULL); |
} |
#if defined(ARCH_CPU_X86_64) |