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

Side by Side Diff: chrome/common/crash_keys.cc

Issue 12211080: Change crash keys to be registered with a maximum length instead of number of chunks. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Link chrome_app_unittests.exe Created 7 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 | Annotate | Revision Log
« no previous file with comments | « chrome/common/DEPS ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 = 63;
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 sparingly.
24 const size_t kLargeSize = kSmallSize * 16;
25
26 // The maximum lengths specified by breakpad include the trailing NULL, so
27 // the actual length of the string is one less.
28 #if defined(OS_MACOSX)
29 static const size_t kSingleChunkLength =
30 google_breakpad::KeyValueEntry::MAX_STRING_STORAGE_SIZE - 1;
31 #elif defined(OS_WIN)
32 static const size_t kSingleChunkLength =
33 google_breakpad::CustomInfoEntry::kValueMaxLength - 1;
34 #else
35 static const size_t kSingleChunkLength = 63;
36 #endif
37
38 // Guarantees for crash key sizes.
39 COMPILE_ASSERT(kSmallSize <= kSingleChunkLength,
40 crash_key_chunk_size_too_small);
41 #if defined(OS_MACOSX)
42 COMPILE_ASSERT(kMediumSize <= kSingleChunkLength,
43 mac_has_medium_size_crash_key_chunks);
44 #endif
11 45
12 size_t RegisterChromeCrashKeys() { 46 size_t RegisterChromeCrashKeys() {
13 base::debug::CrashKey keys[] = { 47 base::debug::CrashKey keys[] = {
14 // TODO(rsesek): Remove when done testing. Needed so arraysize > 0. 48 // TODO(rsesek): Remove when done testing. Needed so arraysize > 0.
15 { "rsesek_key", 1 }, 49 { "rsesek_key", kSmallSize },
16 #if defined(OS_MACOSX) 50 #if defined(OS_MACOSX)
17 { mac::kFirstNSException, 1 }, 51 { mac::kFirstNSException, kMediumSize },
18 { mac::kFirstNSExceptionTrace, 1 }, 52 { mac::kFirstNSExceptionTrace, kMediumSize },
19 { mac::kLastNSException, 1 }, 53 { mac::kLastNSException, kMediumSize },
20 { mac::kLastNSExceptionTrace, 1 }, 54 { mac::kLastNSExceptionTrace, kMediumSize },
21 { mac::kNSException, 1 }, 55 { mac::kNSException, kMediumSize },
22 { mac::kSendAction, 1 }, 56 { mac::kSendAction, kMediumSize },
23 { mac::kZombie, 1 }, 57 { mac::kZombie, kMediumSize },
24 { mac::kZombieTrace, 1 }, 58 { mac::kZombieTrace, kMediumSize },
25 // content/: 59 // content/:
26 { "channel_error_bt", 1 }, 60 { "channel_error_bt", kMediumSize },
27 { "remove_route_bt", 1 }, 61 { "remove_route_bt", kMediumSize },
28 { "rwhvm_window", 1 }, 62 { "rwhvm_window", kMediumSize },
29 // media/: 63 // media/:
30 { "VideoCaptureDeviceQTKit", 1 }, 64 { "VideoCaptureDeviceQTKit", kSmallSize },
31 #endif 65 #endif
32 }; 66 };
33 67
34 return base::debug::InitCrashKeys(keys, arraysize(keys), kSingleChunkLength); 68 return base::debug::InitCrashKeys(keys, arraysize(keys), kSingleChunkLength);
35 } 69 }
36 70
37 namespace mac { 71 namespace mac {
38 72
39 const char kFirstNSException[] = "firstexception"; 73 const char kFirstNSException[] = "firstexception";
40 const char kFirstNSExceptionTrace[] = "firstexception_bt"; 74 const char kFirstNSExceptionTrace[] = "firstexception_bt";
41 75
42 const char kLastNSException[] = "lastexception"; 76 const char kLastNSException[] = "lastexception";
43 const char kLastNSExceptionTrace[] = "lastexception_bt"; 77 const char kLastNSExceptionTrace[] = "lastexception_bt";
44 78
45 const char kNSException[] = "nsexception"; 79 const char kNSException[] = "nsexception";
46 80
47 const char kSendAction[] = "sendaction"; 81 const char kSendAction[] = "sendaction";
48 82
49 const char kZombie[] = "zombie"; 83 const char kZombie[] = "zombie";
50 const char kZombieTrace[] = "zombie_dealloc_bt"; 84 const char kZombieTrace[] = "zombie_dealloc_bt";
51 85
52 } // namespace mac 86 } // namespace mac
53 87
54 } // namespace crash_keys 88 } // namespace crash_keys
OLDNEW
« no previous file with comments | « chrome/common/DEPS ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698