OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "chrome/common/crash_keys.h" | 5 #include "chrome/common/crash_keys.h" |
6 | 6 |
7 #if defined(OS_MACOSX) | |
8 #include "breakpad/src/common/mac/SimpleStringDictionary.h" | |
9 #elif defined(OS_WIN) | |
10 #include "breakpad/src/client/windows/common/ipc_protocol.h" | |
11 #endif | |
12 | |
7 namespace crash_keys { | 13 namespace crash_keys { |
8 | 14 |
9 // TODO(rsesek): This is true on Mac and Linux but not Windows. | 15 // A small crash key, guaranteed to never be split into multiple pieces. |
10 static const size_t kSingleChunkLength = 255; | 16 const size_t kSmallSize = 64; |
17 | |
18 // A medium crash key, which will be chunked on certain platforms but not | |
19 // others. Guaranteed to never be more than four chunks. | |
20 const size_t kMediumSize = kSmallSize * 4; | |
21 | |
22 // A large crash key, which will be chunked on all platforms. This should be | |
23 // used sparangly. | |
Scott Hess - ex-Googler
2013/02/19 23:16:10
Sparingly.
Robert Sesek
2013/02/27 18:52:49
Done.
| |
24 const size_t kLargeSize = kSmallSize * 16; | |
25 | |
26 #if defined(OS_MACOSX) | |
27 static const size_t kSingleChunkLength = | |
28 google_breakpad::KeyValueEntry::MAX_STRING_STORAGE_SIZE; | |
29 #elif defined(OS_WIN) | |
30 static const size_t kSingleChunkLength = | |
eroman
2013/02/20 00:04:40
There is a bit of a mismatch between what the mean
Robert Sesek
2013/02/27 18:52:49
Done. Same issue on Mac as well.
| |
31 google_breakpad::CustomInfoEntry::kValueMaxLength; | |
32 #else | |
33 static const size_t kSingleChunkLength = 64; | |
34 #endif | |
35 | |
36 // Guarantees for crash key sizes. | |
37 COMPILE_ASSERT(kSmallSize <= kSingleChunkLength, | |
38 crash_key_chunk_size_too_small); | |
39 #if defined(OS_MACOSX) | |
40 COMPILE_ASSERT(kMediumSize <= kSingleChunkLength, | |
41 mac_has_medium_size_crash_key_chunks); | |
42 #endif | |
11 | 43 |
12 size_t RegisterChromeCrashKeys() { | 44 size_t RegisterChromeCrashKeys() { |
13 base::debug::CrashKey keys[] = { | 45 base::debug::CrashKey keys[] = { |
14 // TODO(rsesek): Remove when done testing. Needed so arraysize > 0. | 46 // TODO(rsesek): Remove when done testing. Needed so arraysize > 0. |
15 { "rsesek_key", 1 }, | 47 { "rsesek_key", kSmallSize }, |
16 #if defined(OS_MACOSX) | 48 #if defined(OS_MACOSX) |
17 { mac::kFirstNSException, 1 }, | 49 { mac::kFirstNSException, kMediumSize }, |
18 { mac::kFirstNSExceptionTrace, 1 }, | 50 { mac::kFirstNSExceptionTrace, kMediumSize }, |
19 { mac::kLastNSException, 1 }, | 51 { mac::kLastNSException, kMediumSize }, |
20 { mac::kLastNSExceptionTrace, 1 }, | 52 { mac::kLastNSExceptionTrace, kMediumSize }, |
21 { mac::kNSException, 1 }, | 53 { mac::kNSException, kMediumSize }, |
22 { mac::kSendAction, 1 }, | 54 { mac::kSendAction, kMediumSize }, |
23 { mac::kZombie, 1 }, | 55 { mac::kZombie, kMediumSize }, |
24 { mac::kZombieTrace, 1 }, | 56 { mac::kZombieTrace, kMediumSize }, |
25 // content/: | 57 // content/: |
26 { "channel_error_bt", 1 }, | 58 { "channel_error_bt", kMediumSize }, |
27 { "remove_route_bt", 1 }, | 59 { "remove_route_bt", kMediumSize }, |
28 { "rwhvm_window", 1 }, | 60 { "rwhvm_window", kMediumSize }, |
29 // media/: | 61 // media/: |
30 { "VideoCaptureDeviceQTKit", 1 }, | 62 { "VideoCaptureDeviceQTKit", kSmallSize }, |
31 #endif | 63 #endif |
32 }; | 64 }; |
33 | 65 |
34 return base::debug::InitCrashKeys(keys, arraysize(keys), kSingleChunkLength); | 66 return base::debug::InitCrashKeys(keys, arraysize(keys), kSingleChunkLength); |
35 } | 67 } |
36 | 68 |
37 namespace mac { | 69 namespace mac { |
38 | 70 |
39 const char kFirstNSException[] = "firstexception"; | 71 const char kFirstNSException[] = "firstexception"; |
40 const char kFirstNSExceptionTrace[] = "firstexception_bt"; | 72 const char kFirstNSExceptionTrace[] = "firstexception_bt"; |
41 | 73 |
42 const char kLastNSException[] = "lastexception"; | 74 const char kLastNSException[] = "lastexception"; |
43 const char kLastNSExceptionTrace[] = "lastexception_bt"; | 75 const char kLastNSExceptionTrace[] = "lastexception_bt"; |
44 | 76 |
45 const char kNSException[] = "nsexception"; | 77 const char kNSException[] = "nsexception"; |
46 | 78 |
47 const char kSendAction[] = "sendaction"; | 79 const char kSendAction[] = "sendaction"; |
48 | 80 |
49 const char kZombie[] = "zombie"; | 81 const char kZombie[] = "zombie"; |
50 const char kZombieTrace[] = "zombie_dealloc_bt"; | 82 const char kZombieTrace[] = "zombie_dealloc_bt"; |
51 | 83 |
52 } // namespace mac | 84 } // namespace mac |
53 | 85 |
54 } // namespace crash_keys | 86 } // namespace crash_keys |
OLD | NEW |