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_WEBWORKER_PROXY_H_ |
| 6 #define CHROME_RENDERER_WEBWORKER_PROXY_H_ |
| 7 |
| 8 #include "base/basictypes.h" |
| 9 #include "chrome/common/ipc_channel.h" |
| 10 #include "webkit/glue/webworker.h" |
| 11 |
| 12 class GURL; |
| 13 class RenderView; |
| 14 |
| 15 namespace IPC { |
| 16 class Message; |
| 17 } |
| 18 |
| 19 // This class provides an implementation of WebWorker that the renderer provides |
| 20 // to the glue. This class converts function calls to IPC messages that are |
| 21 // dispatched in the worker process by WebWorkerClientProxy. It also receives |
| 22 // IPC messages from WebWorkerClientProxy which it converts to function calls to |
| 23 // WebWorkerClient. |
| 24 class WebWorkerProxy : public WebWorker, |
| 25 public IPC::Channel::Listener { |
| 26 public: |
| 27 WebWorkerProxy(IPC::Message::Sender* sender, WebWorkerClient* client); |
| 28 virtual ~WebWorkerProxy(); |
| 29 |
| 30 // WebWorker implementation. |
| 31 // These functions are called by WebKit (after the data types have been |
| 32 // converted by glue code). |
| 33 virtual void StartWorkerContext(const GURL& script_url, |
| 34 const string16& user_agent, |
| 35 const string16& source_code); |
| 36 virtual void TerminateWorkerContext(); |
| 37 virtual void PostMessageToWorkerContext(const string16& message); |
| 38 virtual void WorkerObjectDestroyed(); |
| 39 |
| 40 // IPC::Channel::Listener implementation. |
| 41 void OnMessageReceived(const IPC::Message& message); |
| 42 |
| 43 private: |
| 44 bool Send(IPC::Message* message); |
| 45 |
| 46 IPC::Message::Sender* sender_; |
| 47 int route_id_; |
| 48 |
| 49 // Used to communicate to the WebCore::Worker object in response to IPC |
| 50 // messages. |
| 51 WebWorkerClient* client_; |
| 52 |
| 53 DISALLOW_COPY_AND_ASSIGN(WebWorkerProxy); |
| 54 }; |
| 55 |
| 56 #endif // CHROME_RENDERER_WEBWORKER_PROXY_H_ |
OLD | NEW |