| 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 CONTENT_CHILD_SOCKET_STREAM_DISPATCHER_H_ | 5 #ifndef CONTENT_CHILD_SOCKET_STREAM_DISPATCHER_H_ |
| 6 #define CONTENT_CHILD_SOCKET_STREAM_DISPATCHER_H_ | 6 #define CONTENT_CHILD_SOCKET_STREAM_DISPATCHER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
| 11 #include "base/compiler_specific.h" | 11 #include "base/compiler_specific.h" |
| 12 #include "ipc/ipc_listener.h" | 12 #include "ipc/ipc_listener.h" |
| 13 | 13 |
| 14 namespace blink { | 14 namespace blink { |
| 15 class WebSocketStreamHandle; | 15 class WebSocketStreamHandle; |
| 16 } | 16 } |
| 17 | 17 |
| 18 namespace webkit_glue { |
| 19 class WebSocketStreamHandleBridge; |
| 20 class WebSocketStreamHandleDelegate; |
| 21 } |
| 22 |
| 18 namespace content { | 23 namespace content { |
| 19 | 24 |
| 20 class WebSocketStreamHandleBridge; | |
| 21 class WebSocketStreamHandleDelegate; | |
| 22 | |
| 23 // Dispatches socket stream related messages sent to a child process from the | 25 // Dispatches socket stream related messages sent to a child process from the |
| 24 // main browser process. There is one instance per child process. Messages | 26 // main browser process. There is one instance per child process. Messages |
| 25 // are dispatched on the main child thread. The RenderThread class | 27 // are dispatched on the main child thread. The RenderThread class |
| 26 // creates an instance of SocketStreamDispatcher and delegates calls to it. | 28 // creates an instance of SocketStreamDispatcher and delegates calls to it. |
| 27 class SocketStreamDispatcher : public IPC::Listener { | 29 class SocketStreamDispatcher : public IPC::Listener { |
| 28 public: | 30 public: |
| 29 SocketStreamDispatcher(); | 31 SocketStreamDispatcher(); |
| 30 virtual ~SocketStreamDispatcher() {} | 32 virtual ~SocketStreamDispatcher() {} |
| 31 | 33 |
| 32 static WebSocketStreamHandleBridge* CreateBridge( | 34 static webkit_glue::WebSocketStreamHandleBridge* CreateBridge( |
| 33 blink::WebSocketStreamHandle* handle, | 35 blink::WebSocketStreamHandle* handle, |
| 34 WebSocketStreamHandleDelegate* delegate); | 36 webkit_glue::WebSocketStreamHandleDelegate* delegate); |
| 35 | 37 |
| 36 // IPC::Listener implementation. | 38 // IPC::Listener implementation. |
| 37 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; | 39 virtual bool OnMessageReceived(const IPC::Message& msg) OVERRIDE; |
| 38 | 40 |
| 39 private: | 41 private: |
| 40 void OnConnected(int socket_id, int max_amount_send_allowed); | 42 void OnConnected(int socket_id, int max_amount_send_allowed); |
| 41 void OnSentData(int socket_id, int amount_sent); | 43 void OnSentData(int socket_id, int amount_sent); |
| 42 void OnReceivedData(int socket_id, const std::vector<char>& data); | 44 void OnReceivedData(int socket_id, const std::vector<char>& data); |
| 43 void OnClosed(int socket_id); | 45 void OnClosed(int socket_id); |
| 44 void OnFailed(int socket_id, int error_code); | 46 void OnFailed(int socket_id, int error_code); |
| 45 | 47 |
| 46 DISALLOW_COPY_AND_ASSIGN(SocketStreamDispatcher); | 48 DISALLOW_COPY_AND_ASSIGN(SocketStreamDispatcher); |
| 47 }; | 49 }; |
| 48 | 50 |
| 49 } // namespace content | 51 } // namespace content |
| 50 | 52 |
| 51 #endif // CONTENT_CHILD_SOCKET_STREAM_DISPATCHER_H_ | 53 #endif // CONTENT_CHILD_SOCKET_STREAM_DISPATCHER_H_ |
| OLD | NEW |