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

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

Issue 2717223003: Add WebView-specific whitelist for crash keys. (Closed)
Patch Set: Init whitelist vars in breakpad_linux + move crash-calls from aw_debug to aw/crash_keys (to avoid a… 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
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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/crash_keys.h" 5 #include "android_webview/common/crash_reporter/crash_keys.h"
6 6
7 #include "base/debug/crash_logging.h" 7 #include "base/debug/crash_logging.h"
8 #include "components/crash/content/app/breakpad_linux.h"
8 #include "components/crash/core/common/crash_keys.h" 9 #include "components/crash/core/common/crash_keys.h"
9 10
10 using namespace crash_keys; 11 using namespace crash_keys;
11 12
12 namespace android_webview { 13 namespace android_webview {
13 namespace crash_keys { 14 namespace crash_keys {
14 15
16 const char kActiveURL[] = "url-chunk";
17
18 const char kFontKeyName[] = "font_key_name";
19
20 const char kShutdownType[] = "shutdown-type";
21 const char kBrowserUnpinTrace[] = "browser-unpin-trace";
22
15 const char kGPUDriverVersion[] = "gpu-driver"; 23 const char kGPUDriverVersion[] = "gpu-driver";
16 const char kGPUPixelShaderVersion[] = "gpu-psver"; 24 const char kGPUPixelShaderVersion[] = "gpu-psver";
17 const char kGPUVertexShaderVersion[] = "gpu-vsver"; 25 const char kGPUVertexShaderVersion[] = "gpu-vsver";
18 const char kGPUVendor[] = "gpu-gl-vendor"; 26 const char kGPUVendor[] = "gpu-gl-vendor";
19 const char kGPURenderer[] = "gpu-gl-renderer"; 27 const char kGPURenderer[] = "gpu-gl-renderer";
20 28
29 const char kInputEventFilterSendFailure[] = "input-event-filter-send-failure";
30
31 const char kViewCount[] = "view-count";
32
33 const char kZeroEncodeDetails[] = "zero-encode-details";
34
21 size_t RegisterWebViewCrashKeys() { 35 size_t RegisterWebViewCrashKeys() {
22 base::debug::CrashKey fixed_keys[] = { 36 base::debug::CrashKey fixed_keys[] = {
23 { kGPUDriverVersion, kSmallSize }, 37 {"AW_WHITELISTED_DEBUG_KEY", kSmallSize},
24 { kGPUPixelShaderVersion, kSmallSize }, 38 {"AW_NONWHITELISTED_DEBUG_KEY", kSmallSize},
25 { kGPUVertexShaderVersion, kSmallSize }, 39 {kClientId, kSmallSize},
26 { kGPUVendor, kSmallSize }, 40 {kChannel, kSmallSize},
27 { kGPURenderer, kSmallSize }, 41 {kActiveURL, kLargeSize},
42 {kNumVariations, kSmallSize},
43 {kVariations, kHugeSize},
44 {kShutdownType, kSmallSize},
45 {kBrowserUnpinTrace, kMediumSize},
46 {kGPUDriverVersion, kSmallSize},
47 {kGPUPixelShaderVersion, kSmallSize},
48 {kGPUVertexShaderVersion, kSmallSize},
49 {kGPUVendor, kSmallSize},
50 {kGPURenderer, kSmallSize},
28 51
29 // content/: 52 // content/:
30 { "bad_message_reason", kSmallSize }, 53 {"bad_message_reason", kSmallSize},
31 { "discardable-memory-allocated", kSmallSize }, 54 {"discardable-memory-allocated", kSmallSize},
32 { "discardable-memory-free", kSmallSize }, 55 {"discardable-memory-free", kSmallSize},
33 { "mojo-message-error", kMediumSize }, 56 {kFontKeyName, kSmallSize},
34 { "total-discardable-memory-allocated", kSmallSize }, 57 {"mojo-message-error", kMediumSize},
58 {"ppapi_path", kMediumSize},
59 {"subresource_url", kLargeSize},
60 {"total-discardable-memory-allocated", kSmallSize},
61 {kInputEventFilterSendFailure, kSmallSize},
62 {kBug464926CrashKey, kSmallSize},
63 {kViewCount, kSmallSize},
64
65 // media/:
66 {kZeroEncodeDetails, kSmallSize},
67
68 // gin/:
69 {"v8-ignition", kSmallSize},
70
71 // sandbox/:
72 {"seccomp-sigsys", kMediumSize},
73
74 // Temporary for http://crbug.com/575245.
75 {"swapout_frame_id", kSmallSize},
76 {"swapout_proxy_id", kSmallSize},
77 {"swapout_view_id", kSmallSize},
78 {"commit_frame_id", kSmallSize},
79 {"commit_proxy_id", kSmallSize},
80 {"commit_view_id", kSmallSize},
81 {"commit_main_render_frame_id", kSmallSize},
82 {"newproxy_proxy_id", kSmallSize},
83 {"newproxy_view_id", kSmallSize},
84 {"newproxy_opener_id", kSmallSize},
85 {"newproxy_parent_id", kSmallSize},
86 {"rvinit_view_id", kSmallSize},
87 {"rvinit_proxy_id", kSmallSize},
88 {"rvinit_main_frame_id", kSmallSize},
89 {"initrf_frame_id", kSmallSize},
90 {"initrf_proxy_id", kSmallSize},
91 {"initrf_view_id", kSmallSize},
92 {"initrf_main_frame_id", kSmallSize},
93 {"initrf_view_is_live", kSmallSize},
94
95 // Temporary for https://crbug.com/591478.
96 {"initrf_parent_proxy_exists", kSmallSize},
97 {"initrf_render_view_is_live", kSmallSize},
98 {"initrf_parent_is_in_same_site_instance", kSmallSize},
99 {"initrf_parent_process_is_live", kSmallSize},
100 {"initrf_root_is_in_same_site_instance", kSmallSize},
101 {"initrf_root_is_in_same_site_instance_as_parent", kSmallSize},
102 {"initrf_root_process_is_live", kSmallSize},
103 {"initrf_root_proxy_is_live", kSmallSize},
104
105 // Temporary for https://crbug.com/626802.
106 {"newframe_routing_id", kSmallSize},
107 {"newframe_proxy_id", kSmallSize},
108 {"newframe_opener_id", kSmallSize},
109 {"newframe_parent_id", kSmallSize},
110 {"newframe_widget_id", kSmallSize},
111 {"newframe_widget_hidden", kSmallSize},
112 {"newframe_replicated_origin", kSmallSize},
113 {"newframe_oopifs_possible", kSmallSize},
114
115 // Temporary for https://crbug.com/630103.
116 {"origin_mismatch_url", kLargeSize},
117 {"origin_mismatch_origin", kMediumSize},
118 {"origin_mismatch_transition", kSmallSize},
119 {"origin_mismatch_redirects", kSmallSize},
120 {"origin_mismatch_same_page", kSmallSize},
121
122 // Temporary for https://crbug.com/612711.
123 {"aci_wrong_sp_extension_id", kSmallSize},
124
125 // Temporary for https://crbug.com/668633.
126 {"swdh_set_hosted_version_worker_pid", kSmallSize},
127 {"swdh_set_hosted_version_host_pid", kSmallSize},
128 {"swdh_set_hosted_version_is_new_process", kSmallSize},
129 {"swdh_set_hosted_version_restart_count", kSmallSize},
35 }; 130 };
36 131
132 // This dynamic set of keys is used for sets of key value pairs when gathering
133 // a collection of data, like command line switches or extension IDs.
37 std::vector<base::debug::CrashKey> keys(fixed_keys, 134 std::vector<base::debug::CrashKey> keys(fixed_keys,
38 fixed_keys + arraysize(fixed_keys)); 135 fixed_keys + arraysize(fixed_keys));
39 136
137 GetCrashKeysForCommandLineSwitches(&keys);
138
40 return base::debug::InitCrashKeys(&keys.at(0), keys.size(), kChunkMaxLength); 139 return base::debug::InitCrashKeys(&keys.at(0), keys.size(), kChunkMaxLength);
41 } 140 }
141
142 const char* WHITE_LISTED_WEBVIEW_CRASH_KEYS[] = {
Robert Sesek 2017/03/02 22:29:39 You can also move this into GetWhiteListedWebViewC
Robert Sesek 2017/03/02 22:29:39 Naming: Globals in C++ are kCamelCase.
Robert Sesek 2017/03/02 22:29:40 Can this be even more const (const char* const) ?
gsennton 2017/03/03 00:09:32 If I move this inside GetWhiteListedWebViewCrashKe
143 "AW_WHITELISTED_DEBUG_KEY", kGPUDriverVersion, kGPUPixelShaderVersion,
Robert Sesek 2017/03/02 22:29:39 I know this was probably clang-format's doing, but
gsennton 2017/03/03 00:09:32 Awesome! I didn't know we had this.
144 kGPUVertexShaderVersion, kGPUVendor, kGPURenderer,
145
146 // content/:
147 "bad_message_reason", "discardable-memory-allocated",
148 "discardable-memory-free", "mojo-message-error-1", "mojo-message-error-2",
149 "mojo-message-error-3", "mojo-message-error-4",
150 "total-discardable-memory-allocated", NULL};
Robert Sesek 2017/03/02 22:29:39 nullptr
gsennton 2017/03/03 00:09:32 Done.
151
152 const char** GetWhiteListedWebViewCrashKeys() {
153 return WHITE_LISTED_WEBVIEW_CRASH_KEYS;
42 } 154 }
43 155
156 void InitCrashKeysForWebViewTesting() {
157 breakpad::InitCrashKeysForTesting();
158 }
159
160 void SetCrashKeyValue(const std::string& key, const std::string& value) {
Robert Sesek 2017/03/02 22:29:40 What's the point of this function?
gsennton 2017/03/03 00:09:32 Ooops! To ensure you're awake of course ;)
161 base::debug::SetCrashKeyValue(key, value);
162 }
Robert Sesek 2017/03/02 22:29:40 nit: blank line after
gsennton 2017/03/03 00:09:32 Done.
44 } // namespace crash_keys 163 } // namespace crash_keys
164
165 } // namespace android_webview
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698