| 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_SPDY_SPDY_HTTP_STREAM_H_ | 5 #ifndef NET_SPDY_SPDY_HTTP_STREAM_H_ |
| 6 #define NET_SPDY_SPDY_HTTP_STREAM_H_ | 6 #define NET_SPDY_SPDY_HTTP_STREAM_H_ |
| 7 | 7 |
| 8 #include <list> | 8 #include <list> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| (...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 78 virtual bool GetLoadTimingInfo( | 78 virtual bool GetLoadTimingInfo( |
| 79 LoadTimingInfo* load_timing_info) const OVERRIDE; | 79 LoadTimingInfo* load_timing_info) const OVERRIDE; |
| 80 virtual void GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; | 80 virtual void GetSSLInfo(SSLInfo* ssl_info) OVERRIDE; |
| 81 virtual void GetSSLCertRequestInfo( | 81 virtual void GetSSLCertRequestInfo( |
| 82 SSLCertRequestInfo* cert_request_info) OVERRIDE; | 82 SSLCertRequestInfo* cert_request_info) OVERRIDE; |
| 83 virtual bool IsSpdyHttpStream() const OVERRIDE; | 83 virtual bool IsSpdyHttpStream() const OVERRIDE; |
| 84 virtual void Drain(HttpNetworkSession* session) OVERRIDE; | 84 virtual void Drain(HttpNetworkSession* session) OVERRIDE; |
| 85 | 85 |
| 86 // SpdyStream::Delegate implementation. | 86 // SpdyStream::Delegate implementation. |
| 87 virtual SpdySendStatus OnSendHeadersComplete() OVERRIDE; | 87 virtual SpdySendStatus OnSendHeadersComplete() OVERRIDE; |
| 88 virtual int OnSendBody() OVERRIDE; | 88 virtual void OnSendBody() OVERRIDE; |
| 89 virtual SpdySendStatus OnSendBodyComplete(size_t bytes_sent) OVERRIDE; | 89 virtual SpdySendStatus OnSendBodyComplete(size_t bytes_sent) OVERRIDE; |
| 90 virtual int OnResponseReceived(const SpdyHeaderBlock& response, | 90 virtual int OnResponseReceived(const SpdyHeaderBlock& response, |
| 91 base::Time response_time, | 91 base::Time response_time, |
| 92 int status) OVERRIDE; | 92 int status) OVERRIDE; |
| 93 virtual void OnHeadersSent() OVERRIDE; | 93 virtual void OnHeadersSent() OVERRIDE; |
| 94 virtual int OnDataReceived(scoped_ptr<SpdyBuffer> buffer) OVERRIDE; | 94 virtual int OnDataReceived(scoped_ptr<SpdyBuffer> buffer) OVERRIDE; |
| 95 virtual void OnDataSent(size_t bytes_sent) OVERRIDE; | 95 virtual void OnDataSent(size_t bytes_sent) OVERRIDE; |
| 96 virtual void OnClose(int status) OVERRIDE; | 96 virtual void OnClose(int status) OVERRIDE; |
| 97 | 97 |
| 98 private: | 98 private: |
| 99 void OnStreamCreated(const CompletionCallback& callback, int rv); | 99 void OnStreamCreated(const CompletionCallback& callback, int rv); |
| 100 | 100 |
| 101 // Reads the data (whether chunked or not) from the request body stream and | 101 // Reads the data (whether chunked or not) from the request body |
| 102 // sends the data by calling WriteStreamData on the underlying SpdyStream. | 102 // stream and sends it. The read and subsequent sending may happen |
| 103 int SendData(); | 103 // asynchronously. |
| 104 void ReadAndSendRequestBodyData(); |
| 105 |
| 106 // Called when data has just been read from the request body stream; |
| 107 // does the actual sending of data. |
| 108 void OnRequestBodyReadCompleted(int status); |
| 109 |
| 110 // Queues some request body data to be sent. |
| 111 void SendRequestBodyData(); |
| 104 | 112 |
| 105 // Call the user callback. | 113 // Call the user callback. |
| 106 void DoCallback(int rv); | 114 void DoCallback(int rv); |
| 107 | 115 |
| 108 int OnRequestBodyReadCompleted(int status); | |
| 109 | |
| 110 void ScheduleBufferedReadCallback(); | 116 void ScheduleBufferedReadCallback(); |
| 111 | 117 |
| 112 // Returns true if the callback is invoked. | 118 // Returns true if the callback is invoked. |
| 113 bool DoBufferedReadCallback(); | 119 bool DoBufferedReadCallback(); |
| 114 bool ShouldWaitForMoreBufferedData() const; | 120 bool ShouldWaitForMoreBufferedData() const; |
| 115 | 121 |
| 116 base::WeakPtrFactory<SpdyHttpStream> weak_factory_; | 122 base::WeakPtrFactory<SpdyHttpStream> weak_factory_; |
| 117 | 123 |
| 118 const scoped_refptr<SpdySession> spdy_session_; | 124 const scoped_refptr<SpdySession> spdy_session_; |
| 119 SpdyStreamRequest stream_request_; | 125 SpdyStreamRequest stream_request_; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 162 | 168 |
| 163 // Is this spdy stream direct to the origin server (or to a proxy). | 169 // Is this spdy stream direct to the origin server (or to a proxy). |
| 164 bool direct_; | 170 bool direct_; |
| 165 | 171 |
| 166 DISALLOW_COPY_AND_ASSIGN(SpdyHttpStream); | 172 DISALLOW_COPY_AND_ASSIGN(SpdyHttpStream); |
| 167 }; | 173 }; |
| 168 | 174 |
| 169 } // namespace net | 175 } // namespace net |
| 170 | 176 |
| 171 #endif // NET_SPDY_SPDY_HTTP_STREAM_H_ | 177 #endif // NET_SPDY_SPDY_HTTP_STREAM_H_ |
| OLD | NEW |