diff options
author | Steve Block <steveblock@google.com> | 2009-10-08 17:19:54 +0100 |
---|---|---|
committer | Steve Block <steveblock@google.com> | 2009-10-20 00:41:58 +0100 |
commit | 231d4e3152a9c27a73b6ac7badbe6be673aa3ddf (patch) | |
tree | a6c7e2d6cd7bfa7011cc39abbb436142d7a4a7c8 /WebCore/workers/DedicatedWorkerContext.cpp | |
parent | e196732677050bd463301566a68a643b6d14b907 (diff) | |
download | external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.zip external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.tar.gz external_webkit-231d4e3152a9c27a73b6ac7badbe6be673aa3ddf.tar.bz2 |
Merge webkit.org at R49305 : Automatic merge by git.
Change-Id: I8968561bc1bfd72b8923b7118d3728579c6dbcc7
Diffstat (limited to 'WebCore/workers/DedicatedWorkerContext.cpp')
-rw-r--r-- | WebCore/workers/DedicatedWorkerContext.cpp | 47 |
1 files changed, 11 insertions, 36 deletions
diff --git a/WebCore/workers/DedicatedWorkerContext.cpp b/WebCore/workers/DedicatedWorkerContext.cpp index ae5c547..82dc4b3 100644 --- a/WebCore/workers/DedicatedWorkerContext.cpp +++ b/WebCore/workers/DedicatedWorkerContext.cpp @@ -46,54 +46,29 @@ DedicatedWorkerContext::DedicatedWorkerContext(const KURL& url, const String& us { } -DedicatedWorkerContext::~DedicatedWorkerContext() +// FIXME: remove this when we update the ObjC bindings (bug #28774). +void DedicatedWorkerContext::postMessage(PassRefPtr<SerializedScriptValue> message, MessagePort* port, ExceptionCode& ec) { - ASSERT(currentThread() == thread()->threadID()); - // Notify parent worker we are going away. This can free the WorkerThread object, so do not access it after this. - thread()->workerObjectProxy().workerContextDestroyed(); + MessagePortArray ports; + if (port) + ports.append(port); + postMessage(message, &ports, ec); } -void DedicatedWorkerContext::forwardException(const String& errorMessage, int lineNumber, const String& sourceURL) +void DedicatedWorkerContext::postMessage(PassRefPtr<SerializedScriptValue> message, ExceptionCode& ec) { - thread()->workerObjectProxy().postExceptionToWorkerObject(errorMessage, lineNumber, sourceURL); + postMessage(message, static_cast<MessagePortArray*>(0), ec); } -void DedicatedWorkerContext::addMessage(MessageDestination destination, MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL) -{ - thread()->workerObjectProxy().postConsoleMessageToWorkerObject(destination, source, type, level, message, lineNumber, sourceURL); -} - -void DedicatedWorkerContext::postMessage(const String& message, ExceptionCode& ec) -{ - postMessage(message, 0, ec); -} - -void DedicatedWorkerContext::postMessage(const String& message, MessagePort* port, ExceptionCode& ec) +void DedicatedWorkerContext::postMessage(PassRefPtr<SerializedScriptValue> message, const MessagePortArray* ports, ExceptionCode& ec) { if (isClosing()) return; // Disentangle the port in preparation for sending it to the remote context. - OwnPtr<MessagePortChannel> channel = port ? port->disentangle(ec) : 0; + OwnPtr<MessagePortChannelArray> channels = MessagePort::disentanglePorts(ports, ec); if (ec) return; - thread()->workerObjectProxy().postMessageToWorkerObject(message, channel.release()); -} - -void DedicatedWorkerContext::dispatchMessage(const String& message, PassRefPtr<MessagePort> port) -{ - // Since close() stops the thread event loop, this should not ever get called while closing. - ASSERT(!isClosing()); - RefPtr<Event> evt = MessageEvent::create(message, "", "", 0, port); - - if (m_onmessageListener.get()) { - evt->setTarget(this); - evt->setCurrentTarget(this); - m_onmessageListener->handleEvent(evt.get(), false); - } - - ExceptionCode ec = 0; - dispatchEvent(evt.release(), ec); - ASSERT(!ec); + thread()->workerObjectProxy().postMessageToWorkerObject(message, channels.release()); } void DedicatedWorkerContext::importScripts(const Vector<String>& urls, const String& callerURL, int callerLine, ExceptionCode& ec) |