diff options
author | ukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-29 06:18:11 +0000 |
---|---|---|
committer | ukai@chromium.org <ukai@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-10-29 06:18:11 +0000 |
commit | 327344ef227af4c66b42cb7e948d4c4096eab83f (patch) | |
tree | e66b340b198dcd9ed8db57ae067eb9fd8d11c26b /chrome/renderer/socket_stream_dispatcher.h | |
parent | 50220030753d7d0ba1fcea95e5f889033bdeb382 (diff) | |
download | chromium_src-327344ef227af4c66b42cb7e948d4c4096eab83f.zip chromium_src-327344ef227af4c66b42cb7e948d4c4096eab83f.tar.gz chromium_src-327344ef227af4c66b42cb7e948d4c4096eab83f.tar.bz2 |
WebSocket support in chromium.
Run with --enable-web-sockets enables WebSocket features.
BUG=12497
TEST=none
Review URL: http://codereview.chromium.org/292044
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30440 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/renderer/socket_stream_dispatcher.h')
-rw-r--r-- | chrome/renderer/socket_stream_dispatcher.h | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/chrome/renderer/socket_stream_dispatcher.h b/chrome/renderer/socket_stream_dispatcher.h new file mode 100644 index 0000000..5399030 --- /dev/null +++ b/chrome/renderer/socket_stream_dispatcher.h @@ -0,0 +1,38 @@ +// Copyright (c) 2009 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef CHROME_RENDERER_SOCKET_STREAM_DISPATCHER_H_ +#define CHROME_RENDERER_SOCKET_STREAM_DISPATCHER_H_ + +#include <vector> + +#include "base/basictypes.h" +#include "ipc/ipc_channel.h" +#include "ipc/ipc_message.h" +#include "webkit/glue/websocketstreamhandle_bridge.h" + +// Dispatches socket stream related messages sent to a child process from the +// main browser process. There is one instance per child process. Messages +// are dispatched on the main child thread. The RenderThread class +// creates an instance of SocketStreamDispatcher and delegates calls to it. +class SocketStreamDispatcher { + public: + SocketStreamDispatcher(); + ~SocketStreamDispatcher() {} + + static webkit_glue::WebSocketStreamHandleBridge* CreateBridge( + WebKit::WebSocketStreamHandle* handle, + webkit_glue::WebSocketStreamHandleDelegate* delegate); + bool OnMessageReceived(const IPC::Message& msg); + + private: + void OnConnected(int socket_id, int max_amount_send_allowed); + void OnSentData(int socket_id, int amount_sent); + void OnReceivedData(int socket_id, const std::vector<char>& data); + void OnClosed(int socket_id); + + DISALLOW_COPY_AND_ASSIGN(SocketStreamDispatcher); +}; + +#endif // CHROME_RENDERER_SOCKET_STREAM_DISPATCHER_H_ |