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

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

Issue 2221833005: Adding support for sampling crashes in Chrome on Windows. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rkaplow's comments Created 4 years, 4 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 #include <string.h> 8 #include <string.h>
9 9
10 #if BUILDFLAG(ENABLE_KASKO) 10 #if BUILDFLAG(ENABLE_KASKO)
(...skipping 277 matching lines...) Expand 10 before | Expand all | Expand 10 after
288 #if defined(OS_WIN) 288 #if defined(OS_WIN)
289 void InitializeCrashpadWithEmbeddedHandler(bool initial_client, 289 void InitializeCrashpadWithEmbeddedHandler(bool initial_client,
290 const std::string& process_type) { 290 const std::string& process_type) {
291 InitializeCrashpadImpl(initial_client, process_type, true); 291 InitializeCrashpadImpl(initial_client, process_type, true);
292 } 292 }
293 #endif // OS_WIN 293 #endif // OS_WIN
294 294
295 void SetUploadsEnabled(bool enable_uploads) { 295 void SetUploadsEnabled(bool enable_uploads) {
296 if (g_database) { 296 if (g_database) {
297 crashpad::Settings* settings = g_database->GetSettings(); 297 crashpad::Settings* settings = g_database->GetSettings();
298 settings->SetUploadsEnabled(enable_uploads); 298 settings->SetUploadsEnabled(
299 enable_uploads && GetCrashReporterClient()->GetCollectStatsInSample());
299 } 300 }
300 } 301 }
301 302
302 bool GetUploadsEnabled() { 303 bool GetUploadsEnabled() {
303 if (g_database) { 304 if (g_database) {
304 crashpad::Settings* settings = g_database->GetSettings(); 305 crashpad::Settings* settings = g_database->GetSettings();
305 bool enable_uploads; 306 bool enable_uploads;
306 if (settings->GetUploadsEnabled(&enable_uploads)) { 307 if (settings->GetUploadsEnabled(&enable_uploads)) {
307 return enable_uploads; 308 return enable_uploads;
308 } 309 }
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
453 } 454 }
454 455
455 #endif // BUILDFLAG(ENABLE_KASKO) 456 #endif // BUILDFLAG(ENABLE_KASKO)
456 457
457 } // namespace crash_reporter 458 } // namespace crash_reporter
458 459
459 #if defined(OS_WIN) 460 #if defined(OS_WIN)
460 461
461 extern "C" { 462 extern "C" {
462 463
464 // This function is used in chrome_metrics_services_manager_client.cc to trigger
465 // changes to if crash uploads are enabled.
Mark Mentovai 2016/08/11 18:32:25 trigger changes to the upload-enabled state
jwd 2016/08/11 21:41:03 Done.
466 void __declspec(dllexport) __cdecl SetUploadsEnabledImpl(bool enable_uploads) {
467 crash_reporter::SetUploadsEnabled(enable_uploads);
468 }
469
463 // NOTE: This function is used by SyzyASAN to annotate crash reports. If you 470 // NOTE: This function is used by SyzyASAN to annotate crash reports. If you
464 // change the name or signature of this function you will break SyzyASAN 471 // change the name or signature of this function you will break SyzyASAN
465 // instrumented releases of Chrome. Please contact syzygy-team@chromium.org 472 // instrumented releases of Chrome. Please contact syzygy-team@chromium.org
466 // before doing so! See also http://crbug.com/567781. 473 // before doing so! See also http://crbug.com/567781.
467 void __declspec(dllexport) __cdecl SetCrashKeyValueImpl(const wchar_t* key, 474 void __declspec(dllexport) __cdecl SetCrashKeyValueImpl(const wchar_t* key,
468 const wchar_t* value) { 475 const wchar_t* value) {
469 crash_reporter::SetCrashKeyValue(base::UTF16ToUTF8(key), 476 crash_reporter::SetCrashKeyValue(base::UTF16ToUTF8(key),
470 base::UTF16ToUTF8(value)); 477 base::UTF16ToUTF8(value));
471 } 478 }
472 479
473 void __declspec(dllexport) __cdecl ClearCrashKeyValueImpl(const wchar_t* key) { 480 void __declspec(dllexport) __cdecl ClearCrashKeyValueImpl(const wchar_t* key) {
474 crash_reporter::ClearCrashKey(base::UTF16ToUTF8(key)); 481 crash_reporter::ClearCrashKey(base::UTF16ToUTF8(key));
475 } 482 }
476 483
477 } // extern "C" 484 } // extern "C"
478 485
479 #endif // OS_WIN 486 #endif // OS_WIN
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698