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

Side by Side Diff: net/websockets/websocket_event_interface.h

Issue 2267233002: Change WebSocketChannel to pass data via IOBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Make it const char* Created 4 years, 2 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
« no previous file with comments | « net/websockets/websocket_end_to_end_test.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_ 5 #ifndef NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_
6 #define NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_ 6 #define NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <memory> 10 #include <memory>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/compiler_specific.h" // for WARN_UNUSED_RESULT 14 #include "base/compiler_specific.h" // for WARN_UNUSED_RESULT
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ref_counted.h"
16 #include "net/base/net_export.h" 17 #include "net/base/net_export.h"
17 18
18 class GURL; 19 class GURL;
19 20
20 namespace net { 21 namespace net {
21 22
23 class IOBuffer;
22 class SSLInfo; 24 class SSLInfo;
23 struct WebSocketHandshakeRequestInfo; 25 struct WebSocketHandshakeRequestInfo;
24 struct WebSocketHandshakeResponseInfo; 26 struct WebSocketHandshakeResponseInfo;
25 27
26 // Interface for events sent from the network layer to the content layer. These 28 // Interface for events sent from the network layer to the content layer. These
27 // events will generally be sent as-is to the renderer process. 29 // events will generally be sent as-is to the renderer process.
28 class NET_EXPORT WebSocketEventInterface { 30 class NET_EXPORT WebSocketEventInterface {
29 public: 31 public:
30 typedef int WebSocketMessageType; 32 typedef int WebSocketMessageType;
31 33
32 // Any event can cause the Channel to be deleted. The Channel needs to avoid 34 // Any event can cause the Channel to be deleted. The Channel needs to avoid
33 // doing further processing in this case. It does not need to do cleanup, as 35 // doing further processing in this case. It does not need to do cleanup, as
34 // cleanup will already have been done as a result of the deletion. 36 // cleanup will already have been done as a result of the deletion.
35 enum ChannelState { 37 enum ChannelState {
36 CHANNEL_ALIVE, 38 CHANNEL_ALIVE,
37 CHANNEL_DELETED 39 CHANNEL_DELETED
38 }; 40 };
39 41
40 virtual ~WebSocketEventInterface() {} 42 virtual ~WebSocketEventInterface() {}
41 43
42 // Called in response to an AddChannelRequest. This means that a response has 44 // Called in response to an AddChannelRequest. This means that a response has
43 // been received from the remote server. 45 // been received from the remote server.
44 virtual ChannelState OnAddChannelResponse( 46 virtual ChannelState OnAddChannelResponse(
45 const std::string& selected_subprotocol, 47 const std::string& selected_subprotocol,
46 const std::string& extensions) WARN_UNUSED_RESULT = 0; 48 const std::string& extensions) WARN_UNUSED_RESULT = 0;
47 49
48 // Called when a data frame has been received from the remote host and needs 50 // Called when a data frame has been received from the remote host and needs
49 // to be forwarded to the renderer process. 51 // to be forwarded to the renderer process.
50 virtual ChannelState OnDataFrame( 52 virtual ChannelState OnDataFrame(bool fin,
51 bool fin, 53 WebSocketMessageType type,
52 WebSocketMessageType type, 54 scoped_refptr<IOBuffer> buffer,
53 const std::vector<char>& data) WARN_UNUSED_RESULT = 0; 55 size_t buffer_size) WARN_UNUSED_RESULT = 0;
54 56
55 // Called to provide more send quota for this channel to the renderer 57 // Called to provide more send quota for this channel to the renderer
56 // process. Currently the quota units are always bytes of message body 58 // process. Currently the quota units are always bytes of message body
57 // data. In future it might depend on the type of multiplexing in use. 59 // data. In future it might depend on the type of multiplexing in use.
58 virtual ChannelState OnFlowControl(int64_t quota) WARN_UNUSED_RESULT = 0; 60 virtual ChannelState OnFlowControl(int64_t quota) WARN_UNUSED_RESULT = 0;
59 61
60 // Called when the remote server has Started the WebSocket Closing 62 // Called when the remote server has Started the WebSocket Closing
61 // Handshake. The client should not attempt to send any more messages after 63 // Handshake. The client should not attempt to send any more messages after
62 // receiving this message. It will be followed by OnDropChannel() when the 64 // receiving this message. It will be followed by OnDropChannel() when the
63 // closing handshake is complete. 65 // closing handshake is complete.
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 protected: 134 protected:
133 WebSocketEventInterface() {} 135 WebSocketEventInterface() {}
134 136
135 private: 137 private:
136 DISALLOW_COPY_AND_ASSIGN(WebSocketEventInterface); 138 DISALLOW_COPY_AND_ASSIGN(WebSocketEventInterface);
137 }; 139 };
138 140
139 } // namespace net 141 } // namespace net
140 142
141 #endif // NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_ 143 #endif // NET_WEBSOCKETS_WEBSOCKET_EVENT_INTERFACE_H_
OLDNEW
« no previous file with comments | « net/websockets/websocket_end_to_end_test.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698