OLD | NEW |
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 #include "net/spdy/spdy_io_buffer.h" | 5 #include "net/spdy/spdy_io_buffer.h" |
6 #include "net/spdy/spdy_stream.h" | 6 #include "net/spdy/spdy_stream.h" |
7 | 7 |
8 namespace net { | 8 namespace net { |
9 | 9 |
10 // static | 10 SpdyIOBuffer::SpdyIOBuffer() {} |
11 uint64 SpdyIOBuffer::order_ = 0; | |
12 | 11 |
13 SpdyIOBuffer::SpdyIOBuffer( | 12 SpdyIOBuffer::SpdyIOBuffer(IOBuffer* buffer, int size, SpdyStream* stream) |
14 IOBuffer* buffer, int size, RequestPriority priority, SpdyStream* stream) | 13 : buffer_(new DrainableIOBuffer(buffer, size)), stream_(stream) {} |
15 : buffer_(new DrainableIOBuffer(buffer, size)), | |
16 priority_(priority), | |
17 position_(++order_), | |
18 stream_(stream) {} | |
19 | |
20 SpdyIOBuffer::SpdyIOBuffer() : priority_(HIGHEST), position_(0), stream_(NULL) { | |
21 } | |
22 | 14 |
23 SpdyIOBuffer::SpdyIOBuffer(const SpdyIOBuffer& rhs) { | 15 SpdyIOBuffer::SpdyIOBuffer(const SpdyIOBuffer& rhs) { |
24 buffer_ = rhs.buffer_; | 16 buffer_ = rhs.buffer_; |
25 priority_ = rhs.priority_; | |
26 position_ = rhs.position_; | |
27 stream_ = rhs.stream_; | 17 stream_ = rhs.stream_; |
28 } | 18 } |
29 | 19 |
30 SpdyIOBuffer::~SpdyIOBuffer() {} | 20 SpdyIOBuffer::~SpdyIOBuffer() {} |
31 | 21 |
32 SpdyIOBuffer& SpdyIOBuffer::operator=(const SpdyIOBuffer& rhs) { | 22 SpdyIOBuffer& SpdyIOBuffer::operator=(const SpdyIOBuffer& rhs) { |
33 buffer_ = rhs.buffer_; | 23 buffer_ = rhs.buffer_; |
34 priority_ = rhs.priority_; | |
35 position_ = rhs.position_; | |
36 stream_ = rhs.stream_; | 24 stream_ = rhs.stream_; |
37 return *this; | 25 return *this; |
38 } | 26 } |
39 | 27 |
40 void SpdyIOBuffer::release() { | 28 void SpdyIOBuffer::Swap(SpdyIOBuffer* other) { |
| 29 buffer_.swap(other->buffer_); |
| 30 stream_.swap(other->stream_); |
| 31 } |
| 32 |
| 33 void SpdyIOBuffer::Release() { |
41 buffer_ = NULL; | 34 buffer_ = NULL; |
42 stream_ = NULL; | 35 stream_ = NULL; |
43 } | 36 } |
44 | 37 |
45 } // namespace net | 38 } // namespace net |
OLD | NEW |