| Index: net/base/sdch_manager.cc
|
| diff --git a/net/base/sdch_manager.cc b/net/base/sdch_manager.cc
|
| index e57d73cfb24ab437fff321a170dbc42a5c7e067f..4b23fd3a1bcb930a7500411c06e9bb74cd250aa0 100644
|
| --- a/net/base/sdch_manager.cc
|
| +++ b/net/base/sdch_manager.cc
|
| @@ -13,7 +13,10 @@
|
| #include "base/metrics/histogram_macros.h"
|
| #include "base/strings/string_number_conversions.h"
|
| #include "base/strings/string_util.h"
|
| +#include "base/strings/stringprintf.h"
|
| #include "base/time/default_clock.h"
|
| +#include "base/trace_event/memory_allocator_dump.h"
|
| +#include "base/trace_event/process_memory_dump.h"
|
| #include "base/values.h"
|
| #include "crypto/sha2.h"
|
| #include "net/base/parse_number.h"
|
| @@ -324,6 +327,32 @@ void SdchManager::RemoveObserver(SdchObserver* observer) {
|
| observers_.RemoveObserver(observer);
|
| }
|
|
|
| +void SdchManager::DumpMemoryStats(
|
| + base::trace_event::ProcessMemoryDump* pmd) const {
|
| + std::string name = base::StringPrintf("net/sdch_manager_%p", this);
|
| + base::trace_event::MemoryAllocatorDump* dictionary_dump =
|
| + pmd->GetAllocatorDump(name);
|
| + if (dictionary_dump)
|
| + return;
|
| + size_t total_size = 0;
|
| + size_t total_count = 0;
|
| + for (const auto& dictionary : dictionaries_) {
|
| + total_size += dictionary.second->data.text().size();
|
| + ++total_count;
|
| + }
|
| + if (total_count == 0)
|
| + return;
|
| + dictionary_dump = pmd->CreateAllocatorDump(name);
|
| + dictionary_dump->AddScalar(
|
| + base::trace_event::MemoryAllocatorDump::kNameSize,
|
| + base::trace_event::MemoryAllocatorDump::kUnitsBytes, total_size);
|
| +
|
| + // Use the existing column name so as not to add a new column.
|
| + dictionary_dump->AddScalar(
|
| + "count", base::trace_event::MemoryAllocatorDump::kUnitsObjects,
|
| + total_count);
|
| +}
|
| +
|
| SdchProblemCode SdchManager::AddSdchDictionary(
|
| const std::string& dictionary_text,
|
| const GURL& dictionary_url,
|
|
|