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 #include "content/common/socket_stream_dispatcher.h" | 5 #include "content/common/socket_stream_dispatcher.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/id_map.h" | 10 #include "base/id_map.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 webkit_glue::WebSocketStreamHandleDelegate* delegate) | 32 webkit_glue::WebSocketStreamHandleDelegate* delegate) |
33 : socket_id_(kNoSocketId), | 33 : socket_id_(kNoSocketId), |
34 child_thread_(child_thread), | 34 child_thread_(child_thread), |
35 handle_(handle), | 35 handle_(handle), |
36 delegate_(delegate) {} | 36 delegate_(delegate) {} |
37 | 37 |
38 // Returns the handle having given id or NULL if there is no such handle. | 38 // Returns the handle having given id or NULL if there is no such handle. |
39 static IPCWebSocketStreamHandleBridge* FromSocketId(int id); | 39 static IPCWebSocketStreamHandleBridge* FromSocketId(int id); |
40 | 40 |
41 // webkit_glue::WebSocketStreamHandleBridge methods. | 41 // webkit_glue::WebSocketStreamHandleBridge methods. |
42 virtual void Connect(const GURL& url); | 42 virtual void Connect(const GURL& url) OVERRIDE; |
43 virtual bool Send(const std::vector<char>& data); | 43 virtual bool Send(const std::vector<char>& data) OVERRIDE; |
44 virtual void Close(); | 44 virtual void Close() OVERRIDE; |
45 | 45 |
46 // Called by SocketStreamDispatcher. | 46 // Called by SocketStreamDispatcher. |
47 void OnConnected(int max_amount_send_allowed); | 47 void OnConnected(int max_amount_send_allowed); |
48 void OnSentData(int amount_sent); | 48 void OnSentData(int amount_sent); |
49 void OnReceivedData(const std::vector<char>& data); | 49 void OnReceivedData(const std::vector<char>& data); |
50 void OnClosed(); | 50 void OnClosed(); |
51 | 51 |
52 private: | 52 private: |
53 virtual ~IPCWebSocketStreamHandleBridge(); | 53 virtual ~IPCWebSocketStreamHandleBridge(); |
54 | 54 |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
228 void SocketStreamDispatcher::OnClosed(int socket_id) { | 228 void SocketStreamDispatcher::OnClosed(int socket_id) { |
229 IPCWebSocketStreamHandleBridge* bridge = | 229 IPCWebSocketStreamHandleBridge* bridge = |
230 IPCWebSocketStreamHandleBridge::FromSocketId(socket_id); | 230 IPCWebSocketStreamHandleBridge::FromSocketId(socket_id); |
231 if (bridge) | 231 if (bridge) |
232 bridge->OnClosed(); | 232 bridge->OnClosed(); |
233 else | 233 else |
234 DLOG(ERROR) << "No SocketStreamHandleBridge for socket_id=" << socket_id; | 234 DLOG(ERROR) << "No SocketStreamHandleBridge for socket_id=" << socket_id; |
235 } | 235 } |
236 | 236 |
237 } // namespace content | 237 } // namespace content |
OLD | NEW |