OLD | NEW |
---|---|
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 Loading... | |
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()); | |
robertshield
2016/08/12 17:49:25
The logic for whether uploads are enabled or not i
jwd
2016/08/12 20:04:31
I don't disagree. But, keeping SetUploadsEnabled a
Mark Mentovai
2016/08/12 20:16:27
The intent is to do this on Windows too. https://c
robertshield
2016/08/12 21:04:43
If this method is to contain logic that can cause
Mark Mentovai
2016/08/12 22:01:57
Changing the name to something more suitable is fi
| |
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 Loading... | |
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 the upload-enabled state. This is done when the metrics services | |
466 // are initialized, and when the user changes their consent for uploads. See | |
467 // crash_reporter::SetUploadsEnabled for effects. | |
468 void __declspec(dllexport) __cdecl SetUploadsEnabledImpl(bool enable_uploads) { | |
469 crash_reporter::SetUploadsEnabled(enable_uploads); | |
Alexei Svitkine (slow)
2016/08/12 17:47:48
So this will be called as a result of UpdateRunnin
jwd
2016/08/12 20:04:31
Yes, you're right. This is already the case, since
| |
470 } | |
471 | |
463 // NOTE: This function is used by SyzyASAN to annotate crash reports. If you | 472 // 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 | 473 // change the name or signature of this function you will break SyzyASAN |
465 // instrumented releases of Chrome. Please contact syzygy-team@chromium.org | 474 // instrumented releases of Chrome. Please contact syzygy-team@chromium.org |
466 // before doing so! See also http://crbug.com/567781. | 475 // before doing so! See also http://crbug.com/567781. |
467 void __declspec(dllexport) __cdecl SetCrashKeyValueImpl(const wchar_t* key, | 476 void __declspec(dllexport) __cdecl SetCrashKeyValueImpl(const wchar_t* key, |
468 const wchar_t* value) { | 477 const wchar_t* value) { |
469 crash_reporter::SetCrashKeyValue(base::UTF16ToUTF8(key), | 478 crash_reporter::SetCrashKeyValue(base::UTF16ToUTF8(key), |
470 base::UTF16ToUTF8(value)); | 479 base::UTF16ToUTF8(value)); |
471 } | 480 } |
472 | 481 |
473 void __declspec(dllexport) __cdecl ClearCrashKeyValueImpl(const wchar_t* key) { | 482 void __declspec(dllexport) __cdecl ClearCrashKeyValueImpl(const wchar_t* key) { |
474 crash_reporter::ClearCrashKey(base::UTF16ToUTF8(key)); | 483 crash_reporter::ClearCrashKey(base::UTF16ToUTF8(key)); |
475 } | 484 } |
476 | 485 |
477 } // extern "C" | 486 } // extern "C" |
478 | 487 |
479 #endif // OS_WIN | 488 #endif // OS_WIN |
OLD | NEW |