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

Side by Side Diff: webkit/glue/webworkerclient_impl.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 | « webkit/glue/webworker_impl.cc ('k') | webkit/glue/webworkerclient_impl.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 WEBKIT_GLUE_WEBWORKERCLIENT_IMPL_H_ 5 #ifndef WEBKIT_GLUE_WEBWORKERCLIENT_IMPL_H_
6 #define WEBKIT_GLUE_WEBWORKERCLIENT_IMPL_H_ 6 #define WEBKIT_GLUE_WEBWORKERCLIENT_IMPL_H_
7 7
8 #if ENABLE(WORKERS) 8 #if ENABLE(WORKERS)
9 9
10 #include "webkit/api/public/WebWorkerClient.h" 10 #include "webkit/api/public/WebWorkerClient.h"
11 11
12 #include "WorkerContextProxy.h" 12 #include "WorkerContextProxy.h"
13 #include <wtf/PassOwnPtr.h> 13 #include <wtf/PassOwnPtr.h>
14 #include <wtf/RefPtr.h> 14 #include <wtf/RefPtr.h>
15 15
16 namespace WebCore { 16 namespace WebCore {
17 class MessagePortChannel;
18 class ScriptExecutionContext; 17 class ScriptExecutionContext;
19 } 18 }
20 namespace WebKit { 19 namespace WebKit {
21 class WebWorker; 20 class WebWorker;
22 } 21 }
23 22
24 // The purpose of this class is to provide a WorkerContextProxy 23 // The purpose of this class is to provide a WorkerContextProxy
25 // implementation that we can give to WebKit. Internally, it converts the 24 // implementation that we can give to WebKit. Internally, it converts the
26 // data types to Chrome compatible ones so that renderer code can use it over 25 // data types to Chrome compatible ones so that renderer code can use it over
27 // IPC. 26 // IPC.
28 class WebWorkerClientImpl : public WebCore::WorkerContextProxy, 27 class WebWorkerClientImpl : public WebCore::WorkerContextProxy,
29 public WebKit::WebWorkerClient { 28 public WebKit::WebWorkerClient {
30 public: 29 public:
31 WebWorkerClientImpl(WebCore::Worker* worker); 30 WebWorkerClientImpl(WebCore::Worker* worker);
32 31
33 void set_webworker(WebKit::WebWorker* webworker); 32 void set_webworker(WebKit::WebWorker* webworker);
34 33
35 // WebCore::WorkerContextProxy methods: 34 // WebCore::WorkerContextProxy methods:
36 // These are called on the thread that created the worker. In the renderer 35 // These are called on the thread that created the worker. In the renderer
37 // process, this will be the main WebKit thread. In the worker process, this 36 // process, this will be the main WebKit thread. In the worker process, this
38 // will be the thread of the executing worker (not the main WebKit thread). 37 // will be the thread of the executing worker (not the main WebKit thread).
39 virtual void startWorkerContext(const WebCore::KURL& script_url, 38 virtual void startWorkerContext(const WebCore::KURL& script_url,
40 const WebCore::String& user_agent, 39 const WebCore::String& user_agent,
41 const WebCore::String& source_code); 40 const WebCore::String& source_code);
42 virtual void terminateWorkerContext(); 41 virtual void terminateWorkerContext();
43 virtual void postMessageToWorkerContext( 42 virtual void postMessageToWorkerContext(
44 const WebCore::String& message, 43 const WebCore::String& message,
45 WTF::PassOwnPtr<WebCore::MessagePortChannel> channel); 44 WTF::PassOwnPtr<WebCore::MessagePortChannelArray> channels);
46 virtual bool hasPendingActivity() const; 45 virtual bool hasPendingActivity() const;
47 virtual void workerObjectDestroyed(); 46 virtual void workerObjectDestroyed();
48 47
49 // WebWorkerClient methods: 48 // WebWorkerClient methods:
50 // These are called on the main WebKit thread. 49 // These are called on the main WebKit thread.
51 virtual void postMessageToWorkerObject( 50 virtual void postMessageToWorkerObject(
52 const WebKit::WebString& message, 51 const WebKit::WebString& message,
53 WebKit::WebMessagePortChannel* channel); 52 const WebKit::WebMessagePortChannelArray& channels);
54 virtual void postExceptionToWorkerObject( 53 virtual void postExceptionToWorkerObject(
55 const WebKit::WebString& error_message, 54 const WebKit::WebString& error_message,
56 int line_number, 55 int line_number,
57 const WebKit::WebString& source_url); 56 const WebKit::WebString& source_url);
58 virtual void postConsoleMessageToWorkerObject( 57 virtual void postConsoleMessageToWorkerObject(
59 int destination_id, 58 int destination_id,
60 int source_id, 59 int source_id,
61 int message_type, 60 int message_type,
62 int message_level, 61 int message_level,
63 const WebKit::WebString& message, 62 const WebKit::WebString& message,
(...skipping 18 matching lines...) Expand all
82 const WebCore::String& script_url, 81 const WebCore::String& script_url,
83 const WebCore::String& user_agent, 82 const WebCore::String& user_agent,
84 const WebCore::String& source_code); 83 const WebCore::String& source_code);
85 static void TerminateWorkerContextTask( 84 static void TerminateWorkerContextTask(
86 WebCore::ScriptExecutionContext* context, 85 WebCore::ScriptExecutionContext* context,
87 WebWorkerClientImpl* this_ptr); 86 WebWorkerClientImpl* this_ptr);
88 static void PostMessageToWorkerContextTask( 87 static void PostMessageToWorkerContextTask(
89 WebCore::ScriptExecutionContext* context, 88 WebCore::ScriptExecutionContext* context,
90 WebWorkerClientImpl* this_ptr, 89 WebWorkerClientImpl* this_ptr,
91 const WebCore::String& message, 90 const WebCore::String& message,
92 WTF::PassOwnPtr<WebCore::MessagePortChannel> channel); 91 WTF::PassOwnPtr<WebCore::MessagePortChannelArray> channels);
93 static void WorkerObjectDestroyedTask( 92 static void WorkerObjectDestroyedTask(
94 WebCore::ScriptExecutionContext* context, 93 WebCore::ScriptExecutionContext* context,
95 WebWorkerClientImpl* this_ptr); 94 WebWorkerClientImpl* this_ptr);
96 95
97 // These tasks are dispatched on the thread that created the worker (i.e. 96 // These tasks are dispatched on the thread that created the worker (i.e.
98 // main WebKit thread in renderer process, and the worker thread in the worker 97 // main WebKit thread in renderer process, and the worker thread in the worker
99 // process). 98 // process).
100 static void PostMessageToWorkerObjectTask( 99 static void PostMessageToWorkerObjectTask(
101 WebCore::ScriptExecutionContext* context, 100 WebCore::ScriptExecutionContext* context,
102 WebWorkerClientImpl* this_ptr, 101 WebWorkerClientImpl* this_ptr,
103 const WebCore::String& message, 102 const WebCore::String& message,
104 WTF::PassOwnPtr<WebCore::MessagePortChannel> channel); 103 WTF::PassOwnPtr<WebCore::MessagePortChannelArray> channels);
105 static void PostExceptionToWorkerObjectTask( 104 static void PostExceptionToWorkerObjectTask(
106 WebCore::ScriptExecutionContext* context, 105 WebCore::ScriptExecutionContext* context,
107 WebWorkerClientImpl* this_ptr, 106 WebWorkerClientImpl* this_ptr,
108 const WebCore::String& error_message, 107 const WebCore::String& error_message,
109 int line_number, 108 int line_number,
110 const WebCore::String& source_url); 109 const WebCore::String& source_url);
111 static void PostConsoleMessageToWorkerObjectTask( 110 static void PostConsoleMessageToWorkerObjectTask(
112 WebCore::ScriptExecutionContext* context, 111 WebCore::ScriptExecutionContext* context,
113 WebWorkerClientImpl* this_ptr, 112 WebWorkerClientImpl* this_ptr,
114 int destination_id, 113 int destination_id,
(...skipping 18 matching lines...) Expand all
133 WebKit::WebWorker* webworker_; 132 WebKit::WebWorker* webworker_;
134 bool asked_to_terminate_; 133 bool asked_to_terminate_;
135 uint32 unconfirmed_message_count_; 134 uint32 unconfirmed_message_count_;
136 bool worker_context_had_pending_activity_; 135 bool worker_context_had_pending_activity_;
137 WTF::ThreadIdentifier worker_thread_id_; 136 WTF::ThreadIdentifier worker_thread_id_;
138 }; 137 };
139 138
140 #endif 139 #endif
141 140
142 #endif // WEBKIT_GLUE_WEBWORKERCLIENT_IMPL_H_ 141 #endif // WEBKIT_GLUE_WEBWORKERCLIENT_IMPL_H_
OLDNEW
« no previous file with comments | « webkit/glue/webworker_impl.cc ('k') | webkit/glue/webworkerclient_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698