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

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

Issue 2717223003: Add WebView-specific whitelist for crash keys. (Closed)
Patch Set: 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 "base/format_macros.h"
9 #include "base/strings/string_util.h"
8 #include "components/crash/core/common/crash_keys.h" 10 #include "components/crash/core/common/crash_keys.h"
9 11
10 using namespace crash_keys; 12 using namespace crash_keys;
11 13
12 namespace android_webview { 14 namespace android_webview {
13 namespace crash_keys { 15 namespace crash_keys {
14 16
17 const char kActiveURL[] = "url-chunk";
18
19 const char kFontKeyName[] = "font_key_name";
20
21 const size_t kExtensionIDMaxCount = 10;
22 const char kExtensionID[] = "extension-%" PRIuS;
23 const char kNumExtensionsCount[] = "num-extensions";
24
25 const char kShutdownType[] = "shutdown-type";
26 const char kBrowserUnpinTrace[] = "browser-unpin-trace";
27
15 const char kGPUDriverVersion[] = "gpu-driver"; 28 const char kGPUDriverVersion[] = "gpu-driver";
16 const char kGPUPixelShaderVersion[] = "gpu-psver"; 29 const char kGPUPixelShaderVersion[] = "gpu-psver";
17 const char kGPUVertexShaderVersion[] = "gpu-vsver"; 30 const char kGPUVertexShaderVersion[] = "gpu-vsver";
18 const char kGPUVendor[] = "gpu-gl-vendor"; 31 const char kGPUVendor[] = "gpu-gl-vendor";
19 const char kGPURenderer[] = "gpu-gl-renderer"; 32 const char kGPURenderer[] = "gpu-gl-renderer";
20 33
34 const char kInputEventFilterSendFailure[] = "input-event-filter-send-failure";
35
36 const char kPrinterInfo[] = "prn-info-%" PRIuS;
37
38 const char kViewCount[] = "view-count";
39
40 const char kZeroEncodeDetails[] = "zero-encode-details";
41
21 size_t RegisterWebViewCrashKeys() { 42 size_t RegisterWebViewCrashKeys() {
22 base::debug::CrashKey fixed_keys[] = { 43 base::debug::CrashKey fixed_keys[] = {
23 { kGPUDriverVersion, kSmallSize }, 44 {"AW_DEBUG_KEY", kSmallSize},
24 { kGPUPixelShaderVersion, kSmallSize }, 45 {kClientId, kSmallSize},
25 { kGPUVertexShaderVersion, kSmallSize }, 46 {kChannel, kSmallSize},
26 { kGPUVendor, kSmallSize }, 47 {kActiveURL, kLargeSize},
27 { kGPURenderer, kSmallSize }, 48 {kNumVariations, kSmallSize},
49 {kVariations, kHugeSize},
50 {kNumExtensionsCount, kSmallSize},
51 {kShutdownType, kSmallSize},
52 {kBrowserUnpinTrace, kMediumSize},
53 {kGPUDriverVersion, kSmallSize},
54 {kGPUPixelShaderVersion, kSmallSize},
55 {kGPUVertexShaderVersion, kSmallSize},
56 {kGPUVendor, kSmallSize},
57 {kGPURenderer, kSmallSize},
28 58
29 // content/: 59 // content/:
30 { "bad_message_reason", kSmallSize }, 60 {"bad_message_reason", kSmallSize},
31 { "discardable-memory-allocated", kSmallSize }, 61 {"discardable-memory-allocated", kSmallSize},
32 { "discardable-memory-free", kSmallSize }, 62 {"discardable-memory-free", kSmallSize},
33 { "mojo-message-error", kMediumSize }, 63 {kFontKeyName, kSmallSize},
34 { "total-discardable-memory-allocated", kSmallSize }, 64 {"mojo-message-error", kMediumSize},
65 {"ppapi_path", kMediumSize},
66 {"subresource_url", kLargeSize},
67 {"total-discardable-memory-allocated", kSmallSize},
68 {kInputEventFilterSendFailure, kSmallSize},
69 {kBug464926CrashKey, kSmallSize},
70 {kViewCount, kSmallSize},
71
72 // media/:
73 {kZeroEncodeDetails, kSmallSize},
74
75 // gin/:
76 {"v8-ignition", kSmallSize},
77
78 // sandbox/:
79 {"seccomp-sigsys", kMediumSize},
80
81 // Temporary for http://crbug.com/575245.
82 {"swapout_frame_id", kSmallSize},
83 {"swapout_proxy_id", kSmallSize},
84 {"swapout_view_id", kSmallSize},
85 {"commit_frame_id", kSmallSize},
86 {"commit_proxy_id", kSmallSize},
87 {"commit_view_id", kSmallSize},
88 {"commit_main_render_frame_id", kSmallSize},
89 {"newproxy_proxy_id", kSmallSize},
90 {"newproxy_view_id", kSmallSize},
91 {"newproxy_opener_id", kSmallSize},
92 {"newproxy_parent_id", kSmallSize},
93 {"rvinit_view_id", kSmallSize},
94 {"rvinit_proxy_id", kSmallSize},
95 {"rvinit_main_frame_id", kSmallSize},
96 {"initrf_frame_id", kSmallSize},
97 {"initrf_proxy_id", kSmallSize},
98 {"initrf_view_id", kSmallSize},
99 {"initrf_main_frame_id", kSmallSize},
100 {"initrf_view_is_live", kSmallSize},
101
102 // Temporary for https://crbug.com/591478.
103 {"initrf_parent_proxy_exists", kSmallSize},
104 {"initrf_render_view_is_live", kSmallSize},
105 {"initrf_parent_is_in_same_site_instance", kSmallSize},
106 {"initrf_parent_process_is_live", kSmallSize},
107 {"initrf_root_is_in_same_site_instance", kSmallSize},
108 {"initrf_root_is_in_same_site_instance_as_parent", kSmallSize},
109 {"initrf_root_process_is_live", kSmallSize},
110 {"initrf_root_proxy_is_live", kSmallSize},
111
112 // Temporary for https://crbug.com/626802.
113 {"newframe_routing_id", kSmallSize},
114 {"newframe_proxy_id", kSmallSize},
115 {"newframe_opener_id", kSmallSize},
116 {"newframe_parent_id", kSmallSize},
117 {"newframe_widget_id", kSmallSize},
118 {"newframe_widget_hidden", kSmallSize},
119 {"newframe_replicated_origin", kSmallSize},
120 {"newframe_oopifs_possible", kSmallSize},
121
122 // Temporary for https://crbug.com/630103.
123 {"origin_mismatch_url", kLargeSize},
124 {"origin_mismatch_origin", kMediumSize},
125 {"origin_mismatch_transition", kSmallSize},
126 {"origin_mismatch_redirects", kSmallSize},
127 {"origin_mismatch_same_page", kSmallSize},
128
129 // Temporary for https://crbug.com/612711.
130 {"aci_wrong_sp_extension_id", kSmallSize},
131
132 // Temporary for https://crbug.com/668633.
133 {"swdh_set_hosted_version_worker_pid", kSmallSize},
134 {"swdh_set_hosted_version_host_pid", kSmallSize},
135 {"swdh_set_hosted_version_is_new_process", kSmallSize},
136 {"swdh_set_hosted_version_restart_count", kSmallSize},
35 }; 137 };
36 138
139 // This dynamic set of keys is used for sets of key value pairs when gathering
140 // a collection of data, like command line switches or extension IDs.
37 std::vector<base::debug::CrashKey> keys(fixed_keys, 141 std::vector<base::debug::CrashKey> keys(fixed_keys,
38 fixed_keys + arraysize(fixed_keys)); 142 fixed_keys + arraysize(fixed_keys));
39 143
144 GetCrashKeysForCommandLineSwitches(&keys);
145
146 // Register the extension IDs.
147 {
148 static char formatted_keys[kExtensionIDMaxCount][sizeof(kExtensionID) + 1] =
149 {{0}};
150 const size_t formatted_key_len = sizeof(formatted_keys[0]);
151 for (size_t i = 0; i < kExtensionIDMaxCount; ++i) {
152 int n = base::snprintf(formatted_keys[i], formatted_key_len, kExtensionID,
153 i + 1);
154 DCHECK_GT(n, 0);
155 base::debug::CrashKey crash_key = {formatted_keys[i], kSmallSize};
156 keys.push_back(crash_key);
157 }
158 }
159
160 // TODO these are never used?
161 // Register the printer info.
162 //{
163 // static char formatted_keys[kPrinterInfoCount][sizeof(kPrinterInfo) + 1] =
164 // {{ 0 }};
165 // const size_t formatted_key_len = sizeof(formatted_keys[0]);
166 // for (size_t i = 0; i < kPrinterInfoCount; ++i) {
167 // // Key names are 1-indexed.
168 // int n = base::snprintf(
169 // formatted_keys[i], formatted_key_len, kPrinterInfo, i + 1);
170 // DCHECK_GT(n, 0);
171 // base::debug::CrashKey crash_key = { formatted_keys[i], kSmallSize };
172 // keys.push_back(crash_key);
173 // }
174 //}
40 return base::debug::InitCrashKeys(&keys.at(0), keys.size(), kChunkMaxLength); 175 return base::debug::InitCrashKeys(&keys.at(0), keys.size(), kChunkMaxLength);
41 } 176 }
177
178 // TODO define these keys in a way so we can share them between this method, and
179 // RegisterWebViewCrashKeys.
180 std::vector<base::debug::CrashKey> GetWhiteListedWebViewCrashKeys() {
181 base::debug::CrashKey fixed_keys[] = {
Robert Sesek 2017/02/27 23:15:28 Since we're mostly storing small keys, can you avo
gsennton 2017/02/28 21:02:42 Ah right, I was thinking of the general case where
182 {"AW_DEBUG_KEY", kSmallSize},
183 {kGPUDriverVersion, kSmallSize},
184 {kGPUPixelShaderVersion, kSmallSize},
185 {kGPUVertexShaderVersion, kSmallSize},
186 {kGPUVendor, kSmallSize},
187 {kGPURenderer, kSmallSize},
188
189 // content/:
190 {"bad_message_reason", kSmallSize},
191 {"discardable-memory-allocated", kSmallSize},
192 {"discardable-memory-free", kSmallSize},
193 {"mojo-message-error", kMediumSize},
194 {"total-discardable-memory-allocated", kSmallSize},
195 };
196
197 return std::vector<base::debug::CrashKey>(fixed_keys,
198 fixed_keys + arraysize(fixed_keys));
199 }
42 } 200 }
43 201
44 } // namespace crash_keys 202 } // namespace crash_keys
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698