Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(186)

Side by Side Diff: net/spdy/spdy_websocket_stream.h

Issue 15936003: [SPDY] Refactor SpdyStream::Delegate (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « net/spdy/spdy_stream_test_util.cc ('k') | net/spdy/spdy_websocket_stream.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 OnResponseReceived() or SPDY's SYN_STREAM, 41 // Called on corresponding to OnResponseHeadersReceived() or
42 // SYN_REPLY, or HEADERS frames are received. This callback may be called 42 // SPDY's SYN_STREAM, SYN_REPLY, or HEADERS frames are
43 // multiple times as SPDY's delegate does. 43 // received. This callback may be called multiple times as SPDY's
44 // delegate does.
44 virtual int OnReceivedSpdyResponseHeader( 45 virtual int OnReceivedSpdyResponseHeader(
45 const SpdyHeaderBlock& headers, 46 const SpdyHeaderBlock& headers,
46 int status) = 0; 47 int status) = 0;
47 48
48 // Called when data is sent. 49 // Called when data is sent.
49 virtual void OnSentSpdyData(size_t bytes_sent) = 0; 50 virtual void OnSentSpdyData(size_t bytes_sent) = 0;
50 51
51 // Called when data is received. 52 // Called when data is received.
52 virtual void OnReceivedSpdyData(scoped_ptr<SpdyBuffer> buffer) = 0; 53 virtual void OnReceivedSpdyData(scoped_ptr<SpdyBuffer> buffer) = 0;
53 54
(...skipping 13 matching lines...) Expand all
67 // after completion. In other cases, delegate does not be called. 68 // after completion. In other cases, delegate does not be called.
68 int InitializeStream(const GURL& url, 69 int InitializeStream(const GURL& url,
69 RequestPriority request_priority, 70 RequestPriority request_priority,
70 const BoundNetLog& stream_net_log); 71 const BoundNetLog& stream_net_log);
71 72
72 int SendRequest(scoped_ptr<SpdyHeaderBlock> headers); 73 int SendRequest(scoped_ptr<SpdyHeaderBlock> headers);
73 int SendData(const char* data, int length); 74 int SendData(const char* data, int length);
74 void Close(); 75 void Close();
75 76
76 // SpdyStream::Delegate 77 // SpdyStream::Delegate
77 virtual void OnSendRequestHeadersComplete() OVERRIDE; 78 virtual void OnRequestHeadersSent() OVERRIDE;
78 virtual void OnSendBody() OVERRIDE; 79 virtual int OnResponseHeadersReceived(const SpdyHeaderBlock& response,
79 virtual void OnSendBodyComplete() OVERRIDE; 80 base::Time response_time,
80 virtual int OnResponseReceived(const SpdyHeaderBlock& response, 81 int status) OVERRIDE;
81 base::Time response_time,
82 int status) OVERRIDE;
83 virtual int OnDataReceived(scoped_ptr<SpdyBuffer> buffer) OVERRIDE; 82 virtual int OnDataReceived(scoped_ptr<SpdyBuffer> buffer) OVERRIDE;
84 virtual void OnDataSent() OVERRIDE; 83 virtual void OnDataSent() OVERRIDE;
85 virtual void OnClose(int status) OVERRIDE; 84 virtual void OnClose(int status) OVERRIDE;
86 85
87 private: 86 private:
88 friend class SpdyWebSocketStreamSpdy2Test; 87 friend class SpdyWebSocketStreamSpdy2Test;
89 friend class SpdyWebSocketStreamSpdy3Test; 88 friend class SpdyWebSocketStreamSpdy3Test;
90 FRIEND_TEST_ALL_PREFIXES(SpdyWebSocketStreamSpdy2Test, Basic); 89 FRIEND_TEST_ALL_PREFIXES(SpdyWebSocketStreamSpdy2Test, Basic);
91 FRIEND_TEST_ALL_PREFIXES(SpdyWebSocketStreamSpdy3Test, Basic); 90 FRIEND_TEST_ALL_PREFIXES(SpdyWebSocketStreamSpdy3Test, Basic);
92 91
93 void OnSpdyStreamCreated(int status); 92 void OnSpdyStreamCreated(int status);
94 93
95 base::WeakPtrFactory<SpdyWebSocketStream> weak_ptr_factory_; 94 base::WeakPtrFactory<SpdyWebSocketStream> weak_ptr_factory_;
96 SpdyStreamRequest stream_request_; 95 SpdyStreamRequest stream_request_;
97 base::WeakPtr<SpdyStream> stream_; 96 base::WeakPtr<SpdyStream> stream_;
98 scoped_refptr<SpdySession> spdy_session_; 97 scoped_refptr<SpdySession> spdy_session_;
99 size_t pending_send_data_length_; 98 size_t pending_send_data_length_;
100 Delegate* delegate_; 99 Delegate* delegate_;
101 100
102 DISALLOW_COPY_AND_ASSIGN(SpdyWebSocketStream); 101 DISALLOW_COPY_AND_ASSIGN(SpdyWebSocketStream);
103 }; 102 };
104 103
105 } // namespace net 104 } // namespace net
106 105
107 #endif // NET_SPDY_SPDY_WEBSOCKET_STREAM_H_ 106 #endif // NET_SPDY_SPDY_WEBSOCKET_STREAM_H_
OLDNEW
« no previous file with comments | « net/spdy/spdy_stream_test_util.cc ('k') | net/spdy/spdy_websocket_stream.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698