Chromium Code Reviews| 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 |