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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 // SYN_REPLY, or HEADERS frames are received. This callback may be called | 42 // SYN_REPLY, or HEADERS frames are received. This callback may be called |
43 // multiple times as SPDY's delegate does. | 43 // multiple times as SPDY's delegate does. |
44 virtual int OnReceivedSpdyResponseHeader( | 44 virtual int OnReceivedSpdyResponseHeader( |
45 const SpdyHeaderBlock& headers, | 45 const SpdyHeaderBlock& headers, |
46 int status) = 0; | 46 int status) = 0; |
47 | 47 |
48 // Called when data is sent. | 48 // Called when data is sent. |
49 virtual void OnSentSpdyData(size_t bytes_sent) = 0; | 49 virtual void OnSentSpdyData(size_t bytes_sent) = 0; |
50 | 50 |
51 // Called when data is received. | 51 // Called when data is received. |
52 virtual void OnReceivedSpdyData(const char* data, int length) = 0; | 52 virtual void OnReceivedSpdyData(scoped_ptr<SpdyBuffer> buffer) = 0; |
53 | 53 |
54 // Called when SpdyStream is closed. | 54 // Called when SpdyStream is closed. |
55 virtual void OnCloseSpdyStream() = 0; | 55 virtual void OnCloseSpdyStream() = 0; |
56 | 56 |
57 protected: | 57 protected: |
58 virtual ~Delegate() {} | 58 virtual ~Delegate() {} |
59 }; | 59 }; |
60 | 60 |
61 SpdyWebSocketStream(SpdySession* spdy_session, Delegate* delegate); | 61 SpdyWebSocketStream(SpdySession* spdy_session, Delegate* delegate); |
62 virtual ~SpdyWebSocketStream(); | 62 virtual ~SpdyWebSocketStream(); |
(...skipping 11 matching lines...) Expand all Loading... |
74 void Close(); | 74 void Close(); |
75 | 75 |
76 // SpdyStream::Delegate | 76 // SpdyStream::Delegate |
77 virtual SpdySendStatus OnSendHeadersComplete() OVERRIDE; | 77 virtual SpdySendStatus OnSendHeadersComplete() OVERRIDE; |
78 virtual int OnSendBody() OVERRIDE; | 78 virtual int OnSendBody() OVERRIDE; |
79 virtual SpdySendStatus OnSendBodyComplete(size_t bytes_sent) OVERRIDE; | 79 virtual SpdySendStatus OnSendBodyComplete(size_t bytes_sent) OVERRIDE; |
80 virtual int OnResponseReceived(const SpdyHeaderBlock& response, | 80 virtual int OnResponseReceived(const SpdyHeaderBlock& response, |
81 base::Time response_time, | 81 base::Time response_time, |
82 int status) OVERRIDE; | 82 int status) OVERRIDE; |
83 virtual void OnHeadersSent() OVERRIDE; | 83 virtual void OnHeadersSent() OVERRIDE; |
84 virtual int OnDataReceived(const char* data, int length) OVERRIDE; | 84 virtual int OnDataReceived(scoped_ptr<SpdyBuffer> buffer) OVERRIDE; |
85 virtual void OnDataSent(size_t bytes_sent) OVERRIDE; | 85 virtual void OnDataSent(size_t bytes_sent) OVERRIDE; |
86 virtual void OnClose(int status) OVERRIDE; | 86 virtual void OnClose(int status) OVERRIDE; |
87 | 87 |
88 private: | 88 private: |
89 friend class SpdyWebSocketStreamSpdy2Test; | 89 friend class SpdyWebSocketStreamSpdy2Test; |
90 friend class SpdyWebSocketStreamSpdy3Test; | 90 friend class SpdyWebSocketStreamSpdy3Test; |
91 FRIEND_TEST_ALL_PREFIXES(SpdyWebSocketStreamSpdy2Test, Basic); | 91 FRIEND_TEST_ALL_PREFIXES(SpdyWebSocketStreamSpdy2Test, Basic); |
92 FRIEND_TEST_ALL_PREFIXES(SpdyWebSocketStreamSpdy3Test, Basic); | 92 FRIEND_TEST_ALL_PREFIXES(SpdyWebSocketStreamSpdy3Test, Basic); |
93 | 93 |
94 void OnSpdyStreamCreated(int status); | 94 void OnSpdyStreamCreated(int status); |
95 | 95 |
96 base::WeakPtrFactory<SpdyWebSocketStream> weak_ptr_factory_; | 96 base::WeakPtrFactory<SpdyWebSocketStream> weak_ptr_factory_; |
97 SpdyStreamRequest stream_request_; | 97 SpdyStreamRequest stream_request_; |
98 scoped_refptr<SpdyStream> stream_; | 98 scoped_refptr<SpdyStream> stream_; |
99 scoped_refptr<SpdySession> spdy_session_; | 99 scoped_refptr<SpdySession> spdy_session_; |
100 Delegate* delegate_; | 100 Delegate* delegate_; |
101 | 101 |
102 DISALLOW_COPY_AND_ASSIGN(SpdyWebSocketStream); | 102 DISALLOW_COPY_AND_ASSIGN(SpdyWebSocketStream); |
103 }; | 103 }; |
104 | 104 |
105 } // namespace net | 105 } // namespace net |
106 | 106 |
107 #endif // NET_SPDY_SPDY_WEBSOCKET_STREAM_H_ | 107 #endif // NET_SPDY_SPDY_WEBSOCKET_STREAM_H_ |
OLD | NEW |