Index: chrome/common/crash_keys.cc |
diff --git a/chrome/common/crash_keys.cc b/chrome/common/crash_keys.cc |
index f5de54b9b468db7c0376771f3d4d4f73033b56c0..d0b971f12dd3b67a1cb2fcec8452ebde3efbe249 100644 |
--- a/chrome/common/crash_keys.cc |
+++ b/chrome/common/crash_keys.cc |
@@ -4,30 +4,64 @@ |
#include "chrome/common/crash_keys.h" |
+#if defined(OS_MACOSX) |
+#include "breakpad/src/common/mac/SimpleStringDictionary.h" |
+#elif defined(OS_WIN) |
+#include "breakpad/src/client/windows/common/ipc_protocol.h" |
+#endif |
+ |
namespace crash_keys { |
-// TODO(rsesek): This is true on Mac and Linux but not Windows. |
-static const size_t kSingleChunkLength = 255; |
+// A small crash key, guaranteed to never be split into multiple pieces. |
+const size_t kSmallSize = 63; |
+ |
+// A medium crash key, which will be chunked on certain platforms but not |
+// others. Guaranteed to never be more than four chunks. |
+const size_t kMediumSize = kSmallSize * 4; |
+ |
+// A large crash key, which will be chunked on all platforms. This should be |
+// used sparingly. |
+const size_t kLargeSize = kSmallSize * 16; |
+ |
+// The maximum lengths specified by breakpad include the trailing NULL, so |
+// the actual length of the string is one less. |
+#if defined(OS_MACOSX) |
+static const size_t kSingleChunkLength = |
+ google_breakpad::KeyValueEntry::MAX_STRING_STORAGE_SIZE - 1; |
+#elif defined(OS_WIN) |
+static const size_t kSingleChunkLength = |
+ google_breakpad::CustomInfoEntry::kValueMaxLength - 1; |
+#else |
+static const size_t kSingleChunkLength = 63; |
+#endif |
+ |
+// Guarantees for crash key sizes. |
+COMPILE_ASSERT(kSmallSize <= kSingleChunkLength, |
+ crash_key_chunk_size_too_small); |
+#if defined(OS_MACOSX) |
+COMPILE_ASSERT(kMediumSize <= kSingleChunkLength, |
+ mac_has_medium_size_crash_key_chunks); |
+#endif |
size_t RegisterChromeCrashKeys() { |
base::debug::CrashKey keys[] = { |
// TODO(rsesek): Remove when done testing. Needed so arraysize > 0. |
- { "rsesek_key", 1 }, |
+ { "rsesek_key", kSmallSize }, |
#if defined(OS_MACOSX) |
- { mac::kFirstNSException, 1 }, |
- { mac::kFirstNSExceptionTrace, 1 }, |
- { mac::kLastNSException, 1 }, |
- { mac::kLastNSExceptionTrace, 1 }, |
- { mac::kNSException, 1 }, |
- { mac::kSendAction, 1 }, |
- { mac::kZombie, 1 }, |
- { mac::kZombieTrace, 1 }, |
+ { mac::kFirstNSException, kMediumSize }, |
+ { mac::kFirstNSExceptionTrace, kMediumSize }, |
+ { mac::kLastNSException, kMediumSize }, |
+ { mac::kLastNSExceptionTrace, kMediumSize }, |
+ { mac::kNSException, kMediumSize }, |
+ { mac::kSendAction, kMediumSize }, |
+ { mac::kZombie, kMediumSize }, |
+ { mac::kZombieTrace, kMediumSize }, |
// content/: |
- { "channel_error_bt", 1 }, |
- { "remove_route_bt", 1 }, |
- { "rwhvm_window", 1 }, |
+ { "channel_error_bt", kMediumSize }, |
+ { "remove_route_bt", kMediumSize }, |
+ { "rwhvm_window", kMediumSize }, |
// media/: |
- { "VideoCaptureDeviceQTKit", 1 }, |
+ { "VideoCaptureDeviceQTKit", kSmallSize }, |
#endif |
}; |