OLD | NEW |
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_buffer.h" | 5 #include "net/spdy/spdy_buffer.h" |
6 | 6 |
7 #include <cstring> | 7 #include <cstring> |
8 | 8 |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 27 matching lines...) Expand all Loading... |
38 // SpdyBuffer::GetIOBufferForRemainingData(). | 38 // SpdyBuffer::GetIOBufferForRemainingData(). |
39 class SpdyBuffer::SharedFrameIOBuffer : public IOBuffer { | 39 class SpdyBuffer::SharedFrameIOBuffer : public IOBuffer { |
40 public: | 40 public: |
41 SharedFrameIOBuffer(const scoped_refptr<SharedFrame>& shared_frame, | 41 SharedFrameIOBuffer(const scoped_refptr<SharedFrame>& shared_frame, |
42 size_t offset) | 42 size_t offset) |
43 : IOBuffer(shared_frame->data->data() + offset), | 43 : IOBuffer(shared_frame->data->data() + offset), |
44 shared_frame_(shared_frame), | 44 shared_frame_(shared_frame), |
45 offset_(offset) {} | 45 offset_(offset) {} |
46 | 46 |
47 private: | 47 private: |
48 virtual ~SharedFrameIOBuffer() { | 48 ~SharedFrameIOBuffer() override { |
49 // Prevent ~IOBuffer() from trying to delete |data_|. | 49 // Prevent ~IOBuffer() from trying to delete |data_|. |
50 data_ = NULL; | 50 data_ = NULL; |
51 } | 51 } |
52 | 52 |
53 const scoped_refptr<SharedFrame> shared_frame_; | 53 const scoped_refptr<SharedFrame> shared_frame_; |
54 const size_t offset_; | 54 const size_t offset_; |
55 | 55 |
56 DISALLOW_COPY_AND_ASSIGN(SharedFrameIOBuffer); | 56 DISALLOW_COPY_AND_ASSIGN(SharedFrameIOBuffer); |
57 }; | 57 }; |
58 | 58 |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 DCHECK_GE(consume_size, 1u); | 102 DCHECK_GE(consume_size, 1u); |
103 DCHECK_LE(consume_size, GetRemainingSize()); | 103 DCHECK_LE(consume_size, GetRemainingSize()); |
104 offset_ += consume_size; | 104 offset_ += consume_size; |
105 for (std::vector<ConsumeCallback>::const_iterator it = | 105 for (std::vector<ConsumeCallback>::const_iterator it = |
106 consume_callbacks_.begin(); it != consume_callbacks_.end(); ++it) { | 106 consume_callbacks_.begin(); it != consume_callbacks_.end(); ++it) { |
107 it->Run(consume_size, consume_source); | 107 it->Run(consume_size, consume_source); |
108 } | 108 } |
109 }; | 109 }; |
110 | 110 |
111 } // namespace net | 111 } // namespace net |
OLD | NEW |