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