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_SPDY_NETWORK_TRANSACTION_H_ | 5 #ifndef NET_SPDY_NETWORK_TRANSACTION_H_ |
6 #define NET_SPDY_NETWORK_TRANSACTION_H_ | 6 #define NET_SPDY_NETWORK_TRANSACTION_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <deque> | 9 #include <deque> |
10 | 10 |
11 #include "base/basictypes.h" | 11 #include "base/basictypes.h" |
12 #include "base/ref_counted.h" | 12 #include "base/ref_counted.h" |
13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
14 #include "base/time.h" | 14 #include "base/time.h" |
15 #include "net/base/completion_callback.h" | 15 #include "net/base/completion_callback.h" |
16 #include "net/base/load_states.h" | 16 #include "net/base/load_states.h" |
| 17 #include "net/base/net_log.h" |
17 #include "net/http/http_response_info.h" | 18 #include "net/http/http_response_info.h" |
18 #include "net/http/http_transaction.h" | 19 #include "net/http/http_transaction.h" |
19 #include "net/spdy/spdy_session.h" | 20 #include "net/spdy/spdy_session.h" |
20 | 21 |
21 namespace net { | 22 namespace net { |
22 | 23 |
23 class SpdySession; | 24 class SpdySession; |
24 class SpdyStream; | 25 class SpdyStream; |
25 class HttpNetworkSession; | 26 class HttpNetworkSession; |
26 class HttpResponseInfo; | 27 class HttpResponseInfo; |
27 class IOBuffer; | 28 class IOBuffer; |
28 class UploadDataStream; | 29 class UploadDataStream; |
29 | 30 |
30 // A SpdyNetworkTransaction can be used to fetch HTTP conent. | 31 // A SpdyNetworkTransaction can be used to fetch HTTP conent. |
31 // The SpdyDelegate is the consumer of events from the SpdySession. | 32 // The SpdyDelegate is the consumer of events from the SpdySession. |
32 class SpdyNetworkTransaction : public HttpTransaction { | 33 class SpdyNetworkTransaction : public HttpTransaction { |
33 public: | 34 public: |
34 explicit SpdyNetworkTransaction(HttpNetworkSession* session); | 35 explicit SpdyNetworkTransaction(HttpNetworkSession* session); |
35 virtual ~SpdyNetworkTransaction(); | 36 virtual ~SpdyNetworkTransaction(); |
36 | 37 |
37 // HttpTransaction methods: | 38 // HttpTransaction methods: |
38 virtual int Start(const HttpRequestInfo* request_info, | 39 virtual int Start(const HttpRequestInfo* request_info, |
39 CompletionCallback* callback, | 40 CompletionCallback* callback, |
40 LoadLog* load_log); | 41 const BoundNetLog& net_log); |
41 virtual int RestartIgnoringLastError(CompletionCallback* callback); | 42 virtual int RestartIgnoringLastError(CompletionCallback* callback); |
42 virtual int RestartWithCertificate(X509Certificate* client_cert, | 43 virtual int RestartWithCertificate(X509Certificate* client_cert, |
43 CompletionCallback* callback); | 44 CompletionCallback* callback); |
44 virtual int RestartWithAuth(const std::wstring& username, | 45 virtual int RestartWithAuth(const std::wstring& username, |
45 const std::wstring& password, | 46 const std::wstring& password, |
46 CompletionCallback* callback); | 47 CompletionCallback* callback); |
47 virtual bool IsReadyToRestartForAuth() { return false; } | 48 virtual bool IsReadyToRestartForAuth() { return false; } |
48 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); | 49 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
49 virtual void StopCaching() {} | 50 virtual void StopCaching() {} |
50 virtual const HttpResponseInfo* GetResponseInfo() const; | 51 virtual const HttpResponseInfo* GetResponseInfo() const; |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 // next state method as the result arg. | 83 // next state method as the result arg. |
83 int DoInitConnection(); | 84 int DoInitConnection(); |
84 int DoInitConnectionComplete(int result); | 85 int DoInitConnectionComplete(int result); |
85 int DoSendRequest(); | 86 int DoSendRequest(); |
86 int DoSendRequestComplete(int result); | 87 int DoSendRequestComplete(int result); |
87 int DoReadHeaders(); | 88 int DoReadHeaders(); |
88 int DoReadHeadersComplete(int result); | 89 int DoReadHeadersComplete(int result); |
89 int DoReadBody(); | 90 int DoReadBody(); |
90 int DoReadBodyComplete(int result); | 91 int DoReadBodyComplete(int result); |
91 | 92 |
92 scoped_refptr<LoadLog> load_log_; | 93 BoundNetLog net_log_; |
93 | 94 |
94 scoped_refptr<SpdySession> spdy_; | 95 scoped_refptr<SpdySession> spdy_; |
95 | 96 |
96 CompletionCallbackImpl<SpdyNetworkTransaction> io_callback_; | 97 CompletionCallbackImpl<SpdyNetworkTransaction> io_callback_; |
97 CompletionCallback* user_callback_; | 98 CompletionCallback* user_callback_; |
98 | 99 |
99 // Used to pass onto the SpdyStream | 100 // Used to pass onto the SpdyStream |
100 scoped_refptr<IOBuffer> user_buffer_; | 101 scoped_refptr<IOBuffer> user_buffer_; |
101 int user_buffer_len_; | 102 int user_buffer_len_; |
102 | 103 |
103 scoped_refptr<HttpNetworkSession> session_; | 104 scoped_refptr<HttpNetworkSession> session_; |
104 | 105 |
105 const HttpRequestInfo* request_; | 106 const HttpRequestInfo* request_; |
106 HttpResponseInfo response_; | 107 HttpResponseInfo response_; |
107 | 108 |
108 // The time the Start method was called. | 109 // The time the Start method was called. |
109 base::TimeTicks start_time_; | 110 base::TimeTicks start_time_; |
110 | 111 |
111 // The next state in the state machine. | 112 // The next state in the state machine. |
112 State next_state_; | 113 State next_state_; |
113 | 114 |
114 scoped_refptr<SpdyStream> stream_; | 115 scoped_refptr<SpdyStream> stream_; |
115 | 116 |
116 DISALLOW_COPY_AND_ASSIGN(SpdyNetworkTransaction); | 117 DISALLOW_COPY_AND_ASSIGN(SpdyNetworkTransaction); |
117 }; | 118 }; |
118 | 119 |
119 } // namespace net | 120 } // namespace net |
120 | 121 |
121 #endif // NET_SPDY_NETWORK_TRANSACTION_H_ | 122 #endif // NET_SPDY_NETWORK_TRANSACTION_H_ |
OLD | NEW |