Index: base/debug/crash_logging.cc |
diff --git a/base/debug/crash_logging.cc b/base/debug/crash_logging.cc |
index 604c28620ec1cb9a7e783d6bc42b44ddb9051720..d7ea283a7c0145c39408931f151cfb086cf67430 100644 |
--- a/base/debug/crash_logging.cc |
+++ b/base/debug/crash_logging.cc |
@@ -41,7 +41,7 @@ void SetCrashKeyValue(const base::StringPiece& key, |
// << "(key = " << key << ")"; |
// Handle the un-chunked case. |
- if (!crash_key || crash_key->num_chunks == 1) { |
+ if (!crash_key || crash_key->max_length <= g_chunk_max_length_) { |
g_set_key_func_(key, value); |
return; |
} |
@@ -49,7 +49,9 @@ void SetCrashKeyValue(const base::StringPiece& key, |
// Unset the unused chunks. |
std::vector<std::string> chunks = |
ChunkCrashKeyValue(*crash_key, value, g_chunk_max_length_); |
- for (size_t i = chunks.size(); i < crash_key->num_chunks; ++i) { |
+ for (size_t i = chunks.size(); |
+ i < crash_key->max_length / g_chunk_max_length_; |
+ ++i) { |
g_clear_key_func_(base::StringPrintf(kChunkFormatString, key.data(), i+1)); |
} |
@@ -67,12 +69,12 @@ void ClearCrashKey(const base::StringPiece& key) { |
const CrashKey* crash_key = LookupCrashKey(key); |
// Handle the un-chunked case. |
- if (!crash_key || crash_key->num_chunks == 1) { |
+ if (!crash_key || crash_key->max_length <= g_chunk_max_length_) { |
g_clear_key_func_(key); |
return; |
} |
- for (size_t i = 0; i < crash_key->num_chunks; ++i) { |
+ for (size_t i = 0; i < crash_key->max_length / g_chunk_max_length_; ++i) { |
g_clear_key_func_(base::StringPrintf(kChunkFormatString, key.data(), i+1)); |
} |
} |
@@ -136,7 +138,7 @@ size_t InitCrashKeys(const CrashKey* const keys, size_t count, |
size_t total_keys = 0; |
for (size_t i = 0; i < count; ++i) { |
g_crash_keys_->insert(std::make_pair(keys[i].key_name, keys[i])); |
- total_keys += keys[i].num_chunks; |
+ total_keys += keys[i].max_length / chunk_max_length; |
} |
DCHECK_EQ(count, g_crash_keys_->size()) |
<< "Duplicate crash keys were registered"; |
@@ -161,11 +163,9 @@ void SetCrashKeyReportingFunctions( |
std::vector<std::string> ChunkCrashKeyValue(const CrashKey& crash_key, |
const base::StringPiece& value, |
size_t chunk_max_length) { |
- std::string value_string = value.as_string(); |
+ std::string value_string = value.substr(0, crash_key.max_length).as_string(); |
eroman
2013/02/20 00:08:43
Is this restriction necessary? Assuming implementa
Robert Sesek
2013/02/27 18:52:49
At this layer, I think it makes more sense to deal
|
std::vector<std::string> chunks; |
- for (size_t i = 0, offset = 0; |
- i < crash_key.num_chunks && offset < value_string.length(); |
- ++i) { |
+ for (size_t offset = 0; offset < value_string.length(); ) { |
std::string chunk = value_string.substr(offset, chunk_max_length); |
chunks.push_back(chunk); |
offset += chunk.length(); |