| 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 197 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 208 int capacity_; | 208 int capacity_; |
| 209 int offset_; | 209 int offset_; |
| 210 }; | 210 }; |
| 211 | 211 |
| 212 // This versions allows a pickle to be used as the storage for a write-style | 212 // This versions allows a pickle to be used as the storage for a write-style |
| 213 // operation, avoiding an extra data copy. | 213 // operation, avoiding an extra data copy. |
| 214 class NET_EXPORT PickledIOBuffer : public IOBuffer { | 214 class NET_EXPORT PickledIOBuffer : public IOBuffer { |
| 215 public: | 215 public: |
| 216 PickledIOBuffer(); | 216 PickledIOBuffer(); |
| 217 | 217 |
| 218 Pickle* pickle() { return &pickle_; } | 218 base::Pickle* pickle() { return &pickle_; } |
| 219 | 219 |
| 220 // Signals that we are done writing to the pickle and we can use it for a | 220 // Signals that we are done writing to the pickle and we can use it for a |
| 221 // write-style IO operation. | 221 // write-style IO operation. |
| 222 void Done(); | 222 void Done(); |
| 223 | 223 |
| 224 private: | 224 private: |
| 225 ~PickledIOBuffer() override; | 225 ~PickledIOBuffer() override; |
| 226 | 226 |
| 227 Pickle pickle_; | 227 base::Pickle pickle_; |
| 228 }; | 228 }; |
| 229 | 229 |
| 230 // This class allows the creation of a temporary IOBuffer that doesn't really | 230 // This class allows the creation of a temporary IOBuffer that doesn't really |
| 231 // own the underlying buffer. Please use this class only as a last resort. | 231 // own the underlying buffer. Please use this class only as a last resort. |
| 232 // A good example is the buffer for a synchronous operation, where we can be | 232 // A good example is the buffer for a synchronous operation, where we can be |
| 233 // sure that nobody is keeping an extra reference to this object so the lifetime | 233 // sure that nobody is keeping an extra reference to this object so the lifetime |
| 234 // of the buffer can be completely managed by its intended owner. | 234 // of the buffer can be completely managed by its intended owner. |
| 235 class NET_EXPORT WrappedIOBuffer : public IOBuffer { | 235 class NET_EXPORT WrappedIOBuffer : public IOBuffer { |
| 236 public: | 236 public: |
| 237 explicit WrappedIOBuffer(const char* data); | 237 explicit WrappedIOBuffer(const char* data); |
| 238 | 238 |
| 239 protected: | 239 protected: |
| 240 ~WrappedIOBuffer() override; | 240 ~WrappedIOBuffer() override; |
| 241 }; | 241 }; |
| 242 | 242 |
| 243 } // namespace net | 243 } // namespace net |
| 244 | 244 |
| 245 #endif // NET_BASE_IO_BUFFER_H_ | 245 #endif // NET_BASE_IO_BUFFER_H_ |
| OLD | NEW |