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

Side by Side Diff: chrome/worker/webworkerclient_proxy.h

Issue 173193: Updating Worker.postMessage(), DOMWindow.postMessage(), and... (Closed) Base URL: http://src.chromium.org/svn/trunk/src/
Patch Set: '' Created 11 years, 3 months 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 | Annotate | Revision Log
« no previous file with comments | « chrome/worker/nativewebworker_impl.cc ('k') | chrome/worker/webworkerclient_proxy.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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_WORKER_WEBWORKERCLIENT_PROXY_H_ 5 #ifndef CHROME_WORKER_WEBWORKERCLIENT_PROXY_H_
6 #define CHROME_WORKER_WEBWORKERCLIENT_PROXY_H_ 6 #define CHROME_WORKER_WEBWORKERCLIENT_PROXY_H_
7 7
8 #include <vector>
9
8 #include "base/basictypes.h" 10 #include "base/basictypes.h"
9 #include "googleurl/src/gurl.h" 11 #include "googleurl/src/gurl.h"
10 #include "ipc/ipc_channel.h" 12 #include "ipc/ipc_channel.h"
11 #include "webkit/api/public/WebWorkerClient.h" 13 #include "webkit/api/public/WebWorkerClient.h"
12 14
13 namespace WebKit { 15 namespace WebKit {
14 class WebWorker; 16 class WebWorker;
15 } 17 }
16 18
17 // This class receives IPCs from the renderer and calls the WebCore::Worker 19 // This class receives IPCs from the renderer and calls the WebCore::Worker
18 // implementation (after the data types have been converted by glue code). It 20 // implementation (after the data types have been converted by glue code). It
19 // is also called by the worker code and converts these function calls into 21 // is also called by the worker code and converts these function calls into
20 // IPCs that are sent to the renderer, where they're converted back to function 22 // IPCs that are sent to the renderer, where they're converted back to function
21 // calls by WebWorkerProxy. 23 // calls by WebWorkerProxy.
22 class WebWorkerClientProxy : public WebKit::WebWorkerClient, 24 class WebWorkerClientProxy : public WebKit::WebWorkerClient,
23 public IPC::Channel::Listener { 25 public IPC::Channel::Listener {
24 public: 26 public:
25 WebWorkerClientProxy(const GURL& url, int route_id); 27 WebWorkerClientProxy(const GURL& url, int route_id);
26 28
27 // WebWorkerClient implementation. 29 // WebWorkerClient implementation.
28 virtual void postMessageToWorkerObject( 30 virtual void postMessageToWorkerObject(
29 const WebKit::WebString& message, 31 const WebKit::WebString& message,
30 WebKit::WebMessagePortChannel* channel); 32 const WebKit::WebMessagePortChannelArray& channel);
31 virtual void postExceptionToWorkerObject( 33 virtual void postExceptionToWorkerObject(
32 const WebKit::WebString& error_message, 34 const WebKit::WebString& error_message,
33 int line_number, 35 int line_number,
34 const WebKit::WebString& source_url); 36 const WebKit::WebString& source_url);
35 virtual void postConsoleMessageToWorkerObject( 37 virtual void postConsoleMessageToWorkerObject(
36 int destination, 38 int destination,
37 int source, 39 int source,
38 int type, 40 int type,
39 int level, 41 int level,
40 const WebKit::WebString& message, 42 const WebKit::WebString& message,
41 int line_number, 43 int line_number,
42 const WebKit::WebString& source_url); 44 const WebKit::WebString& source_url);
43 virtual void confirmMessageFromWorkerObject(bool has_pending_activity); 45 virtual void confirmMessageFromWorkerObject(bool has_pending_activity);
44 virtual void reportPendingActivity(bool has_pending_activity); 46 virtual void reportPendingActivity(bool has_pending_activity);
45 virtual void workerContextDestroyed(); 47 virtual void workerContextDestroyed();
46 virtual WebKit::WebWorker* createWorker(WebKit::WebWorkerClient* client); 48 virtual WebKit::WebWorker* createWorker(WebKit::WebWorkerClient* client);
47 49
48 // IPC::Channel::Listener implementation. 50 // IPC::Channel::Listener implementation.
49 virtual void OnMessageReceived(const IPC::Message& message); 51 virtual void OnMessageReceived(const IPC::Message& message);
50 52
51 private: 53 private:
52 ~WebWorkerClientProxy (); 54 ~WebWorkerClientProxy();
53 55
54 bool Send(IPC::Message* message); 56 bool Send(IPC::Message* message);
55 57
56 void OnTerminateWorkerContext(); 58 void OnTerminateWorkerContext();
57 void OnPostMessage(const string16& message, 59 void OnPostMessage(const string16& message,
58 int sent_message_port_id, 60 const std::vector<int>& sent_message_port_ids,
59 int new_routing_id); 61 const std::vector<int>& new_routing_ids);
60 62
61 // The source url for this worker. 63 // The source url for this worker.
62 GURL url_; 64 GURL url_;
63 65
64 int route_id_; 66 int route_id_;
65 67
66 WebKit::WebWorker* impl_; 68 WebKit::WebWorker* impl_;
67 69
68 DISALLOW_COPY_AND_ASSIGN(WebWorkerClientProxy); 70 DISALLOW_COPY_AND_ASSIGN(WebWorkerClientProxy);
69 }; 71 };
70 72
71 #endif // CHROME_WORKER_WEBWORKERCLIENT_PROXY_H_ 73 #endif // CHROME_WORKER_WEBWORKERCLIENT_PROXY_H_
OLDNEW
« no previous file with comments | « chrome/worker/nativewebworker_impl.cc ('k') | chrome/worker/webworkerclient_proxy.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698