OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 10 matching lines...) Expand all Loading... |
21 class HttpResponseInfo; | 21 class HttpResponseInfo; |
22 class IOBuffer; | 22 class IOBuffer; |
23 class SpdySession; | 23 class SpdySession; |
24 class UploadData; | 24 class UploadData; |
25 class UploadDataStream; | 25 class UploadDataStream; |
26 | 26 |
27 // The SpdyHttpStream is a HTTP-specific type of stream known to a SpdySession. | 27 // The SpdyHttpStream is a HTTP-specific type of stream known to a SpdySession. |
28 class SpdyHttpStream : public SpdyStream::Delegate { | 28 class SpdyHttpStream : public SpdyStream::Delegate { |
29 public: | 29 public: |
30 // SpdyHttpStream constructor | 30 // SpdyHttpStream constructor |
31 explicit SpdyHttpStream(const scoped_refptr<SpdyStream>& stream); | 31 SpdyHttpStream(); |
32 virtual ~SpdyHttpStream(); | 32 virtual ~SpdyHttpStream(); |
33 | 33 |
34 SpdyStream* stream() { return stream_.get(); } | 34 SpdyStream* stream() { return stream_.get(); } |
35 | 35 |
| 36 // Initialize stream. Must be called before calling InitializeRequest(). |
| 37 int InitializeStream(SpdySession* spdy_session, |
| 38 const HttpRequestInfo& request_info, |
| 39 const BoundNetLog& stream_net_log, |
| 40 CompletionCallback* callback); |
| 41 |
36 // Initialize request. Must be called before calling SendRequest(). | 42 // Initialize request. Must be called before calling SendRequest(). |
37 // SpdyHttpStream takes ownership of |upload_data|. |upload_data| may be NULL. | 43 // SpdyHttpStream takes ownership of |upload_data|. |upload_data| may be NULL. |
38 void InitializeRequest(const HttpRequestInfo& request_info, | 44 void InitializeRequest(base::Time request_time, |
39 base::Time request_time, | |
40 UploadDataStream* upload_data); | 45 UploadDataStream* upload_data); |
41 | 46 |
42 const HttpResponseInfo* GetResponseInfo() const; | 47 const HttpResponseInfo* GetResponseInfo() const; |
43 | 48 |
44 // =================================================== | 49 // =================================================== |
45 // Interface for [Http|Spdy]NetworkTransaction to use. | 50 // Interface for [Http|Spdy]NetworkTransaction to use. |
46 | 51 |
47 // Sends the request. | 52 // Sends the request. |
48 // |callback| is used when this completes asynchronously. | 53 // |callback| is used when this completes asynchronously. |
49 // The actual SYN_STREAM packet will be sent if the stream is non-pushed. | 54 // The actual SYN_STREAM packet will be sent if the stream is non-pushed. |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
97 // Call the user callback. | 102 // Call the user callback. |
98 void DoCallback(int rv); | 103 void DoCallback(int rv); |
99 | 104 |
100 void ScheduleBufferedReadCallback(); | 105 void ScheduleBufferedReadCallback(); |
101 | 106 |
102 // Returns true if the callback is invoked. | 107 // Returns true if the callback is invoked. |
103 bool DoBufferedReadCallback(); | 108 bool DoBufferedReadCallback(); |
104 bool ShouldWaitForMoreBufferedData() const; | 109 bool ShouldWaitForMoreBufferedData() const; |
105 | 110 |
106 ScopedRunnableMethodFactory<SpdyHttpStream> read_callback_factory_; | 111 ScopedRunnableMethodFactory<SpdyHttpStream> read_callback_factory_; |
107 const scoped_refptr<SpdyStream> stream_; | 112 scoped_refptr<SpdyStream> stream_; |
| 113 scoped_refptr<SpdySession> spdy_session_; |
108 | 114 |
109 // The request to send. | 115 // The request to send. |
110 HttpRequestInfo request_info_; | 116 HttpRequestInfo request_info_; |
111 | 117 |
112 scoped_ptr<UploadDataStream> request_body_stream_; | 118 scoped_ptr<UploadDataStream> request_body_stream_; |
113 | 119 |
114 // |response_info_| is the HTTP response data object which is filled in | 120 // |response_info_| is the HTTP response data object which is filled in |
115 // when a SYN_REPLY comes in for the stream. | 121 // when a SYN_REPLY comes in for the stream. |
116 // It is not owned by this stream object, or point to |push_response_info_|. | 122 // It is not owned by this stream object, or point to |push_response_info_|. |
117 HttpResponseInfo* response_info_; | 123 HttpResponseInfo* response_info_; |
(...skipping 17 matching lines...) Expand all Loading... |
135 // Has more data been received from the network during the wait for the | 141 // Has more data been received from the network during the wait for the |
136 // scheduled read callback. | 142 // scheduled read callback. |
137 bool more_read_data_pending_; | 143 bool more_read_data_pending_; |
138 | 144 |
139 DISALLOW_COPY_AND_ASSIGN(SpdyHttpStream); | 145 DISALLOW_COPY_AND_ASSIGN(SpdyHttpStream); |
140 }; | 146 }; |
141 | 147 |
142 } // namespace net | 148 } // namespace net |
143 | 149 |
144 #endif // NET_SPDY_SPDY_HTTP_STREAM_H_ | 150 #endif // NET_SPDY_SPDY_HTTP_STREAM_H_ |
OLD | NEW |