Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: chrome/renderer/webworker_proxy.h

Issue 390017: Added lifecycle management and sharing support for SharedWorkers. SharedWorkers (Closed)
Patch Set: Changed WebWorkerBase not not call a virtual function from the destructor Created 11 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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_WEBWORKER_PROXY_H_ 5 #ifndef CHROME_RENDERER_WEBWORKER_PROXY_H_
6 #define CHROME_RENDERER_WEBWORKER_PROXY_H_ 6 #define CHROME_RENDERER_WEBWORKER_PROXY_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
11 #include "chrome/renderer/webworker_base.h" 11 #include "chrome/renderer/webworker_base.h"
12 #include "ipc/ipc_channel.h" 12 #include "ipc/ipc_channel.h"
13 #include "third_party/WebKit/WebKit/chromium/public/WebWorker.h" 13 #include "third_party/WebKit/WebKit/chromium/public/WebWorker.h"
14 14
15 class ChildThread; 15 class ChildThread;
16 class GURL; 16 class GURL;
17 class RenderView; 17 class RenderView;
18 struct WorkerHostMsg_PostConsoleMessageToWorkerObject_Params; 18 struct WorkerHostMsg_PostConsoleMessageToWorkerObject_Params;
19 19
20 // This class provides an implementation of WebWorker that the renderer provides 20 // This class provides an implementation of WebWorker that the renderer provides
21 // to the glue. This class converts function calls to IPC messages that are 21 // to the glue. This class converts function calls to IPC messages that are
22 // dispatched in the worker process by WebWorkerClientProxy. It also receives 22 // dispatched in the worker process by WebWorkerClientProxy. It also receives
23 // IPC messages from WebWorkerClientProxy which it converts to function calls to 23 // IPC messages from WebWorkerClientProxy which it converts to function calls to
24 // WebWorkerClient. 24 // WebWorkerClient.
25 class WebWorkerProxy : public WebKit::WebWorker, private WebWorkerBase { 25 class WebWorkerProxy : public WebKit::WebWorker, private WebWorkerBase {
26 public: 26 public:
27 WebWorkerProxy(WebKit::WebWorkerClient* client, 27 WebWorkerProxy(WebKit::WebWorkerClient* client,
28 ChildThread* child_thread, 28 ChildThread* child_thread,
29 int render_view_route_id); 29 int render_view_route_id);
30 ~WebWorkerProxy();
30 31
31 // WebWorker implementation. 32 // WebWorker implementation.
32 virtual void startWorkerContext(const WebKit::WebURL& script_url, 33 virtual void startWorkerContext(const WebKit::WebURL& script_url,
33 const WebKit::WebString& user_agent, 34 const WebKit::WebString& user_agent,
34 const WebKit::WebString& source_code); 35 const WebKit::WebString& source_code);
35 virtual void terminateWorkerContext(); 36 virtual void terminateWorkerContext();
36 virtual void postMessageToWorkerContext( 37 virtual void postMessageToWorkerContext(
37 const WebKit::WebString& message, 38 const WebKit::WebString& message,
38 const WebKit::WebMessagePortChannelArray& channel_array); 39 const WebKit::WebMessagePortChannelArray& channel_array);
39 virtual void workerObjectDestroyed(); 40 virtual void workerObjectDestroyed();
40 virtual void clientDestroyed(); 41 virtual void clientDestroyed();
41 42
42 // IPC::Channel::Listener implementation. 43 // IPC::Channel::Listener implementation.
43 void OnMessageReceived(const IPC::Message& message); 44 void OnMessageReceived(const IPC::Message& message);
44 45
45 private: 46 private:
46 virtual void Disconnect(); 47 void CancelCreation();
47
48 void OnWorkerCreated(); 48 void OnWorkerCreated();
49 void OnWorkerContextDestroyed(); 49 void OnWorkerContextDestroyed();
50 void OnPostMessage(const string16& message, 50 void OnPostMessage(const string16& message,
51 const std::vector<int>& sent_message_port_ids, 51 const std::vector<int>& sent_message_port_ids,
52 const std::vector<int>& new_routing_ids); 52 const std::vector<int>& new_routing_ids);
53 void OnPostConsoleMessageToWorkerObject( 53 void OnPostConsoleMessageToWorkerObject(
54 const WorkerHostMsg_PostConsoleMessageToWorkerObject_Params& params); 54 const WorkerHostMsg_PostConsoleMessageToWorkerObject_Params& params);
55 55
56 56
57 // Used to communicate to the WebCore::Worker object in response to IPC 57 // Used to communicate to the WebCore::Worker object in response to IPC
58 // messages. 58 // messages.
59 WebKit::WebWorkerClient* client_; 59 WebKit::WebWorkerClient* client_;
60 60
61 DISALLOW_COPY_AND_ASSIGN(WebWorkerProxy); 61 DISALLOW_COPY_AND_ASSIGN(WebWorkerProxy);
62 }; 62 };
63 63
64 #endif // CHROME_RENDERER_WEBWORKER_PROXY_H_ 64 #endif // CHROME_RENDERER_WEBWORKER_PROXY_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698