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

Unified Diff: net/base/arena.h

Issue 2611173004: Modify SpdyHeaderBlock's internals to consolidate header values only on first access. (Closed)
Patch Set: Nit. Created 3 years, 11 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
« no previous file with comments | « no previous file | net/base/arena.cc » ('j') | net/spdy/spdy_header_block_test.cc » ('J')
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/base/arena.h
diff --git a/net/base/arena.h b/net/base/arena.h
index 223517df5e2fd42e1ff287fa192100d8ddb8edfa..f9a31acd96d541203e74975e4c37cfd1b30a9df5 100644
--- a/net/base/arena.h
+++ b/net/base/arena.h
@@ -16,6 +16,16 @@ namespace net {
// Not thread-safe.
class NET_EXPORT_PRIVATE UnsafeArena {
public:
+ class Status {
+ private:
+ friend class UnsafeArena;
+ size_t bytes_allocated_;
+
+ public:
+ Status() : bytes_allocated_(0) {}
+ size_t bytes_allocated() const { return bytes_allocated_; }
+ };
Ryan Hamilton 2017/01/10 22:46:12 Instead of a class, I wonder if a struct might be
Bence 2017/01/11 14:25:13 I would love that, but unfortunately Status is use
Ryan Hamilton 2017/01/11 15:05:06 Yes, I meant doing this in shared code.
+
// Blocks allocated by this arena will be at least |block_size| bytes.
explicit UnsafeArena(size_t block_size);
~UnsafeArena();
@@ -39,6 +49,8 @@ class NET_EXPORT_PRIVATE UnsafeArena {
void Reset();
+ Status status() const { return status_; }
+
private:
struct Block {
std::unique_ptr<char[]> data;
@@ -57,6 +69,7 @@ class NET_EXPORT_PRIVATE UnsafeArena {
size_t block_size_;
std::vector<Block> blocks_;
+ Status status_;
};
} // namespace net
« no previous file with comments | « no previous file | net/base/arena.cc » ('j') | net/spdy/spdy_header_block_test.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698