OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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/base/io_buffer.h" | 5 #include "net/base/io_buffer.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 | 8 |
9 namespace net { | 9 namespace net { |
10 | 10 |
(...skipping 12 matching lines...) Expand all Loading... |
23 | 23 |
24 IOBuffer::~IOBuffer() { | 24 IOBuffer::~IOBuffer() { |
25 delete[] data_; | 25 delete[] data_; |
26 } | 26 } |
27 | 27 |
28 IOBufferWithSize::IOBufferWithSize(int size) | 28 IOBufferWithSize::IOBufferWithSize(int size) |
29 : IOBuffer(size), | 29 : IOBuffer(size), |
30 size_(size) { | 30 size_(size) { |
31 } | 31 } |
32 | 32 |
| 33 IOBufferWithSize::~IOBufferWithSize() { |
| 34 } |
| 35 |
33 StringIOBuffer::StringIOBuffer(const std::string& s) | 36 StringIOBuffer::StringIOBuffer(const std::string& s) |
34 : IOBuffer(static_cast<char*>(NULL)), | 37 : IOBuffer(static_cast<char*>(NULL)), |
35 string_data_(s) { | 38 string_data_(s) { |
36 data_ = const_cast<char*>(string_data_.data()); | 39 data_ = const_cast<char*>(string_data_.data()); |
37 } | 40 } |
38 | 41 |
39 StringIOBuffer::~StringIOBuffer() { | 42 StringIOBuffer::~StringIOBuffer() { |
40 // We haven't allocated the buffer, so remove it before the base class | 43 // We haven't allocated the buffer, so remove it before the base class |
41 // destructor tries to delete[] it. | 44 // destructor tries to delete[] it. |
42 data_ = NULL; | 45 data_ = NULL; |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
119 | 122 |
120 WrappedIOBuffer::WrappedIOBuffer(const char* data) | 123 WrappedIOBuffer::WrappedIOBuffer(const char* data) |
121 : IOBuffer(const_cast<char*>(data)) { | 124 : IOBuffer(const_cast<char*>(data)) { |
122 } | 125 } |
123 | 126 |
124 WrappedIOBuffer::~WrappedIOBuffer() { | 127 WrappedIOBuffer::~WrappedIOBuffer() { |
125 data_ = NULL; | 128 data_ = NULL; |
126 } | 129 } |
127 | 130 |
128 } // namespace net | 131 } // namespace net |
OLD | NEW |