Chromium Code Reviews| 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 #ifndef NET_BASE_IO_BUFFER_H_ | 5 #ifndef NET_BASE_IO_BUFFER_H_ |
| 6 #define NET_BASE_IO_BUFFER_H_ | 6 #define NET_BASE_IO_BUFFER_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 | 9 |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 151 // Returns the number of unconsumed bytes. | 151 // Returns the number of unconsumed bytes. |
| 152 int BytesRemaining() const; | 152 int BytesRemaining() const; |
| 153 | 153 |
| 154 // Returns the number of consumed bytes. | 154 // Returns the number of consumed bytes. |
| 155 int BytesConsumed() const; | 155 int BytesConsumed() const; |
| 156 | 156 |
| 157 // Seeks to an arbitrary point in the buffer. The notion of bytes consumed | 157 // Seeks to an arbitrary point in the buffer. The notion of bytes consumed |
| 158 // and remaining are updated appropriately. | 158 // and remaining are updated appropriately. |
| 159 void SetOffset(int bytes); | 159 void SetOffset(int bytes); |
| 160 | 160 |
| 161 // Changes the size of the buffer. Caller is responsible for ensuring that | |
| 162 // the new size does not exceed the size of the base buffer. | |
| 163 void SetSize(int size); | |
|
vandebo (ex-Chrome)
2014/03/04 21:55:12
I don't think we want to add this. If that means
tommycli
2014/03/04 23:03:44
Done.
| |
| 164 | |
| 161 int size() const { return size_; } | 165 int size() const { return size_; } |
| 162 | 166 |
| 163 private: | 167 private: |
| 164 virtual ~DrainableIOBuffer(); | 168 virtual ~DrainableIOBuffer(); |
| 165 | 169 |
| 166 scoped_refptr<IOBuffer> base_; | 170 scoped_refptr<IOBuffer> base_; |
| 167 int size_; | 171 int size_; |
| 168 int used_; | 172 int used_; |
| 169 }; | 173 }; |
| 170 | 174 |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 235 public: | 239 public: |
| 236 explicit WrappedIOBuffer(const char* data); | 240 explicit WrappedIOBuffer(const char* data); |
| 237 | 241 |
| 238 protected: | 242 protected: |
| 239 virtual ~WrappedIOBuffer(); | 243 virtual ~WrappedIOBuffer(); |
| 240 }; | 244 }; |
| 241 | 245 |
| 242 } // namespace net | 246 } // namespace net |
| 243 | 247 |
| 244 #endif // NET_BASE_IO_BUFFER_H_ | 248 #endif // NET_BASE_IO_BUFFER_H_ |
| OLD | NEW |