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 14 matching lines...) Expand all Loading... |
25 class IOBuffer; | 25 class IOBuffer; |
26 class SpdySession; | 26 class SpdySession; |
27 class UploadDataStream; | 27 class UploadDataStream; |
28 | 28 |
29 // The SpdyHttpStream is a HTTP-specific type of stream known to a SpdySession. | 29 // The SpdyHttpStream is a HTTP-specific type of stream known to a SpdySession. |
30 class NET_EXPORT_PRIVATE SpdyHttpStream : public SpdyStream::Delegate, | 30 class NET_EXPORT_PRIVATE SpdyHttpStream : public SpdyStream::Delegate, |
31 public HttpStream { | 31 public HttpStream { |
32 public: | 32 public: |
33 // |spdy_session| must not be NULL. | 33 // |spdy_session| must not be NULL. |
34 SpdyHttpStream(const base::WeakPtr<SpdySession>& spdy_session, bool direct); | 34 SpdyHttpStream(const base::WeakPtr<SpdySession>& spdy_session, bool direct); |
35 virtual ~SpdyHttpStream(); | 35 ~SpdyHttpStream() override; |
36 | 36 |
37 SpdyStream* stream() { return stream_.get(); } | 37 SpdyStream* stream() { return stream_.get(); } |
38 | 38 |
39 // Cancels any callbacks from being invoked and deletes the stream. | 39 // Cancels any callbacks from being invoked and deletes the stream. |
40 void Cancel(); | 40 void Cancel(); |
41 | 41 |
42 // HttpStream implementation. | 42 // HttpStream implementation. |
43 | 43 |
44 virtual int InitializeStream(const HttpRequestInfo* request_info, | 44 int InitializeStream(const HttpRequestInfo* request_info, |
45 RequestPriority priority, | 45 RequestPriority priority, |
46 const BoundNetLog& net_log, | 46 const BoundNetLog& net_log, |
47 const CompletionCallback& callback) override; | 47 const CompletionCallback& callback) override; |
48 | 48 |
49 virtual int SendRequest(const HttpRequestHeaders& headers, | 49 int SendRequest(const HttpRequestHeaders& headers, |
50 HttpResponseInfo* response, | 50 HttpResponseInfo* response, |
51 const CompletionCallback& callback) override; | 51 const CompletionCallback& callback) override; |
52 virtual UploadProgress GetUploadProgress() const override; | 52 UploadProgress GetUploadProgress() const override; |
53 virtual int ReadResponseHeaders(const CompletionCallback& callback) override; | 53 int ReadResponseHeaders(const CompletionCallback& callback) override; |
54 virtual int ReadResponseBody(IOBuffer* buf, | 54 int ReadResponseBody(IOBuffer* buf, |
55 int buf_len, | 55 int buf_len, |
56 const CompletionCallback& callback) override; | 56 const CompletionCallback& callback) override; |
57 virtual void Close(bool not_reusable) override; | 57 void Close(bool not_reusable) override; |
58 virtual HttpStream* RenewStreamForAuth() override; | 58 HttpStream* RenewStreamForAuth() override; |
59 virtual bool IsResponseBodyComplete() const override; | 59 bool IsResponseBodyComplete() const override; |
60 virtual bool CanFindEndOfResponse() const override; | 60 bool CanFindEndOfResponse() const override; |
61 | 61 |
62 // Must not be called if a NULL SpdySession was pssed into the | 62 // Must not be called if a NULL SpdySession was pssed into the |
63 // constructor. | 63 // constructor. |
64 virtual bool IsConnectionReused() const override; | 64 bool IsConnectionReused() const override; |
65 | 65 |
66 virtual void SetConnectionReused() override; | 66 void SetConnectionReused() override; |
67 virtual bool IsConnectionReusable() const override; | 67 bool IsConnectionReusable() const override; |
68 virtual int64 GetTotalReceivedBytes() const override; | 68 int64 GetTotalReceivedBytes() const override; |
69 virtual bool GetLoadTimingInfo( | 69 bool GetLoadTimingInfo(LoadTimingInfo* load_timing_info) const override; |
70 LoadTimingInfo* load_timing_info) const override; | 70 void GetSSLInfo(SSLInfo* ssl_info) override; |
71 virtual void GetSSLInfo(SSLInfo* ssl_info) override; | 71 void GetSSLCertRequestInfo(SSLCertRequestInfo* cert_request_info) override; |
72 virtual void GetSSLCertRequestInfo( | 72 bool IsSpdyHttpStream() const override; |
73 SSLCertRequestInfo* cert_request_info) override; | 73 void Drain(HttpNetworkSession* session) override; |
74 virtual bool IsSpdyHttpStream() const override; | 74 void SetPriority(RequestPriority priority) override; |
75 virtual void Drain(HttpNetworkSession* session) override; | |
76 virtual void SetPriority(RequestPriority priority) override; | |
77 | 75 |
78 // SpdyStream::Delegate implementation. | 76 // SpdyStream::Delegate implementation. |
79 virtual void OnRequestHeadersSent() override; | 77 void OnRequestHeadersSent() override; |
80 virtual SpdyResponseHeadersStatus OnResponseHeadersUpdated( | 78 SpdyResponseHeadersStatus OnResponseHeadersUpdated( |
81 const SpdyHeaderBlock& response_headers) override; | 79 const SpdyHeaderBlock& response_headers) override; |
82 virtual void OnDataReceived(scoped_ptr<SpdyBuffer> buffer) override; | 80 void OnDataReceived(scoped_ptr<SpdyBuffer> buffer) override; |
83 virtual void OnDataSent() override; | 81 void OnDataSent() override; |
84 virtual void OnClose(int status) override; | 82 void OnClose(int status) override; |
85 | 83 |
86 private: | 84 private: |
87 // Must be called only when |request_info_| is non-NULL. | 85 // Must be called only when |request_info_| is non-NULL. |
88 bool HasUploadData() const; | 86 bool HasUploadData() const; |
89 | 87 |
90 void OnStreamCreated(const CompletionCallback& callback, int rv); | 88 void OnStreamCreated(const CompletionCallback& callback, int rv); |
91 | 89 |
92 // Reads the remaining data (whether chunked or not) from the | 90 // Reads the remaining data (whether chunked or not) from the |
93 // request body stream and sends it if there's any. The read and | 91 // request body stream and sends it if there's any. The read and |
94 // subsequent sending may happen asynchronously. Must be called only | 92 // subsequent sending may happen asynchronously. Must be called only |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 bool direct_; | 157 bool direct_; |
160 | 158 |
161 base::WeakPtrFactory<SpdyHttpStream> weak_factory_; | 159 base::WeakPtrFactory<SpdyHttpStream> weak_factory_; |
162 | 160 |
163 DISALLOW_COPY_AND_ASSIGN(SpdyHttpStream); | 161 DISALLOW_COPY_AND_ASSIGN(SpdyHttpStream); |
164 }; | 162 }; |
165 | 163 |
166 } // namespace net | 164 } // namespace net |
167 | 165 |
168 #endif // NET_SPDY_SPDY_HTTP_STREAM_H_ | 166 #endif // NET_SPDY_SPDY_HTTP_STREAM_H_ |
OLD | NEW |