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

Side by Side Diff: webkit/glue/webworker_impl.cc

Issue 263005: Webkit roll: 49213:49221 (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 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
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 #include "config.h" 5 #include "config.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 8
9 #include "DedicatedWorkerContext.h" 9 #include "DedicatedWorkerContext.h"
10 #include "DedicatedWorkerThread.h" 10 #include "DedicatedWorkerThread.h"
11 #include "GenericWorkerTask.h" 11 #include "GenericWorkerTask.h"
12 #include "KURL.h" 12 #include "KURL.h"
13 #include "MessageEvent.h" 13 #include "MessageEvent.h"
14 #include "MessagePort.h" 14 #include "MessagePort.h"
15 #include "MessagePortChannel.h" 15 #include "MessagePortChannel.h"
16 #include "ScriptExecutionContext.h" 16 #include "ScriptExecutionContext.h"
17 #include "SecurityOrigin.h" 17 #include "SecurityOrigin.h"
18 #include "SerializedScriptValue.h"
18 #include "SubstituteData.h" 19 #include "SubstituteData.h"
19 #include <wtf/MainThread.h> 20 #include <wtf/MainThread.h>
20 #include <wtf/Threading.h> 21 #include <wtf/Threading.h>
21 22
22 #undef LOG 23 #undef LOG
23 24
24 #include "base/logging.h" 25 #include "base/logging.h"
25 #include "webkit/api/public/WebFrameClient.h" 26 #include "webkit/api/public/WebFrameClient.h"
26 #include "webkit/api/public/WebMessagePortChannel.h" 27 #include "webkit/api/public/WebMessagePortChannel.h"
27 #include "webkit/api/public/WebScreenInfo.h" 28 #include "webkit/api/public/WebScreenInfo.h"
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 WebCore::ScriptExecutionContext* context, 117 WebCore::ScriptExecutionContext* context,
117 WebWorkerImpl* this_ptr, 118 WebWorkerImpl* this_ptr,
118 const WebCore::String& message, 119 const WebCore::String& message,
119 WTF::PassOwnPtr<WebCore::MessagePortChannelArray> channels) { 120 WTF::PassOwnPtr<WebCore::MessagePortChannelArray> channels) {
120 DCHECK(context->isWorkerContext()); 121 DCHECK(context->isWorkerContext());
121 WebCore::DedicatedWorkerContext* worker_context = 122 WebCore::DedicatedWorkerContext* worker_context =
122 static_cast<WebCore::DedicatedWorkerContext*>(context); 123 static_cast<WebCore::DedicatedWorkerContext*>(context);
123 124
124 WTF::OwnPtr<WebCore::MessagePortArray> ports = 125 WTF::OwnPtr<WebCore::MessagePortArray> ports =
125 WebCore::MessagePort::entanglePorts(*context, channels.release()); 126 WebCore::MessagePort::entanglePorts(*context, channels.release());
127 WTF::RefPtr<WebCore::SerializedScriptValue> serialized_message =
128 WebCore::SerializedScriptValue::create(message);
126 worker_context->dispatchEvent( 129 worker_context->dispatchEvent(
127 WebCore::MessageEvent::create(ports.release(), message)); 130 WebCore::MessageEvent::create(ports.release(),
131 serialized_message.release()));
128 132
129 this_ptr->confirmMessageFromWorkerObject( 133 this_ptr->confirmMessageFromWorkerObject(
130 worker_context->hasPendingActivity()); 134 worker_context->hasPendingActivity());
131 } 135 }
132 136
133 // WebWorker ------------------------------------------------------------------- 137 // WebWorker -------------------------------------------------------------------
134 138
135 void WebWorkerImpl::startWorkerContext(const WebURL& script_url, 139 void WebWorkerImpl::startWorkerContext(const WebURL& script_url,
136 const WebString& user_agent, 140 const WebString& user_agent,
137 const WebString& source_code) { 141 const WebString& source_code) {
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
222 void WebWorkerImpl::InvokeTaskMethod(void* param) { 226 void WebWorkerImpl::InvokeTaskMethod(void* param) {
223 WebCore::ScriptExecutionContext::Task* task = 227 WebCore::ScriptExecutionContext::Task* task =
224 static_cast<WebCore::ScriptExecutionContext::Task*>(param); 228 static_cast<WebCore::ScriptExecutionContext::Task*>(param);
225 task->performTask(NULL); 229 task->performTask(NULL);
226 task->deref(); 230 task->deref();
227 } 231 }
228 232
229 // WorkerObjectProxy ----------------------------------------------------------- 233 // WorkerObjectProxy -----------------------------------------------------------
230 234
231 void WebWorkerImpl::postMessageToWorkerObject( 235 void WebWorkerImpl::postMessageToWorkerObject(
232 const WebCore::String& message, 236 WTF::PassRefPtr<WebCore::SerializedScriptValue> message,
233 WTF::PassOwnPtr<WebCore::MessagePortChannelArray> channels) { 237 WTF::PassOwnPtr<WebCore::MessagePortChannelArray> channels) {
234 DispatchTaskToMainThread(WebCore::createCallbackTask( 238 DispatchTaskToMainThread(WebCore::createCallbackTask(
235 &PostMessageTask, 239 &PostMessageTask,
236 this, 240 this,
237 message, 241 message->toString(),
238 channels)); 242 channels));
239 } 243 }
240 244
241 void WebWorkerImpl::PostMessageTask( 245 void WebWorkerImpl::PostMessageTask(
242 WebCore::ScriptExecutionContext* context, 246 WebCore::ScriptExecutionContext* context,
243 WebWorkerImpl* this_ptr, 247 WebWorkerImpl* this_ptr,
244 WebCore::String message, 248 WebCore::String message,
245 WTF::PassOwnPtr<WebCore::MessagePortChannelArray> channels) { 249 WTF::PassOwnPtr<WebCore::MessagePortChannelArray> channels) {
246 WebMessagePortChannelArray web_channels( 250 WebMessagePortChannelArray web_channels(
247 channels.get() ? channels->size() : 0); 251 channels.get() ? channels->size() : 0);
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
379 383
380 namespace WebKit { 384 namespace WebKit {
381 385
382 WebWorker* WebWorker::create(WebWorkerClient* client) { 386 WebWorker* WebWorker::create(WebWorkerClient* client) {
383 return NULL; 387 return NULL;
384 } 388 }
385 389
386 } 390 }
387 391
388 #endif 392 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698