diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-01 21:20:47 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-05-01 21:20:47 +0000 |
commit | ec775ef9b36dbcb5ebbd4fa550443bfa94c53a9f (patch) | |
tree | 5400ae2c5876e13aeeec2ab6ebcfc54f3f479840 /webkit/glue/webworkerclient_impl.h | |
parent | 4b5d64ff3d7d95247ed4f078d8bf585a1726794d (diff) | |
download | chromium_src-ec775ef9b36dbcb5ebbd4fa550443bfa94c53a9f.zip chromium_src-ec775ef9b36dbcb5ebbd4fa550443bfa94c53a9f.tar.gz chromium_src-ec775ef9b36dbcb5ebbd4fa550443bfa94c53a9f.tar.bz2 |
Run workers in separate processes.
Review URL: http://codereview.chromium.org/99016
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@15098 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'webkit/glue/webworkerclient_impl.h')
-rw-r--r-- | webkit/glue/webworkerclient_impl.h | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/webkit/glue/webworkerclient_impl.h b/webkit/glue/webworkerclient_impl.h index 847b341..4e3f4ae 100644 --- a/webkit/glue/webworkerclient_impl.h +++ b/webkit/glue/webworkerclient_impl.h @@ -31,6 +31,9 @@ class WebWorkerClientImpl : public WebCore::WorkerContextProxy, void set_webworker(WebKit::WebWorker* webworker); // WebCore::WorkerContextProxy methods: + // These are called on the thread that created the worker. In the renderer + // process, this will be the main WebKit thread. In the worker process, this + // will be the thread of the executing worker (not the main WebKit thread). virtual void startWorkerContext(const WebCore::KURL& script_url, const WebCore::String& user_agent, const WebCore::String& source_code); @@ -40,6 +43,7 @@ class WebWorkerClientImpl : public WebCore::WorkerContextProxy, virtual void workerObjectDestroyed(); // WebWorkerClient methods: + // These are called on the main WebKit thread. virtual void postMessageToWorkerObject(const WebKit::WebString& message); virtual void postExceptionToWorkerObject( const WebKit::WebString& error_message, @@ -59,6 +63,56 @@ class WebWorkerClientImpl : public WebCore::WorkerContextProxy, private: virtual ~WebWorkerClientImpl(); + // Methods used to support WebWorkerClientImpl being constructed on worker + // threads. + // These tasks are dispatched on the WebKit thread. + static void StartWorkerContextTask( + WebCore::ScriptExecutionContext* context, + WebWorkerClientImpl* this_ptr, + const WebCore::String& script_url, + const WebCore::String& user_agent, + const WebCore::String& source_code); + static void TerminateWorkerContextTask( + WebCore::ScriptExecutionContext* context, + WebWorkerClientImpl* this_ptr); + static void PostMessageToWorkerContextTask( + WebCore::ScriptExecutionContext* context, + WebWorkerClientImpl* this_ptr, + const WebCore::String& message); + static void WorkerObjectDestroyedTask( + WebCore::ScriptExecutionContext* context, + WebWorkerClientImpl* this_ptr); + + // These tasks are dispatched on the thread that created the worker (i.e. + // main WebKit thread in renderer process, and the worker thread in the worker + // process). + static void PostMessageToWorkerObjectTask( + WebCore::ScriptExecutionContext* context, + WebWorkerClientImpl* this_ptr, + const WebCore::String& message); + static void PostExceptionToWorkerObjectTask( + WebCore::ScriptExecutionContext* context, + WebWorkerClientImpl* this_ptr, + const WebCore::String& error_message, + int line_number, + const WebCore::String& source_url); + static void PostConsoleMessageToWorkerObjectTask( + WebCore::ScriptExecutionContext* context, + WebWorkerClientImpl* this_ptr, + int destination_id, + int source_id, + int message_level, + const WebCore::String& message, + int line_number, + const WebCore::String& source_url); + static void ConfirmMessageFromWorkerObjectTask( + WebCore::ScriptExecutionContext* context, + WebWorkerClientImpl* this_ptr); + static void ReportPendingActivityTask( + WebCore::ScriptExecutionContext* context, + WebWorkerClientImpl* this_ptr, + bool has_pending_activity); + // Guard against context from being destroyed before a worker exits. WTF::RefPtr<WebCore::ScriptExecutionContext> script_execution_context_; @@ -67,6 +121,7 @@ class WebWorkerClientImpl : public WebCore::WorkerContextProxy, bool asked_to_terminate_; uint32 unconfirmed_message_count_; bool worker_context_had_pending_activity_; + WTF::ThreadIdentifier worker_thread_id_; }; #endif |