| OLD | NEW |
| 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 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 | 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 CHROME_RENDERER_WEBSHAREDWORKER_PROXY_H_ | 5 #ifndef CHROME_RENDERER_WEBSHAREDWORKER_PROXY_H_ |
| 6 #define CHROME_RENDERER_WEBSHAREDWORKER_PROXY_H_ | 6 #define CHROME_RENDERER_WEBSHAREDWORKER_PROXY_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "chrome/renderer/webworker_base.h" | 9 #include "chrome/renderer/webworker_base.h" |
| 10 #include "googleurl/src/gurl.h" | 10 #include "googleurl/src/gurl.h" |
| 11 #include "third_party/WebKit/WebKit/chromium/public/WebSharedWorker.h" | 11 #include "third_party/WebKit/WebKit/chromium/public/WebSharedWorker.h" |
| 12 | 12 |
| 13 class ChildThread; | 13 class ChildThread; |
| 14 | 14 |
| 15 // Implementation of the WebSharedWorker APIs. This object is intended to only | 15 // Implementation of the WebSharedWorker APIs. This object is intended to only |
| 16 // live long enough to allow the caller to send a "connect" event to the worker | 16 // live long enough to allow the caller to send a "connect" event to the worker |
| 17 // thread. Once the connect event has been sent, all future communication will | 17 // thread. Once the connect event has been sent, all future communication will |
| 18 // happen via the WebMessagePortChannel, and the WebSharedWorker instance will | 18 // happen via the WebMessagePortChannel, and the WebSharedWorker instance will |
| 19 // be freed. | 19 // be freed. |
| 20 class WebSharedWorkerProxy : public WebKit::WebSharedWorker, | 20 class WebSharedWorkerProxy : public WebKit::WebSharedWorker, |
| 21 private WebWorkerBase { | 21 private WebWorkerBase { |
| 22 public: | 22 public: |
| 23 // If the worker not loaded yet, route_id == MSG_ROUTING_NONE | 23 // If the worker not loaded yet, route_id == MSG_ROUTING_NONE |
| 24 WebSharedWorkerProxy(ChildThread* child_thread, | 24 WebSharedWorkerProxy(ChildThread* child_thread, |
| 25 unsigned long long document_id, |
| 25 int route_id, | 26 int route_id, |
| 26 int render_view_route_id); | 27 int render_view_route_id); |
| 27 | 28 |
| 28 // Implementations of WebSharedWorker APIs | 29 // Implementations of WebSharedWorker APIs |
| 29 virtual bool isStarted(); | 30 virtual bool isStarted(); |
| 30 virtual void connect(WebKit::WebMessagePortChannel* channel, | 31 virtual void connect(WebKit::WebMessagePortChannel* channel, |
| 31 ConnectListener* listener); | 32 ConnectListener* listener); |
| 32 virtual void startWorkerContext(const WebKit::WebURL& script_url, | 33 virtual void startWorkerContext(const WebKit::WebURL& script_url, |
| 33 const WebKit::WebString& name, | 34 const WebKit::WebString& name, |
| 34 const WebKit::WebString& user_agent, | 35 const WebKit::WebString& user_agent, |
| 35 const WebKit::WebString& source_code); | 36 const WebKit::WebString& source_code); |
| 36 virtual void terminateWorkerContext(); | 37 virtual void terminateWorkerContext(); |
| 37 virtual void clientDestroyed(); | 38 virtual void clientDestroyed(); |
| 38 | 39 |
| 39 // IPC::Channel::Listener implementation. | 40 // IPC::Channel::Listener implementation. |
| 40 void OnMessageReceived(const IPC::Message& message); | 41 void OnMessageReceived(const IPC::Message& message); |
| 41 | 42 |
| 42 private: | 43 private: |
| 43 void OnWorkerCreated(); | 44 void OnWorkerCreated(); |
| 44 | 45 |
| 45 ConnectListener* connect_listener_; | 46 ConnectListener* connect_listener_; |
| 46 | 47 |
| 47 DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerProxy); | 48 DISALLOW_COPY_AND_ASSIGN(WebSharedWorkerProxy); |
| 48 }; | 49 }; |
| 49 | 50 |
| 50 #endif // CHROME_RENDERER_WEBSHAREDWORKER_PROXY_H_ | 51 #endif // CHROME_RENDERER_WEBSHAREDWORKER_PROXY_H_ |
| OLD | NEW |