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

Side by Side Diff: net/spdy/spdy_io_buffer.h

Issue 10815074: Instead of enqueueing SPDY frames, enqueue SPDY streams that are ready to produce data. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove logging and cleanup Created 8 years, 4 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/http/http_network_transaction_spdy3_unittest.cc ('k') | net/spdy/spdy_io_buffer.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef NET_SPDY_SPDY_IO_BUFFER_H_ 5 #ifndef NET_SPDY_SPDY_IO_BUFFER_H_
6 #define NET_SPDY_SPDY_IO_BUFFER_H_ 6 #define NET_SPDY_SPDY_IO_BUFFER_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 #include "net/base/io_buffer.h" 9 #include "net/base/io_buffer.h"
10 #include "net/base/net_export.h" 10 #include "net/base/net_export.h"
11 #include "net/spdy/spdy_stream.h" 11 #include "net/base/request_priority.h"
12 12
13 namespace net { 13 namespace net {
14 14
15 class SpdyStream;
16
15 // A class for managing SPDY IO buffers. These buffers need to be prioritized 17 // A class for managing SPDY IO buffers. These buffers need to be prioritized
16 // so that the SpdySession sends them in the right order. Further, they need 18 // so that the SpdySession sends them in the right order. Further, they need
17 // to track the SpdyStream which they are associated with so that incremental 19 // to track the SpdyStream which they are associated with so that incremental
18 // completion of the IO can notify the appropriate stream of completion. 20 // completion of the IO can notify the appropriate stream of completion.
19 class NET_EXPORT_PRIVATE SpdyIOBuffer { 21 class NET_EXPORT_PRIVATE SpdyIOBuffer {
20 public: 22 public:
21 // Constructor 23 // Constructor
22 // |buffer| is the actual data buffer. 24 // |buffer| is the actual data buffer.
23 // |size| is the size of the data buffer. 25 // |size| is the size of the data buffer.
24 // |priority| is the priority of this buffer. 26 // |priority| is the priority of this buffer.
25 // |stream| is a pointer to the stream which is managing this buffer. 27 // |stream| is a pointer to the stream which is managing this buffer.
26 SpdyIOBuffer(IOBuffer* buffer, int size, RequestPriority priority, 28 SpdyIOBuffer(IOBuffer* buffer, int size, RequestPriority priority,
27 SpdyStream* stream); 29 SpdyStream* stream);
30 // Declare this instead of using the default so that we avoid needing to
31 // include spdy_stream.h.
32 SpdyIOBuffer(const SpdyIOBuffer& rhs);
28 SpdyIOBuffer(); 33 SpdyIOBuffer();
29 ~SpdyIOBuffer(); 34 ~SpdyIOBuffer();
35 // Declare this instead of using the default so that we avoid needing to
36 // include spdy_stream.h.
37 SpdyIOBuffer& operator=(const SpdyIOBuffer& rhs);
30 38
31 // Accessors. 39 // Accessors.
32 DrainableIOBuffer* buffer() const { return buffer_; } 40 DrainableIOBuffer* buffer() const { return buffer_; }
33 size_t size() const { return buffer_->size(); } 41 size_t size() const { return buffer_->size(); }
34 void release(); 42 void release();
35 RequestPriority priority() const { return priority_; } 43 RequestPriority priority() const { return priority_; }
36 const scoped_refptr<SpdyStream>& stream() const { return stream_; } 44 const scoped_refptr<SpdyStream>& stream() const { return stream_; }
37 45
38 // Comparison operator to support sorting. 46 // Comparison operator to support sorting.
39 bool operator<(const SpdyIOBuffer& other) const { 47 bool operator<(const SpdyIOBuffer& other) const {
40 if (priority_ != other.priority_) 48 if (priority_ != other.priority_)
41 return priority_ < other.priority_; 49 return priority_ < other.priority_;
42 return position_ > other.position_; 50 return position_ > other.position_;
43 } 51 }
44 52
45 private: 53 private:
46 scoped_refptr<DrainableIOBuffer> buffer_; 54 scoped_refptr<DrainableIOBuffer> buffer_;
47 RequestPriority priority_; 55 RequestPriority priority_;
48 uint64 position_; 56 uint64 position_;
49 scoped_refptr<SpdyStream> stream_; 57 scoped_refptr<SpdyStream> stream_;
50 static uint64 order_; // Maintains a FIFO order for equal priorities. 58 static uint64 order_; // Maintains a FIFO order for equal priorities.
51 }; 59 };
52 60
53 } // namespace net 61 } // namespace net
54 62
55 #endif // NET_SPDY_SPDY_IO_BUFFER_H_ 63 #endif // NET_SPDY_SPDY_IO_BUFFER_H_
OLDNEW
« no previous file with comments | « net/http/http_network_transaction_spdy3_unittest.cc ('k') | net/spdy/spdy_io_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698