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

Side by Side Diff: net/spdy/spdy_write_queue.cc

Issue 2665283003: Improve memory estimate of SpdySessionPool in net/ MemoryDumpProvider. (Closed)
Patch Set: rebased 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 unified diff | Download patch
« no previous file with comments | « net/spdy/spdy_write_queue.h ('k') | net/spdy/spdy_write_queue_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "net/spdy/spdy_write_queue.h" 5 #include "net/spdy/spdy_write_queue.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "net/spdy/platform/api/spdy_estimate_memory_usage.h"
12 #include "net/spdy/spdy_buffer.h" 13 #include "net/spdy/spdy_buffer.h"
13 #include "net/spdy/spdy_buffer_producer.h" 14 #include "net/spdy/spdy_buffer_producer.h"
14 #include "net/spdy/spdy_stream.h" 15 #include "net/spdy/spdy_stream.h"
15 16
16 namespace net { 17 namespace net {
17 18
18 SpdyWriteQueue::PendingWrite::PendingWrite() {} 19 SpdyWriteQueue::PendingWrite::PendingWrite() {}
19 20
20 SpdyWriteQueue::PendingWrite::PendingWrite( 21 SpdyWriteQueue::PendingWrite::PendingWrite(
21 SpdyFrameType frame_type, 22 SpdyFrameType frame_type,
22 std::unique_ptr<SpdyBufferProducer> frame_producer, 23 std::unique_ptr<SpdyBufferProducer> frame_producer,
23 const base::WeakPtr<SpdyStream>& stream) 24 const base::WeakPtr<SpdyStream>& stream)
24 : frame_type(frame_type), 25 : frame_type(frame_type),
25 frame_producer(std::move(frame_producer)), 26 frame_producer(std::move(frame_producer)),
26 stream(stream), 27 stream(stream),
27 has_stream(stream.get() != nullptr) {} 28 has_stream(stream.get() != nullptr) {}
28 29
29 SpdyWriteQueue::PendingWrite::~PendingWrite() {} 30 SpdyWriteQueue::PendingWrite::~PendingWrite() {}
30 31
31 SpdyWriteQueue::PendingWrite::PendingWrite(PendingWrite&& other) = default; 32 SpdyWriteQueue::PendingWrite::PendingWrite(PendingWrite&& other) = default;
32 SpdyWriteQueue::PendingWrite& SpdyWriteQueue::PendingWrite::operator=( 33 SpdyWriteQueue::PendingWrite& SpdyWriteQueue::PendingWrite::operator=(
33 PendingWrite&& other) = default; 34 PendingWrite&& other) = default;
34 35
36 size_t SpdyWriteQueue::PendingWrite::EstimateMemoryUsage() const {
37 return SpdyEstimateMemoryUsage(frame_producer);
38 }
39
35 SpdyWriteQueue::SpdyWriteQueue() : removing_writes_(false) {} 40 SpdyWriteQueue::SpdyWriteQueue() : removing_writes_(false) {}
36 41
37 SpdyWriteQueue::~SpdyWriteQueue() { 42 SpdyWriteQueue::~SpdyWriteQueue() {
38 Clear(); 43 Clear();
39 } 44 }
40 45
41 bool SpdyWriteQueue::IsEmpty() const { 46 bool SpdyWriteQueue::IsEmpty() const {
42 for (int i = MINIMUM_PRIORITY; i <= MAXIMUM_PRIORITY; i++) { 47 for (int i = MINIMUM_PRIORITY; i <= MAXIMUM_PRIORITY; i++) {
43 if (!queue_[i].empty()) 48 if (!queue_[i].empty())
44 return false; 49 return false;
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
148 153
149 for (int i = MINIMUM_PRIORITY; i <= MAXIMUM_PRIORITY; ++i) { 154 for (int i = MINIMUM_PRIORITY; i <= MAXIMUM_PRIORITY; ++i) {
150 for (auto it = queue_[i].begin(); it != queue_[i].end(); ++it) { 155 for (auto it = queue_[i].begin(); it != queue_[i].end(); ++it) {
151 erased_buffer_producers.push_back(std::move(it->frame_producer)); 156 erased_buffer_producers.push_back(std::move(it->frame_producer));
152 } 157 }
153 queue_[i].clear(); 158 queue_[i].clear();
154 } 159 }
155 removing_writes_ = false; 160 removing_writes_ = false;
156 } 161 }
157 162
163 size_t SpdyWriteQueue::EstimateMemoryUsage() const {
164 return SpdyEstimateMemoryUsage(queue_);
165 }
166
158 } // namespace net 167 } // namespace net
OLDNEW
« no previous file with comments | « net/spdy/spdy_write_queue.h ('k') | net/spdy/spdy_write_queue_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698