OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CHROME_RENDERER_SOCKET_STREAM_DISPATCHER_H_ |
| 6 #define CHROME_RENDERER_SOCKET_STREAM_DISPATCHER_H_ |
| 7 |
| 8 #include <vector> |
| 9 |
| 10 #include "base/basictypes.h" |
| 11 #include "ipc/ipc_channel.h" |
| 12 #include "ipc/ipc_message.h" |
| 13 #include "webkit/glue/websocketstreamhandle_bridge.h" |
| 14 |
| 15 // Dispatches socket stream related messages sent to a child process from the |
| 16 // main browser process. There is one instance per child process. Messages |
| 17 // are dispatched on the main child thread. The RenderThread class |
| 18 // creates an instance of SocketStreamDispatcher and delegates calls to it. |
| 19 class SocketStreamDispatcher { |
| 20 public: |
| 21 SocketStreamDispatcher(); |
| 22 ~SocketStreamDispatcher() {} |
| 23 |
| 24 static webkit_glue::WebSocketStreamHandleBridge* CreateBridge( |
| 25 WebKit::WebSocketStreamHandle* handle, |
| 26 webkit_glue::WebSocketStreamHandleDelegate* delegate); |
| 27 bool OnMessageReceived(const IPC::Message& msg); |
| 28 |
| 29 private: |
| 30 void OnConnected(int socket_id, int max_amount_send_allowed); |
| 31 void OnSentData(int socket_id, int amount_sent); |
| 32 void OnReceivedData(int socket_id, const std::vector<char>& data); |
| 33 void OnClosed(int socket_id); |
| 34 |
| 35 DISALLOW_COPY_AND_ASSIGN(SocketStreamDispatcher); |
| 36 }; |
| 37 |
| 38 #endif // CHROME_RENDERER_SOCKET_STREAM_DISPATCHER_H_ |
OLD | NEW |