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