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

Side by Side Diff: webkit/glue/webworker_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, 4 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/api/src/PlatformMessagePortChannel.cpp ('k') | webkit/glue/webworker_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_WEBWORKER_IMPL_H_ 5 #ifndef WEBKIT_GLUE_WEBWORKER_IMPL_H_
6 #define WEBKIT_GLUE_WEBWORKER_IMPL_H_ 6 #define WEBKIT_GLUE_WEBWORKER_IMPL_H_
7 7
8 #include "webkit/api/public/WebWorker.h" 8 #include "webkit/api/public/WebWorker.h"
9 9
10 #if ENABLE(WORKERS) 10 #if ENABLE(WORKERS)
11 11
12 #include "ScriptExecutionContext.h" 12 #include "ScriptExecutionContext.h"
13 #include "WorkerLoaderProxy.h" 13 #include "WorkerLoaderProxy.h"
14 #include "WorkerObjectProxy.h" 14 #include "WorkerObjectProxy.h"
15 #include <wtf/PassOwnPtr.h> 15 #include <wtf/PassOwnPtr.h>
16 #include <wtf/RefPtr.h> 16 #include <wtf/RefPtr.h>
17 17
18 namespace WebCore { 18 namespace WebCore {
19 class Strng;
20 class MessagePortChannel;
21 class WorkerThread; 19 class WorkerThread;
22 }; 20 };
23 21
24 class WebView; 22 class WebView;
25 23
26 // This class is used by the worker process code to talk to the WebCore::Worker 24 // This class is used by the worker process code to talk to the WebCore::Worker
27 // implementation. It can't use it directly since it uses WebKit types, so this 25 // implementation. It can't use it directly since it uses WebKit types, so this
28 // class converts the data types. When the WebCore::Worker object wants to call 26 // class converts the data types. When the WebCore::Worker object wants to call
29 // WebCore::WorkerObjectProxy, this class will conver to Chrome data types first 27 // WebCore::WorkerObjectProxy, this class will conver to Chrome data types first
30 // and then call the supplied WebWorkerClient. 28 // and then call the supplied WebWorkerClient.
31 class WebWorkerImpl: public WebCore::WorkerObjectProxy, 29 class WebWorkerImpl: public WebCore::WorkerObjectProxy,
32 public WebCore::WorkerLoaderProxy, 30 public WebCore::WorkerLoaderProxy,
33 public WebKit::WebWorker { 31 public WebKit::WebWorker {
34 public: 32 public:
35 explicit WebWorkerImpl(WebKit::WebWorkerClient* client); 33 explicit WebWorkerImpl(WebKit::WebWorkerClient* client);
36 34
37 // WebCore::WorkerObjectProxy methods: 35 // WebCore::WorkerObjectProxy methods:
38 virtual void postMessageToWorkerObject( 36 virtual void postMessageToWorkerObject(
39 const WebCore::String& message, 37 const WebCore::String& message,
40 WTF::PassOwnPtr<WebCore::MessagePortChannel> channel); 38 WTF::PassOwnPtr<WebCore::MessagePortChannelArray> channels);
41 virtual void postExceptionToWorkerObject( 39 virtual void postExceptionToWorkerObject(
42 const WebCore::String& error_message, 40 const WebCore::String& error_message,
43 int line_number, 41 int line_number,
44 const WebCore::String& source_url); 42 const WebCore::String& source_url);
45 virtual void postConsoleMessageToWorkerObject( 43 virtual void postConsoleMessageToWorkerObject(
46 WebCore::MessageDestination destination, 44 WebCore::MessageDestination destination,
47 WebCore::MessageSource source, 45 WebCore::MessageSource source,
48 WebCore::MessageType type, 46 WebCore::MessageType type,
49 WebCore::MessageLevel level, 47 WebCore::MessageLevel level,
50 const WebCore::String& message, 48 const WebCore::String& message,
(...skipping 10 matching lines...) Expand all
61 WTF::PassRefPtr<WebCore::ScriptExecutionContext::Task>, 59 WTF::PassRefPtr<WebCore::ScriptExecutionContext::Task>,
62 const WebCore::String& mode); 60 const WebCore::String& mode);
63 61
64 // WebWorker methods: 62 // WebWorker methods:
65 virtual void startWorkerContext(const WebKit::WebURL& script_url, 63 virtual void startWorkerContext(const WebKit::WebURL& script_url,
66 const WebKit::WebString& user_agent, 64 const WebKit::WebString& user_agent,
67 const WebKit::WebString& source_code); 65 const WebKit::WebString& source_code);
68 virtual void terminateWorkerContext(); 66 virtual void terminateWorkerContext();
69 virtual void postMessageToWorkerContext( 67 virtual void postMessageToWorkerContext(
70 const WebKit::WebString& message, 68 const WebKit::WebString& message,
71 WebKit::WebMessagePortChannel* channel); 69 const WebKit::WebMessagePortChannelArray& channel);
72 virtual void workerObjectDestroyed(); 70 virtual void workerObjectDestroyed();
73 71
74 WebKit::WebWorkerClient* client() { return client_; } 72 WebKit::WebWorkerClient* client() { return client_; }
75 73
76 // Executes the given task on the main thread. 74 // Executes the given task on the main thread.
77 static void DispatchTaskToMainThread( 75 static void DispatchTaskToMainThread(
78 PassRefPtr<WebCore::ScriptExecutionContext::Task> task); 76 PassRefPtr<WebCore::ScriptExecutionContext::Task> task);
79 77
80 private: 78 private:
81 virtual ~WebWorkerImpl(); 79 virtual ~WebWorkerImpl();
82 80
83 // Tasks that are run on the worker thread. 81 // Tasks that are run on the worker thread.
84 static void PostMessageToWorkerContextTask( 82 static void PostMessageToWorkerContextTask(
85 WebCore::ScriptExecutionContext* context, 83 WebCore::ScriptExecutionContext* context,
86 WebWorkerImpl* this_ptr, 84 WebWorkerImpl* this_ptr,
87 const WebCore::String& message, 85 const WebCore::String& message,
88 WTF::PassOwnPtr<WebCore::MessagePortChannel> channel); 86 WTF::PassOwnPtr<WebCore::MessagePortChannelArray> channels);
89 87
90 // Function used to invoke tasks on the main thread. 88 // Function used to invoke tasks on the main thread.
91 static void InvokeTaskMethod(void* param); 89 static void InvokeTaskMethod(void* param);
92 90
93 // Tasks that are run on the main thread. 91 // Tasks that are run on the main thread.
94 static void PostMessageTask( 92 static void PostMessageTask(
95 WebCore::ScriptExecutionContext* context, 93 WebCore::ScriptExecutionContext* context,
96 WebWorkerImpl* this_ptr, 94 WebWorkerImpl* this_ptr,
97 WebCore::String message, 95 WebCore::String message,
98 WTF::PassOwnPtr<WebCore::MessagePortChannel> channel); 96 WTF::PassOwnPtr<WebCore::MessagePortChannelArray> channels);
99 static void PostExceptionTask( 97 static void PostExceptionTask(
100 WebCore::ScriptExecutionContext* context, 98 WebCore::ScriptExecutionContext* context,
101 WebWorkerImpl* this_ptr, 99 WebWorkerImpl* this_ptr,
102 const WebCore::String& error_message, 100 const WebCore::String& error_message,
103 int line_number, 101 int line_number,
104 const WebCore::String& source_url); 102 const WebCore::String& source_url);
105 static void PostConsoleMessageTask( 103 static void PostConsoleMessageTask(
106 WebCore::ScriptExecutionContext* context, 104 WebCore::ScriptExecutionContext* context,
107 WebWorkerImpl* this_ptr, 105 WebWorkerImpl* this_ptr,
108 int destination, 106 int destination,
(...skipping 23 matching lines...) Expand all
132 bool asked_to_terminate_; 130 bool asked_to_terminate_;
133 131
134 WTF::RefPtr<WebCore::WorkerThread> worker_thread_; 132 WTF::RefPtr<WebCore::WorkerThread> worker_thread_;
135 133
136 DISALLOW_COPY_AND_ASSIGN(WebWorkerImpl); 134 DISALLOW_COPY_AND_ASSIGN(WebWorkerImpl);
137 }; 135 };
138 136
139 #endif 137 #endif
140 138
141 #endif // WEBKIT_GLUE_WEBWORKER_IMPL_H_ 139 #endif // WEBKIT_GLUE_WEBWORKER_IMPL_H_
OLDNEW
« no previous file with comments | « webkit/api/src/PlatformMessagePortChannel.cpp ('k') | webkit/glue/webworker_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698