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 "base/macros.h" | 5 #include "base/macros.h" |
6 #include "chromecast/crash/cast_crash_keys.h" | 6 #include "chromecast/crash/cast_crash_keys.h" |
7 | 7 |
8 // TODO(kjoswiak): Potentially refactor chunk size info as well as non-cast | |
9 // specific keys out and make shared with chrome/common/crash_keys.cc. | |
10 namespace { | 8 namespace { |
11 | 9 |
12 // A small crash key, guaranteed to never be split into multiple pieces. | 10 // A small crash key, guaranteed to never be split into multiple pieces. |
13 const size_t kSmallSize = 63; | 11 const size_t kSmallSize = 63; |
14 | 12 |
15 // A medium crash key, which will be chunked on certain platforms but not | 13 // A medium crash key, which will be chunked on certain platforms but not |
16 // others. Guaranteed to never be more than four chunks. | 14 // others. Guaranteed to never be more than four chunks. |
17 const size_t kMediumSize = kSmallSize * 4; | 15 const size_t kMediumSize = kSmallSize * 4; |
18 | 16 |
19 // A large crash key, which will be chunked on all platforms. This should be | 17 // A large crash key, which will be chunked on all platforms. This should be |
20 // used sparingly. | 18 // used sparingly. |
21 const size_t kLargeSize = kSmallSize * 16; | 19 const size_t kLargeSize = kSmallSize * 16; |
22 | 20 |
23 // The maximum lengths specified by breakpad include the trailing NULL, so | 21 // The maximum lengths specified by breakpad include the trailing NULL, so |
24 // the actual length of the string is one less. | 22 // the actual length of the string is one less. |
25 static const size_t kChunkMaxLength = 63; | 23 static const size_t kChunkMaxLength = 63; |
26 | 24 |
27 } // namespace | 25 } // namespace |
28 | 26 |
29 namespace chromecast { | 27 namespace chromecast { |
30 namespace crash_keys { | 28 namespace crash_keys { |
31 | 29 |
32 const char kLastApp[] = "last_app"; | 30 const char kLastApp[] = "last_app"; |
33 const char kCurrentApp[] = "current_app"; | 31 const char kCurrentApp[] = "current_app"; |
34 const char kPreviousApp[] = "previous_app"; | 32 const char kPreviousApp[] = "previous_app"; |
35 | 33 |
36 size_t RegisterCastCrashKeys() { | |
37 const base::debug::CrashKey fixed_keys[] = { | |
38 { kLastApp, kSmallSize }, | |
39 { kCurrentApp, kSmallSize }, | |
40 { kPreviousApp, kSmallSize }, | |
41 // content/: | |
42 { "discardable-memory-allocated", kSmallSize }, | |
43 { "discardable-memory-free", kSmallSize }, | |
44 { "ppapi_path", kMediumSize }, | |
45 { "subresource_url", kLargeSize }, | |
46 { "total-discardable-memory-allocated", kSmallSize }, | |
47 | |
48 // gin/: | |
49 { "v8-ignition", kSmallSize }, | |
50 | |
51 // Copied from common/crash_keys. Remove when | |
52 // http://crbug.com/598854 is resolved. | |
53 | |
54 // Temporary for http://crbug.com/575245 | |
55 { "swapout_frame_id", kSmallSize }, | |
56 { "swapout_proxy_id", kSmallSize }, | |
57 { "swapout_view_id", kSmallSize }, | |
58 { "commit_frame_id", kSmallSize }, | |
59 { "commit_proxy_id", kSmallSize }, | |
60 { "commit_view_id", kSmallSize }, | |
61 { "commit_main_render_frame_id", kSmallSize }, | |
62 { "newproxy_proxy_id", kSmallSize }, | |
63 { "newproxy_view_id", kSmallSize }, | |
64 { "newproxy_opener_id", kSmallSize }, | |
65 { "newproxy_parent_id", kSmallSize }, | |
66 { "rvinit_view_id", kSmallSize }, | |
67 { "rvinit_proxy_id", kSmallSize }, | |
68 { "rvinit_main_frame_id", kSmallSize }, | |
69 { "initrf_frame_id", kSmallSize }, | |
70 { "initrf_proxy_id", kSmallSize }, | |
71 { "initrf_view_id", kSmallSize }, | |
72 { "initrf_main_frame_id", kSmallSize }, | |
73 { "initrf_view_is_live", kSmallSize }, | |
74 | |
75 // Keys for https://crbug.com/591478 | |
76 { "initrf_parent_proxy_exists", kSmallSize }, | |
77 { "initrf_render_view_is_live", kSmallSize }, | |
78 { "initrf_parent_is_in_same_site_instance", kSmallSize}, | |
79 { "initrf_parent_process_is_live", kSmallSize}, | |
80 { "initrf_root_is_in_same_site_instance", kSmallSize}, | |
81 { "initrf_root_is_in_same_site_instance_as_parent", kSmallSize}, | |
82 { "initrf_root_process_is_live", kSmallSize}, | |
83 { "initrf_root_proxy_is_live", kSmallSize}, | |
84 | |
85 // Temporary for https://crbug.com/626802. | |
86 { "newframe_routing_id", kSmallSize }, | |
87 { "newframe_proxy_id", kSmallSize }, | |
88 { "newframe_opener_id", kSmallSize }, | |
89 { "newframe_parent_id", kSmallSize }, | |
90 { "newframe_widget_id", kSmallSize }, | |
91 { "newframe_widget_hidden", kSmallSize }, | |
92 { "newframe_replicated_origin", kSmallSize }, | |
93 { "newframe_oopifs_possible", kSmallSize }, | |
94 | |
95 // Temporary for https://crbug.com/630103. | |
96 { "origin_mismatch_url", kLargeSize }, | |
97 { "origin_mismatch_origin", kMediumSize }, | |
98 { "origin_mismatch_transition", kSmallSize }, | |
99 { "origin_mismatch_redirects", kSmallSize }, | |
100 { "origin_mismatch_same_page", kSmallSize }, | |
101 | |
102 // Temporary for https://crbug.com/612711. | |
103 { "aci_wrong_sp_extension_id", kSmallSize }, | |
104 | |
105 // Temporary for https://crbug.com/668633. | |
106 { "swdh_set_hosted_version_worker_pid", kSmallSize }, | |
107 { "swdh_set_hosted_version_host_pid", kSmallSize }, | |
108 { "swdh_set_hosted_version_is_new_process", kSmallSize }, | |
109 { "swdh_set_hosted_version_restart_count", kSmallSize }, | |
110 }; | |
111 | |
112 return base::debug::InitCrashKeys(fixed_keys, arraysize(fixed_keys), | |
113 kChunkMaxLength); | |
114 } | |
115 | |
116 } // namespace crash_keys | 34 } // namespace crash_keys |
117 } // namespace chromecast | 35 } // namespace chromecast |
OLD | NEW |