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

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

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