Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(373)

Side by Side Diff: net/http/http_network_transaction.h

Issue 118219: Reland my ClientSocketPool refactor again... (Closed)
Patch Set: Created 11 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « net/http/http_network_session.h ('k') | net/http/http_network_transaction.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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_HTTP_HTTP_NETWORK_TRANSACTION_H_ 5 #ifndef NET_HTTP_HTTP_NETWORK_TRANSACTION_H_
6 #define NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ 6 #define NET_HTTP_HTTP_NETWORK_TRANSACTION_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/ref_counted.h" 10 #include "base/ref_counted.h"
11 #include "base/scoped_ptr.h" 11 #include "base/scoped_ptr.h"
12 #include "base/time.h" 12 #include "base/time.h"
13 #include "net/base/address_list.h" 13 #include "net/base/address_list.h"
14 #include "net/base/client_socket_handle.h" 14 #include "net/base/client_socket_handle.h"
15 #include "net/base/client_socket_pool.h"
15 #include "net/base/host_resolver.h" 16 #include "net/base/host_resolver.h"
16 #include "net/base/io_buffer.h" 17 #include "net/base/io_buffer.h"
18 #include "net/base/load_flags.h"
19 #include "net/base/load_states.h"
17 #include "net/base/ssl_config_service.h" 20 #include "net/base/ssl_config_service.h"
18 #include "net/http/http_auth.h" 21 #include "net/http/http_auth.h"
19 #include "net/http/http_auth_handler.h" 22 #include "net/http/http_auth_handler.h"
20 #include "net/http/http_response_info.h" 23 #include "net/http/http_response_info.h"
21 #include "net/http/http_transaction.h" 24 #include "net/http/http_transaction.h"
22 #include "net/proxy/proxy_service.h" 25 #include "net/proxy/proxy_service.h"
23 #include "testing/gtest/include/gtest/gtest_prod.h" 26 #include "testing/gtest/include/gtest/gtest_prod.h"
24 27
25 namespace net { 28 namespace net {
26 29
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
81 84
82 void set_data(size_t offset) { data_ = headers_.get() + offset; } 85 void set_data(size_t offset) { data_ = headers_.get() + offset; }
83 char* headers() { return headers_.get(); } 86 char* headers() { return headers_.get(); }
84 void Reset() { headers_.reset(); } 87 void Reset() { headers_.reset(); }
85 void Realloc(size_t new_size); 88 void Realloc(size_t new_size);
86 89
87 private: 90 private:
88 scoped_ptr_malloc<char> headers_; 91 scoped_ptr_malloc<char> headers_;
89 }; 92 };
90 93
94 enum State {
95 STATE_RESOLVE_PROXY,
96 STATE_RESOLVE_PROXY_COMPLETE,
97 STATE_INIT_CONNECTION,
98 STATE_INIT_CONNECTION_COMPLETE,
99 STATE_SSL_CONNECT,
100 STATE_SSL_CONNECT_COMPLETE,
101 STATE_WRITE_HEADERS,
102 STATE_WRITE_HEADERS_COMPLETE,
103 STATE_WRITE_BODY,
104 STATE_WRITE_BODY_COMPLETE,
105 STATE_READ_HEADERS,
106 STATE_READ_HEADERS_COMPLETE,
107 STATE_READ_BODY,
108 STATE_READ_BODY_COMPLETE,
109 STATE_DRAIN_BODY_FOR_AUTH_RESTART,
110 STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE,
111 STATE_NONE
112 };
113
91 void DoCallback(int result); 114 void DoCallback(int result);
92 void OnIOComplete(int result); 115 void OnIOComplete(int result);
93 116
94 // Runs the state transition loop. 117 // Runs the state transition loop.
95 int DoLoop(int result); 118 int DoLoop(int result);
96 119
97 // Each of these methods corresponds to a State value. Those with an input 120 // Each of these methods corresponds to a State value. Those with an input
98 // argument receive the result from the previous state. If a method returns 121 // argument receive the result from the previous state. If a method returns
99 // ERR_IO_PENDING, then the result from OnIOComplete will be passed to the 122 // ERR_IO_PENDING, then the result from OnIOComplete will be passed to the
100 // next state method as the result arg. 123 // next state method as the result arg.
101 int DoResolveProxy(); 124 int DoResolveProxy();
102 int DoResolveProxyComplete(int result); 125 int DoResolveProxyComplete(int result);
103 int DoInitConnection(); 126 int DoInitConnection();
104 int DoInitConnectionComplete(int result); 127 int DoInitConnectionComplete(int result);
105 int DoResolveHost();
106 int DoResolveHostComplete(int result);
107 int DoTCPConnect();
108 int DoTCPConnectComplete(int result);
109 int DoSSLConnect(); 128 int DoSSLConnect();
110 int DoSSLConnectComplete(int result); 129 int DoSSLConnectComplete(int result);
111 int DoWriteHeaders(); 130 int DoWriteHeaders();
112 int DoWriteHeadersComplete(int result); 131 int DoWriteHeadersComplete(int result);
113 int DoWriteBody(); 132 int DoWriteBody();
114 int DoWriteBodyComplete(int result); 133 int DoWriteBodyComplete(int result);
115 int DoReadHeaders(); 134 int DoReadHeaders();
116 int DoReadHeadersComplete(int result); 135 int DoReadHeadersComplete(int result);
117 int DoReadBody(); 136 int DoReadBody();
118 int DoReadBodyComplete(int result); 137 int DoReadBodyComplete(int result);
(...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 375
357 // The time the Start method was called. 376 // The time the Start method was called.
358 base::Time start_time_; 377 base::Time start_time_;
359 378
360 // The time the Connect() method was called (if it got called). 379 // The time the Connect() method was called (if it got called).
361 base::Time connect_start_time_; 380 base::Time connect_start_time_;
362 381
363 // The time the host resolution started (if it indeed got started). 382 // The time the host resolution started (if it indeed got started).
364 base::Time host_resolution_start_time_; 383 base::Time host_resolution_start_time_;
365 384
366 enum State { 385 // The next state in the state machine.
367 STATE_RESOLVE_PROXY,
368 STATE_RESOLVE_PROXY_COMPLETE,
369 STATE_INIT_CONNECTION,
370 STATE_INIT_CONNECTION_COMPLETE,
371 STATE_RESOLVE_HOST,
372 STATE_RESOLVE_HOST_COMPLETE,
373 STATE_TCP_CONNECT,
374 STATE_TCP_CONNECT_COMPLETE,
375 STATE_SSL_CONNECT,
376 STATE_SSL_CONNECT_COMPLETE,
377 STATE_WRITE_HEADERS,
378 STATE_WRITE_HEADERS_COMPLETE,
379 STATE_WRITE_BODY,
380 STATE_WRITE_BODY_COMPLETE,
381 STATE_READ_HEADERS,
382 STATE_READ_HEADERS_COMPLETE,
383 STATE_READ_BODY,
384 STATE_READ_BODY_COMPLETE,
385 STATE_DRAIN_BODY_FOR_AUTH_RESTART,
386 STATE_DRAIN_BODY_FOR_AUTH_RESTART_COMPLETE,
387 STATE_NONE
388 };
389 State next_state_; 386 State next_state_;
390 }; 387 };
391 388
392 } // namespace net 389 } // namespace net
393 390
394 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_ 391 #endif // NET_HTTP_HTTP_NETWORK_TRANSACTION_H_
OLDNEW
« no previous file with comments | « net/http/http_network_session.h ('k') | net/http/http_network_transaction.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698