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

Unified Diff: net/filter/brotli_source_stream.cc

Issue 2525743002: Make URLRequestContext a MemoryDumpProvider (Abandoned) (Closed)
Patch Set: self review Created 4 years 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 side-by-side diff with in-line comments
Download patch
Index: net/filter/brotli_source_stream.cc
diff --git a/net/filter/brotli_source_stream.cc b/net/filter/brotli_source_stream.cc
index 453ccac09e61e80e3314d302f0ccdedc8e1e3d03..d42ae99b99f75fdd11e8fc3c9a4326f62cdc4b48 100644
--- a/net/filter/brotli_source_stream.cc
+++ b/net/filter/brotli_source_stream.cc
@@ -10,6 +10,9 @@
#include "base/macros.h"
#include "base/memory/ptr_util.h"
#include "base/metrics/histogram_macros.h"
+#include "base/strings/stringprintf.h"
+#include "base/trace_event/memory_allocator_dump.h"
+#include "base/trace_event/process_memory_dump.h"
#include "net/base/io_buffer.h"
#include "third_party/brotli/dec/decode.h"
@@ -73,6 +76,18 @@ class BrotliSourceStream : public FilterSourceStream {
kBuckets);
}
+ void DumpMemoryStatsImpl(
+ base::trace_event::MemoryAllocatorDump* dump) const override {
+ // Log pointer address to avoid duplication though in practice there is
+ // often only one BrotliSourceStream per URLRequest.
+ base::trace_event::MemoryAllocatorDump* brotli_dump =
+ dump->process_memory_dump()->CreateAllocatorDump(base::StringPrintf(
+ "%s/brotli_%p", dump->absolute_name().c_str(), this));
ssid 2016/12/02 21:36:35 Pass the dump name as an extra argument to this fu
+ brotli_dump->AddScalar(base::trace_event::MemoryAllocatorDump::kNameSize,
+ base::trace_event::MemoryAllocatorDump::kUnitsBytes,
+ used_memory_);
+ }
+
private:
// Reported in UMA and must be kept in sync with the histograms.xml file.
enum class DecodingStatus : int {

Powered by Google App Engine
This is Rietveld 408576698