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" |
11 #include "base/memory/scoped_ptr.h" | 11 #include "base/memory/scoped_ptr.h" |
12 #include "base/memory/weak_ptr.h" | 12 #include "base/memory/weak_ptr.h" |
13 #include "base/time/time.h" | 13 #include "base/time/time.h" |
14 #include "net/base/completion_callback.h" | 14 #include "net/base/completion_callback.h" |
15 #include "net/base/request_priority.h" | 15 #include "net/base/request_priority.h" |
16 #include "net/spdy/spdy_framer.h" | 16 #include "net/spdy/spdy_framer.h" |
17 #include "net/spdy/spdy_header_block.h" | 17 #include "net/spdy/spdy_header_block.h" |
18 #include "net/spdy/spdy_session.h" | 18 #include "net/spdy/spdy_session.h" |
19 #include "net/spdy/spdy_stream.h" | 19 #include "net/spdy/spdy_stream.h" |
20 | 20 |
21 namespace net { | 21 namespace net { |
22 | 22 |
23 // The SpdyWebSocketStream is a WebSocket-specific type of stream known to a | 23 // The SpdyWebSocketStream is a WebSocket-specific type of stream known to a |
24 // SpdySession. WebSocket's opening handshake is converted to SPDY's | 24 // SpdySession. WebSocket's opening handshake is converted to SPDY's |
25 // SYN_STREAM/SYN_REPLY. WebSocket frames are encapsulated as SPDY data frames. | 25 // SYN_STREAM/SYN_REPLY. WebSocket frames are encapsulated as SPDY data frames. |
26 class NET_EXPORT_PRIVATE SpdyWebSocketStream | 26 class NET_EXPORT_PRIVATE SpdyWebSocketStream : public SpdyStream::Delegate { |
27 : public SpdyStream::Delegate { | |
28 public: | 27 public: |
29 // Delegate handles asynchronous events. | 28 // Delegate handles asynchronous events. |
30 class NET_EXPORT_PRIVATE Delegate { | 29 class NET_EXPORT_PRIVATE Delegate { |
31 public: | 30 public: |
32 // Called when InitializeStream() finishes asynchronously. This delegate is | 31 // Called when InitializeStream() finishes asynchronously. This delegate is |
33 // called if InitializeStream() returns ERR_IO_PENDING. |status| indicates | 32 // called if InitializeStream() returns ERR_IO_PENDING. |status| indicates |
34 // network error. | 33 // network error. |
35 virtual void OnCreatedSpdyStream(int status) = 0; | 34 virtual void OnCreatedSpdyStream(int status) = 0; |
36 | 35 |
37 // Called on corresponding to OnSendHeadersComplete() or SPDY's SYN frame | 36 // Called on corresponding to OnSendHeadersComplete() or SPDY's SYN frame |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
94 const base::WeakPtr<SpdySession> spdy_session_; | 93 const base::WeakPtr<SpdySession> spdy_session_; |
95 size_t pending_send_data_length_; | 94 size_t pending_send_data_length_; |
96 Delegate* delegate_; | 95 Delegate* delegate_; |
97 | 96 |
98 DISALLOW_COPY_AND_ASSIGN(SpdyWebSocketStream); | 97 DISALLOW_COPY_AND_ASSIGN(SpdyWebSocketStream); |
99 }; | 98 }; |
100 | 99 |
101 } // namespace net | 100 } // namespace net |
102 | 101 |
103 #endif // NET_SPDY_SPDY_WEBSOCKET_STREAM_H_ | 102 #endif // NET_SPDY_SPDY_WEBSOCKET_STREAM_H_ |
OLD | NEW |