Chromium Code Reviews| 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <list> | 9 #include <list> |
| 10 #include <string> | 10 #include <string> |
| (...skipping 13 matching lines...) Expand all Loading... | |
| 24 | 24 |
| 25 class DrainableIOBuffer; | 25 class DrainableIOBuffer; |
| 26 class HttpResponseInfo; | 26 class HttpResponseInfo; |
| 27 class IOBuffer; | 27 class IOBuffer; |
| 28 class SpdySession; | 28 class SpdySession; |
| 29 class UploadData; | 29 class UploadData; |
| 30 class UploadDataStream; | 30 class UploadDataStream; |
| 31 | 31 |
| 32 // The SpdyHttpStream is a HTTP-specific type of stream known to a SpdySession. | 32 // The SpdyHttpStream is a HTTP-specific type of stream known to a SpdySession. |
| 33 class NET_EXPORT_PRIVATE SpdyHttpStream : public SpdyStream::Delegate, | 33 class NET_EXPORT_PRIVATE SpdyHttpStream : public SpdyStream::Delegate, |
| 34 public HttpStream { | 34 public HttpStream, |
| 35 public ChunkCallback { | |
|
Ryan Sleevi
2012/07/04 00:52:49
iwyu: You should include "net/base/upload_data.h"
ramant (doing other things)
2012/07/04 21:04:33
Done.
| |
| 35 public: | 36 public: |
| 36 SpdyHttpStream(SpdySession* spdy_session, bool direct); | 37 SpdyHttpStream(SpdySession* spdy_session, bool direct); |
| 37 virtual ~SpdyHttpStream(); | 38 virtual ~SpdyHttpStream(); |
| 38 | 39 |
| 39 // Initializes this SpdyHttpStream by wrapping an existing SpdyStream. | 40 // Initializes this SpdyHttpStream by wrapping an existing SpdyStream. |
| 40 void InitializeWithExistingStream(SpdyStream* spdy_stream); | 41 void InitializeWithExistingStream(SpdyStream* spdy_stream); |
| 41 | 42 |
| 42 SpdyStream* stream() { return stream_.get(); } | 43 SpdyStream* stream() { return stream_.get(); } |
| 43 | 44 |
| 44 // Cancels any callbacks from being invoked and deletes the stream. | 45 // Cancels any callbacks from being invoked and deletes the stream. |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 76 // SpdyStream::Delegate implementation. | 77 // SpdyStream::Delegate implementation. |
| 77 virtual bool OnSendHeadersComplete(int status) OVERRIDE; | 78 virtual bool OnSendHeadersComplete(int status) OVERRIDE; |
| 78 virtual int OnSendBody() OVERRIDE; | 79 virtual int OnSendBody() OVERRIDE; |
| 79 virtual int OnSendBodyComplete(int status, bool* eof) OVERRIDE; | 80 virtual int OnSendBodyComplete(int status, bool* eof) OVERRIDE; |
| 80 virtual int OnResponseReceived(const SpdyHeaderBlock& response, | 81 virtual int OnResponseReceived(const SpdyHeaderBlock& response, |
| 81 base::Time response_time, | 82 base::Time response_time, |
| 82 int status) OVERRIDE; | 83 int status) OVERRIDE; |
| 83 virtual void OnDataReceived(const char* buffer, int bytes) OVERRIDE; | 84 virtual void OnDataReceived(const char* buffer, int bytes) OVERRIDE; |
| 84 virtual void OnDataSent(int length) OVERRIDE; | 85 virtual void OnDataSent(int length) OVERRIDE; |
| 85 virtual void OnClose(int status) OVERRIDE; | 86 virtual void OnClose(int status) OVERRIDE; |
| 86 virtual void set_chunk_callback(ChunkCallback* callback) OVERRIDE; | 87 |
| 88 // ChunkCallback methods. | |
| 89 virtual void OnChunkAvailable() OVERRIDE; | |
| 87 | 90 |
| 88 private: | 91 private: |
| 89 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionSpdy2Test, | 92 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionSpdy2Test, |
| 90 FlowControlStallResume); | 93 FlowControlStallResume); |
| 91 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionSpdy3Test, | 94 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionSpdy3Test, |
| 92 FlowControlStallResume); | 95 FlowControlStallResume); |
| 93 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionSpdy3Test, | 96 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionSpdy3Test, |
| 94 FlowControlStallResumeAfterSettings); | 97 FlowControlStallResumeAfterSettings); |
| 95 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionSpdy3Test, | 98 FRIEND_TEST_ALL_PREFIXES(SpdyNetworkTransactionSpdy3Test, |
| 96 FlowControlNegativeSendWindowSize); | 99 FlowControlNegativeSendWindowSize); |
| 97 | 100 |
| 101 // Reads the data from the request body stream and sends the data by calling | |
| 102 // spdy stream's WriteStreamData. In case of chunked uploads, if data is not | |
|
Ryan Sleevi
2012/07/04 00:52:49
nit: spdy stream's WriteStreamData -> SpdyStream::
ramant (doing other things)
2012/07/04 21:04:33
Done.
| |
| 103 // available, then it will indicate to OnChunkAvailable that is waiting for | |
| 104 // chunked data by setting |waiting_for_chunk_| to true. | |
|
Ryan Sleevi
2012/07/04 00:52:49
nit: Suggested rewording:
In the case of chunked
ramant (doing other things)
2012/07/04 21:04:33
Done.
| |
| 105 int SendData(); | |
| 106 | |
| 98 // Call the user callback. | 107 // Call the user callback. |
| 99 void DoCallback(int rv); | 108 void DoCallback(int rv); |
| 100 | 109 |
| 101 void ScheduleBufferedReadCallback(); | 110 void ScheduleBufferedReadCallback(); |
| 102 | 111 |
| 103 // Returns true if the callback is invoked. | 112 // Returns true if the callback is invoked. |
| 104 bool DoBufferedReadCallback(); | 113 bool DoBufferedReadCallback(); |
| 105 bool ShouldWaitForMoreBufferedData() const; | 114 bool ShouldWaitForMoreBufferedData() const; |
| 106 | 115 |
| 107 base::WeakPtrFactory<SpdyHttpStream> weak_factory_; | 116 base::WeakPtrFactory<SpdyHttpStream> weak_factory_; |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 140 | 149 |
| 141 // Is there a scheduled read callback pending. | 150 // Is there a scheduled read callback pending. |
| 142 bool buffered_read_callback_pending_; | 151 bool buffered_read_callback_pending_; |
| 143 // Has more data been received from the network during the wait for the | 152 // Has more data been received from the network during the wait for the |
| 144 // scheduled read callback. | 153 // scheduled read callback. |
| 145 bool more_read_data_pending_; | 154 bool more_read_data_pending_; |
| 146 | 155 |
| 147 // Is this spdy stream direct to the origin server (or to a proxy). | 156 // Is this spdy stream direct to the origin server (or to a proxy). |
| 148 bool direct_; | 157 bool direct_; |
| 149 | 158 |
| 159 // Is the spdy stream waiting for chunked data. | |
|
Ryan Sleevi
2012/07/04 00:52:49
nit: True if the connection is stalled waiting for
ramant (doing other things)
2012/07/04 21:04:33
Done.
| |
| 160 bool waiting_for_chunk_; | |
| 150 bool send_last_chunk_; | 161 bool send_last_chunk_; |
| 151 | 162 |
| 152 DISALLOW_COPY_AND_ASSIGN(SpdyHttpStream); | 163 DISALLOW_COPY_AND_ASSIGN(SpdyHttpStream); |
| 153 }; | 164 }; |
| 154 | 165 |
| 155 } // namespace net | 166 } // namespace net |
| 156 | 167 |
| 157 #endif // NET_SPDY_SPDY_HTTP_STREAM_H_ | 168 #endif // NET_SPDY_SPDY_HTTP_STREAM_H_ |
| OLD | NEW |