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

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

Issue 10185007: [net] Change order of RequestPriority to natural: higher > lower (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Use MINIMUM_PRIORITY instead of 0. Created 8 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 #pragma once 7 #pragma once
8 8
9 #include "base/memory/ref_counted.h" 9 #include "base/memory/ref_counted.h"
10 #include "net/base/io_buffer.h" 10 #include "net/base/io_buffer.h"
11 #include "net/base/net_export.h" 11 #include "net/base/net_export.h"
12 #include "net/spdy/spdy_stream.h" 12 #include "net/spdy/spdy_stream.h"
13 13
14 namespace net { 14 namespace net {
15 15
16 // A class for managing SPDY IO buffers. These buffers need to be prioritized 16 // A class for managing SPDY IO buffers. These buffers need to be prioritized
17 // so that the SpdySession sends them in the right order. Further, they need 17 // so that the SpdySession sends them in the right order. Further, they need
18 // to track the SpdyStream which they are associated with so that incremental 18 // to track the SpdyStream which they are associated with so that incremental
19 // completion of the IO can notify the appropriate stream of completion. 19 // completion of the IO can notify the appropriate stream of completion.
20 class NET_EXPORT_PRIVATE SpdyIOBuffer { 20 class NET_EXPORT_PRIVATE SpdyIOBuffer {
21 public: 21 public:
22 // Constructor 22 // Constructor
23 // |buffer| is the actual data buffer. 23 // |buffer| is the actual data buffer.
24 // |size| is the size of the data buffer. 24 // |size| is the size of the data buffer.
25 // |priority| is the priority of this buffer. Lower numbers are higher 25 // |priority| is the priority of this buffer.
26 // priority.
27 // |stream| is a pointer to the stream which is managing this buffer. 26 // |stream| is a pointer to the stream which is managing this buffer.
28 SpdyIOBuffer(IOBuffer* buffer, int size, int priority, SpdyStream* stream); 27 SpdyIOBuffer(IOBuffer* buffer, int size, int priority, SpdyStream* stream);
Ryan Hamilton 2012/04/23 22:51:05 Can you make |priority| a RequestPriority? It loo
szym 2012/04/24 00:19:31 I considered that. The only doubt was caused by th
Ryan Hamilton 2012/04/24 00:42:11 Hm. I think I would be inclined to change the cla
szym 2012/04/24 00:47:58 Yup. I'm on it.
29 SpdyIOBuffer(); 28 SpdyIOBuffer();
30 ~SpdyIOBuffer(); 29 ~SpdyIOBuffer();
31 30
32 // Accessors. 31 // Accessors.
33 DrainableIOBuffer* buffer() const { return buffer_; } 32 DrainableIOBuffer* buffer() const { return buffer_; }
34 size_t size() const { return buffer_->size(); } 33 size_t size() const { return buffer_->size(); }
35 void release(); 34 void release();
36 int priority() const { return priority_; } 35 int priority() const { return priority_; }
37 const scoped_refptr<SpdyStream>& stream() const { return stream_; } 36 const scoped_refptr<SpdyStream>& stream() const { return stream_; }
38 37
39 // Comparison operator to support sorting. 38 // Comparison operator to support sorting.
40 bool operator<(const SpdyIOBuffer& other) const { 39 bool operator<(const SpdyIOBuffer& other) const {
41 if (priority_ != other.priority_) 40 if (priority_ != other.priority_)
42 return priority_ > other.priority_; 41 return priority_ < other.priority_;
43 return position_ > other.position_; 42 return position_ > other.position_;
44 } 43 }
45 44
46 private: 45 private:
47 scoped_refptr<DrainableIOBuffer> buffer_; 46 scoped_refptr<DrainableIOBuffer> buffer_;
48 int priority_; 47 int priority_;
49 uint64 position_; 48 uint64 position_;
50 scoped_refptr<SpdyStream> stream_; 49 scoped_refptr<SpdyStream> stream_;
51 static uint64 order_; // Maintains a FIFO order for equal priorities. 50 static uint64 order_; // Maintains a FIFO order for equal priorities.
52 }; 51 };
53 52
54 } // namespace net 53 } // namespace net
55 54
56 #endif // NET_SPDY_SPDY_IO_BUFFER_H_ 55 #endif // NET_SPDY_SPDY_IO_BUFFER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698