| 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 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 107 virtual ~IOBufferWithSize(); | 107 virtual ~IOBufferWithSize(); |
| 108 | 108 |
| 109 int size_; | 109 int size_; |
| 110 }; | 110 }; |
| 111 | 111 |
| 112 // This is a read only IOBuffer. The data is stored in a string and | 112 // This is a read only IOBuffer. The data is stored in a string and |
| 113 // the IOBuffer interface does not provide a proper way to modify it. | 113 // the IOBuffer interface does not provide a proper way to modify it. |
| 114 class NET_EXPORT StringIOBuffer : public IOBuffer { | 114 class NET_EXPORT StringIOBuffer : public IOBuffer { |
| 115 public: | 115 public: |
| 116 explicit StringIOBuffer(const std::string& s); | 116 explicit StringIOBuffer(const std::string& s); |
| 117 explicit StringIOBuffer(scoped_ptr<std::string> s); |
| 117 | 118 |
| 118 int size() const { return static_cast<int>(string_data_.size()); } | 119 int size() const { return static_cast<int>(string_data_.size()); } |
| 119 | 120 |
| 120 private: | 121 private: |
| 121 virtual ~StringIOBuffer(); | 122 virtual ~StringIOBuffer(); |
| 122 | 123 |
| 123 std::string string_data_; | 124 std::string string_data_; |
| 124 }; | 125 }; |
| 125 | 126 |
| 126 // This version wraps an existing IOBuffer and provides convenient functions | 127 // This version wraps an existing IOBuffer and provides convenient functions |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 public: | 236 public: |
| 236 explicit WrappedIOBuffer(const char* data); | 237 explicit WrappedIOBuffer(const char* data); |
| 237 | 238 |
| 238 protected: | 239 protected: |
| 239 virtual ~WrappedIOBuffer(); | 240 virtual ~WrappedIOBuffer(); |
| 240 }; | 241 }; |
| 241 | 242 |
| 242 } // namespace net | 243 } // namespace net |
| 243 | 244 |
| 244 #endif // NET_BASE_IO_BUFFER_H_ | 245 #endif // NET_BASE_IO_BUFFER_H_ |
| OLD | NEW |