| 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_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> |
| 11 | 11 |
| 12 #include "base/memory/linked_ptr.h" | 12 #include "base/memory/linked_ptr.h" |
| 13 #include "base/memory/ref_counted.h" | 13 #include "base/memory/ref_counted.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/memory/weak_ptr.h" |
| 15 #include "net/base/address_list.h" | 16 #include "net/base/address_list.h" |
| 16 #include "net/base/completion_callback.h" | 17 #include "net/base/completion_callback.h" |
| 17 #include "net/base/io_buffer.h" | 18 #include "net/base/io_buffer.h" |
| 18 #include "net/base/net_errors.h" | 19 #include "net/base/net_errors.h" |
| 19 #include "net/base/net_export.h" | 20 #include "net/base/net_export.h" |
| 20 #include "net/base/net_log.h" | 21 #include "net/base/net_log.h" |
| 21 #include "net/proxy/proxy_service.h" | 22 #include "net/proxy/proxy_service.h" |
| 22 #include "net/ssl/ssl_config_service.h" | 23 #include "net/ssl/ssl_config_service.h" |
| 23 #include "net/url_request/url_request.h" | 24 #include "net/url_request/url_request.h" |
| 24 | 25 |
| (...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 // delete the object if it is changed or the job is destroyed. | 121 // delete the object if it is changed or the job is destroyed. |
| 121 UserData* GetUserData(const void* key) const; | 122 UserData* GetUserData(const void* key) const; |
| 122 void SetUserData(const void* key, UserData* data); | 123 void SetUserData(const void* key, UserData* data); |
| 123 | 124 |
| 124 const GURL& url() const { return url_; } | 125 const GURL& url() const { return url_; } |
| 125 bool is_secure() const; | 126 bool is_secure() const; |
| 126 const AddressList& address_list() const { return addresses_; } | 127 const AddressList& address_list() const { return addresses_; } |
| 127 Delegate* delegate() const { return delegate_; } | 128 Delegate* delegate() const { return delegate_; } |
| 128 int max_pending_send_allowed() const { return max_pending_send_allowed_; } | 129 int max_pending_send_allowed() const { return max_pending_send_allowed_; } |
| 129 | 130 |
| 130 const URLRequestContext* context() const { return context_; } | 131 URLRequestContext* context() const { return context_.get(); } |
| 131 void set_context(const URLRequestContext* context); | 132 void set_context(URLRequestContext* context); |
| 132 | 133 |
| 133 BoundNetLog* net_log() { return &net_log_; } | 134 BoundNetLog* net_log() { return &net_log_; } |
| 134 | 135 |
| 135 // Opens the connection on the IO thread. | 136 // Opens the connection on the IO thread. |
| 136 // Once the connection is established, calls delegate's OnConnected. | 137 // Once the connection is established, calls delegate's OnConnected. |
| 137 virtual void Connect(); | 138 virtual void Connect(); |
| 138 | 139 |
| 139 // Buffers |data| of |len| bytes for send and returns true if successful. | 140 // Buffers |data| of |len| bytes for send and returns true if successful. |
| 140 // If size of buffered data exceeds |max_pending_send_allowed_|, sends no | 141 // If size of buffered data exceeds |max_pending_send_allowed_|, sends no |
| 141 // data and returns false. |len| must be positive. | 142 // data and returns false. |len| must be positive. |
| (...skipping 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 | 330 |
| 330 BoundNetLog net_log_; | 331 BoundNetLog net_log_; |
| 331 | 332 |
| 332 GURL url_; | 333 GURL url_; |
| 333 // The number of bytes allowed to be buffered in this object. If the size of | 334 // The number of bytes allowed to be buffered in this object. If the size of |
| 334 // buffered data which is | 335 // buffered data which is |
| 335 // current_write_buf_.BytesRemaining() + | 336 // current_write_buf_.BytesRemaining() + |
| 336 // sum of the size of buffers in |pending_write_bufs_| | 337 // sum of the size of buffers in |pending_write_bufs_| |
| 337 // exceeds this limit, SendData() fails. | 338 // exceeds this limit, SendData() fails. |
| 338 int max_pending_send_allowed_; | 339 int max_pending_send_allowed_; |
| 339 const URLRequestContext* context_; | 340 base::WeakPtr<URLRequestContext> context_; |
| 340 | 341 |
| 341 UserDataMap user_data_; | 342 UserDataMap user_data_; |
| 342 | 343 |
| 343 State next_state_; | 344 State next_state_; |
| 344 HostResolver* host_resolver_; | 345 HostResolver* host_resolver_; |
| 345 CertVerifier* cert_verifier_; | 346 CertVerifier* cert_verifier_; |
| 346 ServerBoundCertService* server_bound_cert_service_; | 347 ServerBoundCertService* server_bound_cert_service_; |
| 347 ClientSocketFactory* factory_; | 348 ClientSocketFactory* factory_; |
| 348 | 349 |
| 349 ProxyMode proxy_mode_; | 350 ProxyMode proxy_mode_; |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 bool server_closed_; | 384 bool server_closed_; |
| 384 | 385 |
| 385 scoped_ptr<SocketStreamMetrics> metrics_; | 386 scoped_ptr<SocketStreamMetrics> metrics_; |
| 386 | 387 |
| 387 DISALLOW_COPY_AND_ASSIGN(SocketStream); | 388 DISALLOW_COPY_AND_ASSIGN(SocketStream); |
| 388 }; | 389 }; |
| 389 | 390 |
| 390 } // namespace net | 391 } // namespace net |
| 391 | 392 |
| 392 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_H_ | 393 #endif // NET_SOCKET_STREAM_SOCKET_STREAM_H_ |
| OLD | NEW |