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

Side by Side Diff: chrome/app/chrome_crash_reporter_client_win.cc

Issue 2867063002: Stability instrumentation Crashpad integration (Closed)
Patch Set: Siggi round 3 Created 3 years, 7 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 // TODO(ananta/scottmg) 5 // TODO(ananta/scottmg)
6 // Add test coverage for Crashpad. 6 // Add test coverage for Crashpad.
7 #include "chrome/app/chrome_crash_reporter_client_win.h" 7 #include "chrome/app/chrome_crash_reporter_client_win.h"
8 8
9 #include <windows.h> 9 #include <windows.h>
10 10
11 #include <assert.h> 11 #include <assert.h>
12 #include <shellapi.h> 12 #include <shellapi.h>
13 13
14 #include <iterator> 14 #include <iterator>
15 #include <memory> 15 #include <memory>
16 #include <string> 16 #include <string>
17 #include <vector>
17 18
18 #include "base/command_line.h" 19 #include "base/command_line.h"
19 #include "base/debug/crash_logging.h" 20 #include "base/debug/crash_logging.h"
20 #include "base/debug/leak_annotations.h" 21 #include "base/debug/leak_annotations.h"
21 #include "base/format_macros.h" 22 #include "base/format_macros.h"
22 #include "base/rand_util.h" 23 #include "base/rand_util.h"
23 #include "chrome/common/chrome_result_codes.h" 24 #include "chrome/common/chrome_result_codes.h"
24 #include "chrome/install_static/install_util.h" 25 #include "chrome/install_static/install_util.h"
25 #include "chrome/install_static/user_data_dir.h" 26 #include "chrome/install_static/user_data_dir.h"
26 #include "components/crash/content/app/crashpad.h" 27 #include "components/crash/content/app/crashpad.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 void ChromeCrashReporterClient::InitializeCrashReportingForProcess() { 234 void ChromeCrashReporterClient::InitializeCrashReportingForProcess() {
234 static ChromeCrashReporterClient* instance = nullptr; 235 static ChromeCrashReporterClient* instance = nullptr;
235 if (instance) 236 if (instance)
236 return; 237 return;
237 238
238 instance = new ChromeCrashReporterClient(); 239 instance = new ChromeCrashReporterClient();
239 ANNOTATE_LEAKING_OBJECT_PTR(instance); 240 ANNOTATE_LEAKING_OBJECT_PTR(instance);
240 241
241 std::wstring process_type = install_static::GetSwitchValueFromCommandLine( 242 std::wstring process_type = install_static::GetSwitchValueFromCommandLine(
242 ::GetCommandLine(), install_static::kProcessType); 243 ::GetCommandLine(), install_static::kProcessType);
244 std::wstring user_data_dir;
245 // DO NOT SUBMIT: validate use of CHECK.
246 CHECK(install_static::GetUserDataDirectory(&user_data_dir, nullptr));
grt (UTC plus 2) 2017/05/11 21:08:16 i think this is wrong. the one true user data dir
manzagop (departed) 2017/05/12 19:27:32 I tried the second approach. - I needed to make t
grt (UTC plus 2) 2017/05/15 13:03:18 Ah, I see now that the user data dir is only compu
manzagop (departed) 2017/05/15 13:43:45 Why do you say the user-data-dir would be not init
manzagop (departed) 2017/05/15 14:21:35 As per offline discussion, the concern is wasted w
243 // Don't set up Crashpad crash reporting in the Crashpad handler itself, nor 247 // Don't set up Crashpad crash reporting in the Crashpad handler itself, nor
244 // in the fallback crash handler for the Crashpad handler process. 248 // in the fallback crash handler for the Crashpad handler process.
245 if (process_type != install_static::kCrashpadHandler && 249 if (process_type != install_static::kCrashpadHandler &&
246 process_type != install_static::kFallbackHandler) { 250 process_type != install_static::kFallbackHandler) {
247 crash_reporter::SetCrashReporterClient(instance); 251 crash_reporter::SetCrashReporterClient(instance);
248 crash_reporter::InitializeCrashpadWithEmbeddedHandler( 252 crash_reporter::InitializeCrashpadWithEmbeddedHandler(
249 process_type.empty(), install_static::UTF16ToUTF8(process_type)); 253 process_type.empty(), install_static::UTF16ToUTF8(process_type),
254 install_static::UTF16ToUTF8(user_data_dir));
250 } 255 }
251 } 256 }
252 #endif // NACL_WIN64 257 #endif // NACL_WIN64
253 258
254 bool ChromeCrashReporterClient::GetAlternativeCrashDumpLocation( 259 bool ChromeCrashReporterClient::GetAlternativeCrashDumpLocation(
255 base::string16* crash_dir) { 260 base::string16* crash_dir) {
256 // By setting the BREAKPAD_DUMP_LOCATION environment variable, an alternate 261 // By setting the BREAKPAD_DUMP_LOCATION environment variable, an alternate
257 // location to write breakpad crash dumps can be set. 262 // location to write breakpad crash dumps can be set.
258 *crash_dir = 263 *crash_dir =
259 install_static::GetEnvironmentString16(L"BREAKPAD_DUMP_LOCATION"); 264 install_static::GetEnvironmentString16(L"BREAKPAD_DUMP_LOCATION");
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
408 413
409 return base::RandDouble() < probability; 414 return base::RandDouble() < probability;
410 } 415 }
411 416
412 bool ChromeCrashReporterClient::EnableBreakpadForProcess( 417 bool ChromeCrashReporterClient::EnableBreakpadForProcess(
413 const std::string& process_type) { 418 const std::string& process_type) {
414 // This is not used by Crashpad (at least on Windows). 419 // This is not used by Crashpad (at least on Windows).
415 NOTREACHED(); 420 NOTREACHED();
416 return true; 421 return true;
417 } 422 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698