| 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_WEBSOCKET_STREAM_H_ | 5 #ifndef NET_SPDY_SPDY_WEBSOCKET_STREAM_H_ |
| 6 #define NET_SPDY_SPDY_WEBSOCKET_STREAM_H_ | 6 #define NET_SPDY_SPDY_WEBSOCKET_STREAM_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "base/gtest_prod_util.h" | 9 #include "base/gtest_prod_util.h" |
| 10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
| (...skipping 20 matching lines...) Expand all Loading... |
| 31 public: | 31 public: |
| 32 // Called when InitializeStream() finishes asynchronously. This delegate is | 32 // Called when InitializeStream() finishes asynchronously. This delegate is |
| 33 // called if InitializeStream() returns ERR_IO_PENDING. |status| indicates | 33 // called if InitializeStream() returns ERR_IO_PENDING. |status| indicates |
| 34 // network error. | 34 // network error. |
| 35 virtual void OnCreatedSpdyStream(int status) = 0; | 35 virtual void OnCreatedSpdyStream(int status) = 0; |
| 36 | 36 |
| 37 // Called on corresponding to OnSendHeadersComplete() or SPDY's SYN frame | 37 // Called on corresponding to OnSendHeadersComplete() or SPDY's SYN frame |
| 38 // has been sent. | 38 // has been sent. |
| 39 virtual void OnSentSpdyHeaders() = 0; | 39 virtual void OnSentSpdyHeaders() = 0; |
| 40 | 40 |
| 41 // Called on corresponding to OnResponseHeadersReceived() or | 41 // Called on corresponding to OnResponseHeadersUpdated() or |
| 42 // SPDY's SYN_STREAM, SYN_REPLY, or HEADERS frames are | 42 // SPDY's SYN_STREAM, SYN_REPLY, or HEADERS frames are |
| 43 // received. This callback may be called multiple times as SPDY's | 43 // received. This callback may be called multiple times as SPDY's |
| 44 // delegate does. | 44 // delegate does. |
| 45 virtual int OnReceivedSpdyResponseHeader( | 45 virtual void OnSpdyResponseHeadersUpdated( |
| 46 const SpdyHeaderBlock& headers, | 46 const SpdyHeaderBlock& response_headers) = 0; |
| 47 int status) = 0; | |
| 48 | 47 |
| 49 // Called when data is sent. | 48 // Called when data is sent. |
| 50 virtual void OnSentSpdyData(size_t bytes_sent) = 0; | 49 virtual void OnSentSpdyData(size_t bytes_sent) = 0; |
| 51 | 50 |
| 52 // Called when data is received. | 51 // Called when data is received. |
| 53 virtual void OnReceivedSpdyData(scoped_ptr<SpdyBuffer> buffer) = 0; | 52 virtual void OnReceivedSpdyData(scoped_ptr<SpdyBuffer> buffer) = 0; |
| 54 | 53 |
| 55 // Called when SpdyStream is closed. | 54 // Called when SpdyStream is closed. |
| 56 virtual void OnCloseSpdyStream() = 0; | 55 virtual void OnCloseSpdyStream() = 0; |
| 57 | 56 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 69 int InitializeStream(const GURL& url, | 68 int InitializeStream(const GURL& url, |
| 70 RequestPriority request_priority, | 69 RequestPriority request_priority, |
| 71 const BoundNetLog& stream_net_log); | 70 const BoundNetLog& stream_net_log); |
| 72 | 71 |
| 73 int SendRequest(scoped_ptr<SpdyHeaderBlock> headers); | 72 int SendRequest(scoped_ptr<SpdyHeaderBlock> headers); |
| 74 int SendData(const char* data, int length); | 73 int SendData(const char* data, int length); |
| 75 void Close(); | 74 void Close(); |
| 76 | 75 |
| 77 // SpdyStream::Delegate | 76 // SpdyStream::Delegate |
| 78 virtual void OnRequestHeadersSent() OVERRIDE; | 77 virtual void OnRequestHeadersSent() OVERRIDE; |
| 79 virtual int OnResponseHeadersReceived(const SpdyHeaderBlock& response, | 78 virtual int OnResponseHeadersUpdated( |
| 80 base::Time response_time, | 79 const SpdyHeaderBlock& response_headers) OVERRIDE; |
| 81 int status) OVERRIDE; | |
| 82 virtual int OnDataReceived(scoped_ptr<SpdyBuffer> buffer) OVERRIDE; | 80 virtual int OnDataReceived(scoped_ptr<SpdyBuffer> buffer) OVERRIDE; |
| 83 virtual void OnDataSent() OVERRIDE; | 81 virtual void OnDataSent() OVERRIDE; |
| 84 virtual void OnClose(int status) OVERRIDE; | 82 virtual void OnClose(int status) OVERRIDE; |
| 85 | 83 |
| 86 private: | 84 private: |
| 87 friend class SpdyWebSocketStreamSpdy2Test; | 85 friend class SpdyWebSocketStreamSpdy2Test; |
| 88 friend class SpdyWebSocketStreamSpdy3Test; | 86 friend class SpdyWebSocketStreamSpdy3Test; |
| 89 FRIEND_TEST_ALL_PREFIXES(SpdyWebSocketStreamSpdy2Test, Basic); | 87 FRIEND_TEST_ALL_PREFIXES(SpdyWebSocketStreamSpdy2Test, Basic); |
| 90 FRIEND_TEST_ALL_PREFIXES(SpdyWebSocketStreamSpdy3Test, Basic); | 88 FRIEND_TEST_ALL_PREFIXES(SpdyWebSocketStreamSpdy3Test, Basic); |
| 91 | 89 |
| 92 void OnSpdyStreamCreated(int status); | 90 void OnSpdyStreamCreated(int status); |
| 93 | 91 |
| 94 base::WeakPtrFactory<SpdyWebSocketStream> weak_ptr_factory_; | 92 base::WeakPtrFactory<SpdyWebSocketStream> weak_ptr_factory_; |
| 95 SpdyStreamRequest stream_request_; | 93 SpdyStreamRequest stream_request_; |
| 96 base::WeakPtr<SpdyStream> stream_; | 94 base::WeakPtr<SpdyStream> stream_; |
| 97 scoped_refptr<SpdySession> spdy_session_; | 95 scoped_refptr<SpdySession> spdy_session_; |
| 98 size_t pending_send_data_length_; | 96 size_t pending_send_data_length_; |
| 99 Delegate* delegate_; | 97 Delegate* delegate_; |
| 100 | 98 |
| 101 DISALLOW_COPY_AND_ASSIGN(SpdyWebSocketStream); | 99 DISALLOW_COPY_AND_ASSIGN(SpdyWebSocketStream); |
| 102 }; | 100 }; |
| 103 | 101 |
| 104 } // namespace net | 102 } // namespace net |
| 105 | 103 |
| 106 #endif // NET_SPDY_SPDY_WEBSOCKET_STREAM_H_ | 104 #endif // NET_SPDY_SPDY_WEBSOCKET_STREAM_H_ |
| OLD | NEW |