| 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 #ifndef NET_SOCKET_STREAM_SOCKET_STREAM_H_ | 5 #ifndef NET_SOCKET_STREAM_SOCKET_STREAM_H_ |
| 6 #define NET_SOCKET_STREAM_SOCKET_STREAM_H_ | 6 #define NET_SOCKET_STREAM_SOCKET_STREAM_H_ |
| 7 | 7 |
| 8 #include <deque> | 8 #include <deque> |
| 9 #include <map> | 9 #include <map> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 133 void SetHostResolver(HostResolver* host_resolver); | 133 void SetHostResolver(HostResolver* host_resolver); |
| 134 | 134 |
| 135 // Sets an alternative ClientSocketFactory. Doesn't take ownership of | 135 // Sets an alternative ClientSocketFactory. Doesn't take ownership of |
| 136 // |factory|. For testing purposes only. | 136 // |factory|. For testing purposes only. |
| 137 void SetClientSocketFactory(ClientSocketFactory* factory); | 137 void SetClientSocketFactory(ClientSocketFactory* factory); |
| 138 | 138 |
| 139 private: | 139 private: |
| 140 class RequestHeaders : public IOBuffer { | 140 class RequestHeaders : public IOBuffer { |
| 141 public: | 141 public: |
| 142 RequestHeaders() : IOBuffer() {} | 142 RequestHeaders() : IOBuffer() {} |
| 143 ~RequestHeaders() { data_ = NULL; } | |
| 144 | 143 |
| 145 void SetDataOffset(size_t offset) { | 144 void SetDataOffset(size_t offset) { |
| 146 data_ = const_cast<char*>(headers_.data()) + offset; | 145 data_ = const_cast<char*>(headers_.data()) + offset; |
| 147 } | 146 } |
| 147 |
| 148 std::string headers_; | 148 std::string headers_; |
| 149 |
| 150 private: |
| 151 ~RequestHeaders() { data_ = NULL; } |
| 149 }; | 152 }; |
| 150 | 153 |
| 151 class ResponseHeaders : public IOBuffer { | 154 class ResponseHeaders : public IOBuffer { |
| 152 public: | 155 public: |
| 153 ResponseHeaders() : IOBuffer() {} | 156 ResponseHeaders() : IOBuffer() {} |
| 154 ~ResponseHeaders() { data_ = NULL; } | |
| 155 | 157 |
| 156 void SetDataOffset(size_t offset) { data_ = headers_.get() + offset; } | 158 void SetDataOffset(size_t offset) { data_ = headers_.get() + offset; } |
| 157 char* headers() const { return headers_.get(); } | 159 char* headers() const { return headers_.get(); } |
| 158 void Reset() { headers_.reset(); } | 160 void Reset() { headers_.reset(); } |
| 159 void Realloc(size_t new_size); | 161 void Realloc(size_t new_size); |
| 160 | 162 |
| 161 private: | 163 private: |
| 164 ~ResponseHeaders() { data_ = NULL; } |
| 165 |
| 162 scoped_ptr_malloc<char> headers_; | 166 scoped_ptr_malloc<char> headers_; |
| 163 }; | 167 }; |
| 164 | 168 |
| 165 enum State { | 169 enum State { |
| 166 STATE_NONE, | 170 STATE_NONE, |
| 167 STATE_RESOLVE_PROXY, | 171 STATE_RESOLVE_PROXY, |
| 168 STATE_RESOLVE_PROXY_COMPLETE, | 172 STATE_RESOLVE_PROXY_COMPLETE, |
| 169 STATE_RESOLVE_HOST, | 173 STATE_RESOLVE_HOST, |
| 170 STATE_RESOLVE_HOST_COMPLETE, | 174 STATE_RESOLVE_HOST_COMPLETE, |
| 171 STATE_TCP_CONNECT, | 175 STATE_TCP_CONNECT, |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 298 PendingDataQueue pending_write_bufs_; | 302 PendingDataQueue pending_write_bufs_; |
| 299 | 303 |
| 300 SocketStreamThrottle* throttle_; | 304 SocketStreamThrottle* throttle_; |
| 301 | 305 |
| 302 DISALLOW_COPY_AND_ASSIGN(SocketStream); | 306 DISALLOW_COPY_AND_ASSIGN(SocketStream); |
| 303 }; | 307 }; |
| 304 | 308 |
| 305 } // namespace net | 309 } // namespace net |
| 306 | 310 |
| 307 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_H_ | 311 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_H_ |
| OLD | NEW |