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 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); | 49 virtual int Read(IOBuffer* buf, int buf_len, CompletionCallback* callback); |
50 virtual void StopCaching() {} | 50 virtual void StopCaching() {} |
51 virtual const HttpResponseInfo* GetResponseInfo() const; | 51 virtual const HttpResponseInfo* GetResponseInfo() const; |
52 virtual LoadState GetLoadState() const; | 52 virtual LoadState GetLoadState() const; |
53 virtual uint64 GetUploadProgress() const; | 53 virtual uint64 GetUploadProgress() const; |
54 | 54 |
55 private: | 55 private: |
56 enum State { | 56 enum State { |
57 STATE_INIT_CONNECTION, | 57 STATE_INIT_CONNECTION, |
58 STATE_INIT_CONNECTION_COMPLETE, | 58 STATE_INIT_CONNECTION_COMPLETE, |
| 59 STATE_GET_STREAM, |
| 60 STATE_GET_STREAM_COMPLETE, |
59 STATE_SEND_REQUEST, | 61 STATE_SEND_REQUEST, |
60 STATE_SEND_REQUEST_COMPLETE, | 62 STATE_SEND_REQUEST_COMPLETE, |
61 STATE_READ_HEADERS, | 63 STATE_READ_HEADERS, |
62 STATE_READ_HEADERS_COMPLETE, | 64 STATE_READ_HEADERS_COMPLETE, |
63 STATE_READ_BODY, | 65 STATE_READ_BODY, |
64 STATE_READ_BODY_COMPLETE, | 66 STATE_READ_BODY_COMPLETE, |
65 STATE_NONE | 67 STATE_NONE |
66 }; | 68 }; |
67 | 69 |
68 void DoCallback(int result); | 70 void DoCallback(int result); |
69 void OnIOComplete(int result); | 71 void OnIOComplete(int result); |
70 | 72 |
71 // Runs the state transition loop. | 73 // Runs the state transition loop. |
72 int DoLoop(int result); | 74 int DoLoop(int result); |
73 | 75 |
74 // Each of these methods corresponds to a State value. Those with an input | 76 // Each of these methods corresponds to a State value. Those with an input |
75 // argument receive the result from the previous state. If a method returns | 77 // argument receive the result from the previous state. If a method returns |
76 // ERR_IO_PENDING, then the result from OnIOComplete will be passed to the | 78 // ERR_IO_PENDING, then the result from OnIOComplete will be passed to the |
77 // next state method as the result arg. | 79 // next state method as the result arg. |
78 int DoInitConnection(); | 80 int DoInitConnection(); |
79 int DoInitConnectionComplete(int result); | 81 int DoInitConnectionComplete(int result); |
| 82 int DoGetStream(); |
| 83 int DoGetStreamComplete(int result); |
80 int DoSendRequest(); | 84 int DoSendRequest(); |
81 int DoSendRequestComplete(int result); | 85 int DoSendRequestComplete(int result); |
82 int DoReadHeaders(); | 86 int DoReadHeaders(); |
83 int DoReadHeadersComplete(int result); | 87 int DoReadHeadersComplete(int result); |
84 int DoReadBody(); | 88 int DoReadBody(); |
85 int DoReadBodyComplete(int result); | 89 int DoReadBodyComplete(int result); |
86 | 90 |
87 BoundNetLog net_log_; | 91 BoundNetLog net_log_; |
88 | 92 |
89 scoped_refptr<SpdySession> spdy_; | 93 scoped_refptr<SpdySession> spdy_; |
(...skipping 17 matching lines...) Expand all Loading... |
107 State next_state_; | 111 State next_state_; |
108 | 112 |
109 scoped_ptr<SpdyHttpStream> stream_; | 113 scoped_ptr<SpdyHttpStream> stream_; |
110 | 114 |
111 DISALLOW_COPY_AND_ASSIGN(SpdyNetworkTransaction); | 115 DISALLOW_COPY_AND_ASSIGN(SpdyNetworkTransaction); |
112 }; | 116 }; |
113 | 117 |
114 } // namespace net | 118 } // namespace net |
115 | 119 |
116 #endif // NET_SPDY_NETWORK_TRANSACTION_H_ | 120 #endif // NET_SPDY_NETWORK_TRANSACTION_H_ |
OLD | NEW |