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

Side by Side Diff: android_webview/common/crash_reporter/aw_microdump_crash_reporter.cc

Issue 2717223003: Add WebView-specific whitelist for crash keys. (Closed)
Patch Set: Naming webview whitelist array. Created 3 years, 9 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
« no previous file with comments | « no previous file | android_webview/common/crash_reporter/crash_keys.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "android_webview/common/crash_reporter/aw_microdump_crash_reporter.h" 5 #include "android_webview/common/crash_reporter/aw_microdump_crash_reporter.h"
6 6
7 #include "android_webview/common/aw_descriptors.h" 7 #include "android_webview/common/aw_descriptors.h"
8 #include "android_webview/common/aw_paths.h" 8 #include "android_webview/common/aw_paths.h"
9 #include "android_webview/common/aw_version_info_values.h" 9 #include "android_webview/common/aw_version_info_values.h"
10 #include "android_webview/common/crash_reporter/crash_keys.h" 10 #include "android_webview/common/crash_reporter/crash_keys.h"
11 #include "base/android/build_info.h" 11 #include "base/android/build_info.h"
12 #include "base/base_paths_android.h" 12 #include "base/base_paths_android.h"
13 #include "base/debug/crash_logging.h"
13 #include "base/debug/dump_without_crashing.h" 14 #include "base/debug/dump_without_crashing.h"
14 #include "base/files/file_path.h" 15 #include "base/files/file_path.h"
15 #include "base/lazy_instance.h" 16 #include "base/lazy_instance.h"
16 #include "base/path_service.h" 17 #include "base/path_service.h"
17 #include "base/scoped_native_library.h" 18 #include "base/scoped_native_library.h"
18 #include "base/synchronization/lock.h" 19 #include "base/synchronization/lock.h"
19 #include "build/build_config.h" 20 #include "build/build_config.h"
20 #include "components/crash/content/app/breakpad_linux.h" 21 #include "components/crash/content/app/breakpad_linux.h"
21 #include "components/crash/content/app/crash_reporter_client.h" 22 #include "components/crash/content/app/crash_reporter_client.h"
22 #include "content/public/common/content_switches.h" 23 #include "content/public/common/content_switches.h"
23 24
24 namespace android_webview { 25 namespace android_webview {
25 namespace crash_reporter { 26 namespace crash_reporter {
26 27
27 namespace { 28 namespace {
28 29
29 class AwCrashReporterClient : public ::crash_reporter::CrashReporterClient { 30 class AwCrashReporterClient : public ::crash_reporter::CrashReporterClient {
30 public: 31 public:
31 AwCrashReporterClient() 32 AwCrashReporterClient()
32 : dump_fd_(kAndroidMinidumpDescriptor), crash_signal_fd_(-1) {} 33 : dump_fd_(kAndroidMinidumpDescriptor), crash_signal_fd_(-1) {}
33 34
34 // Does not use lock, can only be called immediately after creation. 35 // Does not use lock, can only be called immediately after creation.
35 void set_crash_signal_fd(int fd) { crash_signal_fd_ = fd; } 36 void set_crash_signal_fd(int fd) { crash_signal_fd_ = fd; }
36 37
37 // crash_reporter::CrashReporterClient implementation. 38 // crash_reporter::CrashReporterClient implementation.
38 size_t RegisterCrashKeys() override; 39 size_t RegisterCrashKeys() override;
40 bool UseCrashKeysWhiteList() override { return true; }
41 const char* const* GetCrashKeyWhiteList() override;
39 42
40 bool IsRunningUnattended() override { return false; } 43 bool IsRunningUnattended() override { return false; }
41 bool GetCollectStatsConsent() override { 44 bool GetCollectStatsConsent() override {
42 #if defined(GOOGLE_CHROME_BUILD) 45 #if defined(GOOGLE_CHROME_BUILD)
43 // TODO(gsennton): Enabling minidump-generation unconditionally means we 46 // TODO(gsennton): Enabling minidump-generation unconditionally means we
44 // will generate minidumps even if the user doesn't consent to minidump 47 // will generate minidumps even if the user doesn't consent to minidump
45 // uploads. However, we will check user-consent before uploading any 48 // uploads. However, we will check user-consent before uploading any
46 // minidumps, if we do not have user consent we will delete the minidumps. 49 // minidumps, if we do not have user consent we will delete the minidumps.
47 // We should investigate whether we can avoid generating minidumps 50 // We should investigate whether we can avoid generating minidumps
48 // altogether if we don't have user consent, see crbug.com/692485 51 // altogether if we don't have user consent, see crbug.com/692485
(...skipping 30 matching lines...) Expand all
79 private: 82 private:
80 int dump_fd_; 83 int dump_fd_;
81 int crash_signal_fd_; 84 int crash_signal_fd_;
82 DISALLOW_COPY_AND_ASSIGN(AwCrashReporterClient); 85 DISALLOW_COPY_AND_ASSIGN(AwCrashReporterClient);
83 }; 86 };
84 87
85 size_t AwCrashReporterClient::RegisterCrashKeys() { 88 size_t AwCrashReporterClient::RegisterCrashKeys() {
86 return crash_keys::RegisterWebViewCrashKeys(); 89 return crash_keys::RegisterWebViewCrashKeys();
87 } 90 }
88 91
92 const char* const* AwCrashReporterClient::GetCrashKeyWhiteList() {
93 return crash_keys::kWebViewCrashKeyWhiteList;
94 }
95
89 base::LazyInstance<AwCrashReporterClient>::Leaky g_crash_reporter_client = 96 base::LazyInstance<AwCrashReporterClient>::Leaky g_crash_reporter_client =
90 LAZY_INSTANCE_INITIALIZER; 97 LAZY_INSTANCE_INITIALIZER;
91 98
92 bool g_enabled = false; 99 bool g_enabled = false;
93 100
94 #if defined(ARCH_CPU_X86_FAMILY) 101 #if defined(ARCH_CPU_X86_FAMILY)
95 bool SafeToUseSignalHandler() { 102 bool SafeToUseSignalHandler() {
96 // N+ shared library namespacing means that we are unable to dlopen 103 // N+ shared library namespacing means that we are unable to dlopen
97 // libnativebridge (because it isn't in the NDK). However we know 104 // libnativebridge (because it isn't in the NDK). However we know
98 // that, were we able to, the tests below would pass, so just return 105 // that, were we able to, the tests below would pass, so just return
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 bool IsCrashReporterEnabled() { 212 bool IsCrashReporterEnabled() {
206 return breakpad::IsCrashReporterEnabled(); 213 return breakpad::IsCrashReporterEnabled();
207 } 214 }
208 215
209 void SuppressDumpGeneration() { 216 void SuppressDumpGeneration() {
210 breakpad::SuppressDumpGeneration(); 217 breakpad::SuppressDumpGeneration();
211 } 218 }
212 219
213 } // namespace crash_reporter 220 } // namespace crash_reporter
214 } // namespace android_webview 221 } // namespace android_webview
OLDNEW
« no previous file with comments | « no previous file | android_webview/common/crash_reporter/crash_keys.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698