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

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

Issue 2308763002: Integrate Crashpad UMA (Closed)
Patch Set: fixes Created 4 years, 3 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 <memory> 7 #include <memory>
8 8
9 #include "base/environment.h" 9 #include "base/environment.h"
10 #include "base/lazy_instance.h" 10 #include "base/lazy_instance.h"
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 (*annotations)["plat"] = std::string("Win32"); 46 (*annotations)["plat"] = std::string("Win32");
47 #elif defined(ARCH_CPU_X86_64) 47 #elif defined(ARCH_CPU_X86_64)
48 (*annotations)["plat"] = std::string("Win64"); 48 (*annotations)["plat"] = std::string("Win64");
49 #endif 49 #endif
50 } 50 }
51 51
52 base::FilePath PlatformCrashpadInitialization(bool initial_client, 52 base::FilePath PlatformCrashpadInitialization(bool initial_client,
53 bool browser_process, 53 bool browser_process,
54 bool embedded_handler) { 54 bool embedded_handler) {
55 base::FilePath database_path; // Only valid in the browser process. 55 base::FilePath database_path; // Only valid in the browser process.
56 base::FilePath metrics_path; // Only valid in the browser process.
56 bool result = false; 57 bool result = false;
57 58
58 const char kPipeNameVar[] = "CHROME_CRASHPAD_PIPE_NAME"; 59 const char kPipeNameVar[] = "CHROME_CRASHPAD_PIPE_NAME";
59 const char kServerUrlVar[] = "CHROME_CRASHPAD_SERVER_URL"; 60 const char kServerUrlVar[] = "CHROME_CRASHPAD_SERVER_URL";
60 std::unique_ptr<base::Environment> env(base::Environment::Create()); 61 std::unique_ptr<base::Environment> env(base::Environment::Create());
61 if (initial_client) { 62 if (initial_client) {
62 CrashReporterClient* crash_reporter_client = GetCrashReporterClient(); 63 CrashReporterClient* crash_reporter_client = GetCrashReporterClient();
63 64
64 base::string16 database_path_str; 65 base::string16 database_path_str;
65 if (crash_reporter_client->GetCrashDumpLocation(&database_path_str)) 66 if (crash_reporter_client->GetCrashDumpLocation(&database_path_str))
66 database_path = base::FilePath(database_path_str); 67 database_path = base::FilePath(database_path_str);
67 68
69 base::string16 metrics_path_str;
70 if (crash_reporter_client->GetCrashMetricsLocation(&metrics_path_str))
71 metrics_path = base::FilePath(metrics_path_str);
72
68 std::map<std::string, std::string> process_annotations; 73 std::map<std::string, std::string> process_annotations;
69 GetPlatformCrashpadAnnotations(&process_annotations); 74 GetPlatformCrashpadAnnotations(&process_annotations);
70 75
71 #if defined(GOOGLE_CHROME_BUILD) 76 #if defined(GOOGLE_CHROME_BUILD)
72 std::string url = "https://clients2.google.com/cr/report"; 77 std::string url = "https://clients2.google.com/cr/report";
73 #else 78 #else
74 std::string url; 79 std::string url;
75 #endif 80 #endif
76 81
77 // Allow the crash server to be overridden for testing. If the variable 82 // Allow the crash server to be overridden for testing. If the variable
(...skipping 24 matching lines...) Expand all
102 // The prefetch argument added here has to be documented in 107 // The prefetch argument added here has to be documented in
103 // chrome_switches.cc, below the kPrefetchArgument* constants. A constant 108 // chrome_switches.cc, below the kPrefetchArgument* constants. A constant
104 // can't be used here because crashpad can't depend on Chrome. 109 // can't be used here because crashpad can't depend on Chrome.
105 arguments.push_back("/prefetch:7"); 110 arguments.push_back("/prefetch:7");
106 } else { 111 } else {
107 base::FilePath exe_dir = exe_file.DirName(); 112 base::FilePath exe_dir = exe_file.DirName();
108 exe_file = exe_dir.Append(FILE_PATH_LITERAL("crashpad_handler.exe")); 113 exe_file = exe_dir.Append(FILE_PATH_LITERAL("crashpad_handler.exe"));
109 } 114 }
110 115
111 result = g_crashpad_client.Get().StartHandler( 116 result = g_crashpad_client.Get().StartHandler(
112 exe_file, database_path, url, process_annotations, arguments, false); 117 exe_file, database_path, metrics_path, url, process_annotations,
118 arguments, false);
113 119
114 // If we're the browser, push the pipe name into the environment so child 120 // If we're the browser, push the pipe name into the environment so child
115 // processes can connect to it. If we inherited another crashpad_handler's 121 // processes can connect to it. If we inherited another crashpad_handler's
116 // pipe name, we'll overwrite it here. 122 // pipe name, we'll overwrite it here.
117 env->SetVar(kPipeNameVar, 123 env->SetVar(kPipeNameVar,
118 base::UTF16ToUTF8(g_crashpad_client.Get().GetHandlerIPCPipe())); 124 base::UTF16ToUTF8(g_crashpad_client.Get().GetHandlerIPCPipe()));
119 } else { 125 } else {
120 std::string pipe_name_utf8; 126 std::string pipe_name_utf8;
121 result = env->GetVar(kPipeNameVar, &pipe_name_utf8); 127 result = env->GetVar(kPipeNameVar, &pipe_name_utf8);
122 if (result) { 128 if (result) {
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
283 void __declspec(dllexport) __cdecl UnregisterNonABICompliantCodeRange( 289 void __declspec(dllexport) __cdecl UnregisterNonABICompliantCodeRange(
284 void* start) { 290 void* start) {
285 ExceptionHandlerRecord* record = 291 ExceptionHandlerRecord* record =
286 reinterpret_cast<ExceptionHandlerRecord*>(start); 292 reinterpret_cast<ExceptionHandlerRecord*>(start);
287 293
288 CHECK(RtlDeleteFunctionTable(&record->runtime_function)); 294 CHECK(RtlDeleteFunctionTable(&record->runtime_function));
289 } 295 }
290 #endif // ARCH_CPU_X86_64 296 #endif // ARCH_CPU_X86_64
291 297
292 } // extern "C" 298 } // extern "C"
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698