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

Side by Side Diff: components/crash/content/app/crashpad_win.cc

Issue 1612663002: Use a valid /prefetch argument when launching a process. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@bit
Patch Set: address comments from gab #10 Created 4 years, 10 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 unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "components/crash/content/app/crashpad.h" 5 #include "components/crash/content/app/crashpad.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
11 #include "base/memory/scoped_ptr.h" 11 #include "base/memory/scoped_ptr.h"
12 #include "base/numerics/safe_conversions.h" 12 #include "base/numerics/safe_conversions.h"
13 #include "base/path_service.h" 13 #include "base/path_service.h"
14 #include "base/strings/string16.h" 14 #include "base/strings/string16.h"
15 #include "base/strings/string_number_conversions.h" 15 #include "base/strings/string_number_conversions.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "build/build_config.h" 17 #include "build/build_config.h"
18 #include "components/crash/content/app/crash_reporter_client.h" 18 #include "components/crash/content/app/crash_reporter_client.h"
19 #include "components/startup_metric_utils/common/pre_read_field_trial_utils_win. h"
20 #include "content/public/common/content_switches.h"
19 #include "third_party/crashpad/crashpad/client/crashpad_client.h" 21 #include "third_party/crashpad/crashpad/client/crashpad_client.h"
20 #include "third_party/crashpad/crashpad/client/crashpad_info.h" 22 #include "third_party/crashpad/crashpad/client/crashpad_info.h"
21 #include "third_party/crashpad/crashpad/client/simulate_crash_win.h" 23 #include "third_party/crashpad/crashpad/client/simulate_crash_win.h"
22 24
23 namespace crash_reporter { 25 namespace crash_reporter {
24 namespace internal { 26 namespace internal {
25 27
26 namespace { 28 namespace {
27 29
28 base::LazyInstance<crashpad::CrashpadClient>::Leaky g_crashpad_client = 30 base::LazyInstance<crashpad::CrashpadClient>::Leaky g_crashpad_client =
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 79
78 // In test binaries, use crashpad_handler directly. Otherwise, we launch 80 // In test binaries, use crashpad_handler directly. Otherwise, we launch
79 // chrome.exe with --type=crashpad-handler. 81 // chrome.exe with --type=crashpad-handler.
80 base::FilePath exe_file; 82 base::FilePath exe_file;
81 CHECK(PathService::Get(base::FILE_EXE, &exe_file)); 83 CHECK(PathService::Get(base::FILE_EXE, &exe_file));
82 if (exe_file.BaseName().value() != FILE_PATH_LITERAL("chrome.exe")) { 84 if (exe_file.BaseName().value() != FILE_PATH_LITERAL("chrome.exe")) {
83 base::FilePath exe_dir = exe_file.DirName(); 85 base::FilePath exe_dir = exe_file.DirName();
84 exe_file = exe_dir.Append(FILE_PATH_LITERAL("crashpad_handler.exe")); 86 exe_file = exe_dir.Append(FILE_PATH_LITERAL("crashpad_handler.exe"));
85 } else { 87 } else {
86 arguments.push_back("--type=crashpad-handler"); 88 arguments.push_back("--type=crashpad-handler");
89
90 if (startup_metric_utils::GetPreReadOptions().use_prefetch_argument))
91 arguments.push_back(switches::kPrefetchArgumentOther);
87 } 92 }
88 93
89 // TODO(scottmg): See https://crashpad.chromium.org/bug/23. 94 // TODO(scottmg): See https://crashpad.chromium.org/bug/23.
90 arguments.push_back("--no-rate-limit"); 95 arguments.push_back("--no-rate-limit");
91 96
92 result = g_crashpad_client.Get().StartHandler( 97 result = g_crashpad_client.Get().StartHandler(
93 exe_file, database_path, url, process_annotations, arguments, false); 98 exe_file, database_path, url, process_annotations, arguments, false);
94 99
95 // If we're the browser, push the pipe name into the environment so child 100 // If we're the browser, push the pipe name into the environment so child
96 // processes can connect to it. If we inherited another crashpad_handler's 101 // processes can connect to it. If we inherited another crashpad_handler's
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 void __declspec(dllexport) __cdecl UnregisterNonABICompliantCodeRange( 270 void __declspec(dllexport) __cdecl UnregisterNonABICompliantCodeRange(
266 void* start) { 271 void* start) {
267 ExceptionHandlerRecord* record = 272 ExceptionHandlerRecord* record =
268 reinterpret_cast<ExceptionHandlerRecord*>(start); 273 reinterpret_cast<ExceptionHandlerRecord*>(start);
269 274
270 CHECK(RtlDeleteFunctionTable(&record->runtime_function)); 275 CHECK(RtlDeleteFunctionTable(&record->runtime_function));
271 } 276 }
272 #endif // ARCH_CPU_X86_64 277 #endif // ARCH_CPU_X86_64
273 278
274 } // extern "C" 279 } // extern "C"
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698