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

Unified Diff: net/filter/brotli_source_stream.cc

Issue 2540233002: Instrument SourceStream using MemoryDumpProvider
Patch Set: Rebased 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
« no previous file with comments | « no previous file | net/filter/filter_source_stream.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/filter/brotli_source_stream.cc
diff --git a/net/filter/brotli_source_stream.cc b/net/filter/brotli_source_stream.cc
index 2ad18c39f156fff5aa56b6fb85767c7673869f97..8870b53259ac7b9b4ac14f7f9d23d161183c03d9 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/include/brotli/decode.h"
@@ -75,6 +78,19 @@ class BrotliSourceStream : public FilterSourceStream {
kBuckets);
}
+ void DumpMemoryStatsImpl(
+ base::trace_event::ProcessMemoryDump* pmd,
+ const std::string& parent_dump_absolute_name) 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 =
+ pmd->CreateAllocatorDump(base::StringPrintf(
+ "%s/brotli_%p", parent_dump_absolute_name.c_str(), this));
+ 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 {
« no previous file with comments | « no previous file | net/filter/filter_source_stream.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698