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

Unified Diff: net/spdy/spdy_header_block.cc

Issue 2665283003: Improve memory estimate of SpdySessionPool in net/ MemoryDumpProvider. (Closed)
Patch Set: Address Bence comments Created 3 years, 10 months 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/spdy/spdy_header_block.cc
diff --git a/net/spdy/spdy_header_block.cc b/net/spdy/spdy_header_block.cc
index 6cbd6ba645c4585a3126099322effb3f9525c968..eb798a0f3fddb274df11bca9b91e3e1b4312d535 100644
--- a/net/spdy/spdy_header_block.cc
+++ b/net/spdy/spdy_header_block.cc
@@ -11,6 +11,7 @@
#include "base/logging.h"
#include "base/macros.h"
+#include "base/trace_event/memory_usage_estimator.h"
#include "base/values.h"
#include "net/base/arena.h"
#include "net/http/http_log_util.h"
@@ -89,6 +90,11 @@ class SpdyHeaderBlock::Storage {
size_t bytes_allocated() const { return arena_.status().bytes_allocated(); }
+ // TODO(xunjieli): https://crbug.com/669108. Merge this with bytes_allocated()
+ size_t EstimateMemoryUsage() const {
+ return arena_.status().bytes_allocated();
+ }
+
private:
UnsafeArena arena_;
};
@@ -299,6 +305,12 @@ void SpdyHeaderBlock::AppendValueOrAddHeader(const StringPiece key,
iter->second.Append(GetStorage()->Write(value));
}
+size_t SpdyHeaderBlock::EstimateMemoryUsage() const {
+ // TODO(xunjieli): https://crbug.com/669108. Also include |block_| when EMU()
+ // supports linked_hash_map.
+ return base::trace_event::EstimateMemoryUsage(storage_);
+}
+
void SpdyHeaderBlock::AppendHeader(const StringPiece key,
const StringPiece value) {
auto storage = GetStorage();

Powered by Google App Engine
This is Rietveld 408576698