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

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

Issue 13996009: Revert 194560 "[SPDY] Replace SpdyIOBuffer with new SpdyBuffer c..." (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « trunk/src/net/spdy/spdy_write_queue.h ('k') | trunk/src/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 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "net/spdy/spdy_buffer.h" 10 #include "net/spdy/spdy_frame_producer.h"
11 #include "net/spdy/spdy_buffer_producer.h"
12 #include "net/spdy/spdy_stream.h" 11 #include "net/spdy/spdy_stream.h"
13 12
14 namespace net { 13 namespace net {
15 14
16 SpdyWriteQueue::PendingWrite::PendingWrite() : frame_producer(NULL) {} 15 SpdyWriteQueue::PendingWrite::PendingWrite() : frame_producer(NULL) {}
17 16
18 SpdyWriteQueue::PendingWrite::PendingWrite( 17 SpdyWriteQueue::PendingWrite::PendingWrite(
19 SpdyFrameType frame_type, 18 SpdyFrameType frame_type,
20 SpdyBufferProducer* frame_producer, 19 SpdyFrameProducer* frame_producer,
21 const scoped_refptr<SpdyStream>& stream) 20 const scoped_refptr<SpdyStream>& stream)
22 : frame_type(frame_type), 21 : frame_type(frame_type),
23 frame_producer(frame_producer), 22 frame_producer(frame_producer),
24 stream(stream) {} 23 stream(stream) {}
25 24
26 SpdyWriteQueue::PendingWrite::~PendingWrite() {} 25 SpdyWriteQueue::PendingWrite::~PendingWrite() {}
27 26
28 SpdyWriteQueue::SpdyWriteQueue() {} 27 SpdyWriteQueue::SpdyWriteQueue() {}
29 28
30 SpdyWriteQueue::~SpdyWriteQueue() { 29 SpdyWriteQueue::~SpdyWriteQueue() {
31 Clear(); 30 Clear();
32 } 31 }
33 32
34 void SpdyWriteQueue::Enqueue(RequestPriority priority, 33 void SpdyWriteQueue::Enqueue(RequestPriority priority,
35 SpdyFrameType frame_type, 34 SpdyFrameType frame_type,
36 scoped_ptr<SpdyBufferProducer> frame_producer, 35 scoped_ptr<SpdyFrameProducer> frame_producer,
37 const scoped_refptr<SpdyStream>& stream) { 36 const scoped_refptr<SpdyStream>& stream) {
38 if (stream.get()) { 37 if (stream.get()) {
39 DCHECK_EQ(stream->priority(), priority); 38 DCHECK_EQ(stream->priority(), priority);
40 } 39 }
41 queue_[priority].push_back( 40 queue_[priority].push_back(
42 PendingWrite(frame_type, frame_producer.release(), stream)); 41 PendingWrite(frame_type, frame_producer.release(), stream));
43 } 42 }
44 43
45 bool SpdyWriteQueue::Dequeue(SpdyFrameType* frame_type, 44 bool SpdyWriteQueue::Dequeue(SpdyFrameType* frame_type,
46 scoped_ptr<SpdyBufferProducer>* frame_producer, 45 scoped_ptr<SpdyFrameProducer>* frame_producer,
47 scoped_refptr<SpdyStream>* stream) { 46 scoped_refptr<SpdyStream>* stream) {
48 for (int i = NUM_PRIORITIES - 1; i >= 0; --i) { 47 for (int i = NUM_PRIORITIES - 1; i >= 0; --i) {
49 if (!queue_[i].empty()) { 48 if (!queue_[i].empty()) {
50 PendingWrite pending_write = queue_[i].front(); 49 PendingWrite pending_write = queue_[i].front();
51 queue_[i].pop_front(); 50 queue_[i].pop_front();
52 *frame_type = pending_write.frame_type; 51 *frame_type = pending_write.frame_type;
53 frame_producer->reset(pending_write.frame_producer); 52 frame_producer->reset(pending_write.frame_producer);
54 *stream = pending_write.stream; 53 *stream = pending_write.stream;
55 return true; 54 return true;
56 } 55 }
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 for (int i = 0; i < NUM_PRIORITIES; ++i) { 92 for (int i = 0; i < NUM_PRIORITIES; ++i) {
94 for (std::deque<PendingWrite>::iterator it = queue_[i].begin(); 93 for (std::deque<PendingWrite>::iterator it = queue_[i].begin();
95 it != queue_[i].end(); ++it) { 94 it != queue_[i].end(); ++it) {
96 delete it->frame_producer; 95 delete it->frame_producer;
97 } 96 }
98 queue_[i].clear(); 97 queue_[i].clear();
99 } 98 }
100 } 99 }
101 100
102 } // namespace net 101 } // namespace net
OLDNEW
« no previous file with comments | « trunk/src/net/spdy/spdy_write_queue.h ('k') | trunk/src/net/spdy/spdy_write_queue_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698