summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/webkit/WebCore/workers
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/webkit/WebCore/workers')
-rw-r--r--src/3rdparty/webkit/WebCore/workers/AbstractWorker.cpp125
-rw-r--r--src/3rdparty/webkit/WebCore/workers/AbstractWorker.h86
-rw-r--r--src/3rdparty/webkit/WebCore/workers/AbstractWorker.idl52
-rw-r--r--src/3rdparty/webkit/WebCore/workers/GenericWorkerTask.h70
-rw-r--r--src/3rdparty/webkit/WebCore/workers/SharedWorker.cpp52
-rw-r--r--src/3rdparty/webkit/WebCore/workers/SharedWorker.h61
-rw-r--r--src/3rdparty/webkit/WebCore/workers/SharedWorker.idl42
-rw-r--r--src/3rdparty/webkit/WebCore/workers/Worker.cpp17
-rw-r--r--src/3rdparty/webkit/WebCore/workers/Worker.h5
-rw-r--r--src/3rdparty/webkit/WebCore/workers/Worker.idl3
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerContext.cpp32
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerContext.h9
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerContext.idl8
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerContextProxy.h5
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerLoaderProxy.h2
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.cpp52
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.h8
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerObjectProxy.h7
-rw-r--r--src/3rdparty/webkit/WebCore/workers/WorkerRunLoop.cpp3
19 files changed, 587 insertions, 52 deletions
diff --git a/src/3rdparty/webkit/WebCore/workers/AbstractWorker.cpp b/src/3rdparty/webkit/WebCore/workers/AbstractWorker.cpp
new file mode 100644
index 0000000..120f78a
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/workers/AbstractWorker.cpp
@@ -0,0 +1,125 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#include "config.h"
+
+#if ENABLE(SHARED_WORKERS)
+
+#include "AbstractWorker.h"
+
+#include "Event.h"
+#include "EventException.h"
+#include "EventNames.h"
+
+namespace WebCore {
+
+AbstractWorker::AbstractWorker(ScriptExecutionContext* context)
+ : ActiveDOMObject(context, this)
+{
+}
+
+AbstractWorker::~AbstractWorker()
+{
+}
+
+void AbstractWorker::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> eventListener, bool)
+{
+ EventListenersMap::iterator iter = m_eventListeners.find(eventType);
+ if (iter == m_eventListeners.end()) {
+ ListenerVector listeners;
+ listeners.append(eventListener);
+ m_eventListeners.add(eventType, listeners);
+ } else {
+ ListenerVector& listeners = iter->second;
+ for (ListenerVector::iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) {
+ if (*listenerIter == eventListener)
+ return;
+ }
+
+ listeners.append(eventListener);
+ m_eventListeners.add(eventType, listeners);
+ }
+}
+
+void AbstractWorker::removeEventListener(const AtomicString& eventType, EventListener* eventListener, bool)
+{
+ EventListenersMap::iterator iter = m_eventListeners.find(eventType);
+ if (iter == m_eventListeners.end())
+ return;
+
+ ListenerVector& listeners = iter->second;
+ for (ListenerVector::const_iterator listenerIter = listeners.begin(); listenerIter != listeners.end(); ++listenerIter) {
+ if (*listenerIter == eventListener) {
+ listeners.remove(listenerIter - listeners.begin());
+ return;
+ }
+ }
+}
+
+bool AbstractWorker::dispatchEvent(PassRefPtr<Event> event, ExceptionCode& ec)
+{
+ if (!event || event->type().isEmpty()) {
+ ec = EventException::UNSPECIFIED_EVENT_TYPE_ERR;
+ return true;
+ }
+
+ ListenerVector listenersCopy = m_eventListeners.get(event->type());
+ for (ListenerVector::const_iterator listenerIter = listenersCopy.begin(); listenerIter != listenersCopy.end(); ++listenerIter) {
+ event->setTarget(this);
+ event->setCurrentTarget(this);
+ listenerIter->get()->handleEvent(event.get(), false);
+ }
+
+ return !event->defaultPrevented();
+}
+
+void AbstractWorker::dispatchLoadErrorEvent()
+{
+ RefPtr<Event> evt = Event::create(eventNames().errorEvent, false, true);
+ if (m_onErrorListener) {
+ evt->setTarget(this);
+ evt->setCurrentTarget(this);
+ m_onErrorListener->handleEvent(evt.get(), true);
+ }
+
+ ExceptionCode ec = 0;
+ dispatchEvent(evt.release(), ec);
+ ASSERT(!ec);
+}
+
+void AbstractWorker::dispatchScriptErrorEvent(const String&, const String&, int)
+{
+ //FIXME: Generate an ErrorEvent instead of a simple event
+ dispatchLoadErrorEvent();
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SHARED_WORKERS)
diff --git a/src/3rdparty/webkit/WebCore/workers/AbstractWorker.h b/src/3rdparty/webkit/WebCore/workers/AbstractWorker.h
new file mode 100644
index 0000000..89e4258
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/workers/AbstractWorker.h
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef AbstractWorker_h
+#define AbstractWorker_h
+
+#if ENABLE(SHARED_WORKERS)
+
+#include "ActiveDOMObject.h"
+#include "AtomicStringHash.h"
+#include "EventListener.h"
+#include "EventTarget.h"
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefCounted.h>
+#include <wtf/RefPtr.h>
+
+namespace WebCore {
+
+ class ScriptExecutionContext;
+
+ class AbstractWorker : public RefCounted<AbstractWorker>, public ActiveDOMObject, public EventTarget {
+ public:
+ // EventTarget APIs
+ virtual ScriptExecutionContext* scriptExecutionContext() const { return ActiveDOMObject::scriptExecutionContext(); }
+
+ virtual void addEventListener(const AtomicString& eventType, PassRefPtr<EventListener>, bool useCapture);
+ virtual void removeEventListener(const AtomicString& eventType, EventListener*, bool useCapture);
+ virtual bool dispatchEvent(PassRefPtr<Event>, ExceptionCode&);
+
+ // Utility routines to generate appropriate error events for loading and script exceptions.
+ void dispatchLoadErrorEvent();
+ void dispatchScriptErrorEvent(const String& errorMessage, const String& sourceURL, int);
+
+ void setOnerror(PassRefPtr<EventListener> eventListener) { m_onErrorListener = eventListener; }
+ EventListener* onerror() const { return m_onErrorListener.get(); }
+ typedef Vector<RefPtr<EventListener> > ListenerVector;
+ typedef HashMap<AtomicString, ListenerVector> EventListenersMap;
+ EventListenersMap& eventListeners() { return m_eventListeners; }
+
+ using RefCounted<AbstractWorker>::ref;
+ using RefCounted<AbstractWorker>::deref;
+
+ AbstractWorker(ScriptExecutionContext*);
+ virtual ~AbstractWorker();
+
+ private:
+
+ virtual void refEventTarget() { ref(); }
+ virtual void derefEventTarget() { deref(); }
+
+ RefPtr<EventListener> m_onErrorListener;
+ EventListenersMap m_eventListeners;
+ };
+
+} // namespace WebCore
+
+#endif // ENABLE(SHARED_WORKERS)
+
+#endif // AbstractWorker_h
diff --git a/src/3rdparty/webkit/WebCore/workers/AbstractWorker.idl b/src/3rdparty/webkit/WebCore/workers/AbstractWorker.idl
new file mode 100644
index 0000000..1234c0d
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/workers/AbstractWorker.idl
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module threads {
+
+ interface [
+ Conditional=SHARED_WORKERS,
+ CustomMarkFunction,
+ CustomToJS,
+ GenerateConstructor
+ ] AbstractWorker {
+
+ attribute EventListener onerror;
+
+ [Custom] void addEventListener(in DOMString type,
+ in EventListener listener,
+ in boolean useCapture);
+ [Custom] void removeEventListener(in DOMString type,
+ in EventListener listener,
+ in boolean useCapture);
+ boolean dispatchEvent(in Event evt)
+ raises(EventException);
+ };
+
+}
diff --git a/src/3rdparty/webkit/WebCore/workers/GenericWorkerTask.h b/src/3rdparty/webkit/WebCore/workers/GenericWorkerTask.h
index 96b0e70..d6a9994 100644
--- a/src/3rdparty/webkit/WebCore/workers/GenericWorkerTask.h
+++ b/src/3rdparty/webkit/WebCore/workers/GenericWorkerTask.h
@@ -36,6 +36,7 @@
#include "CrossThreadCopier.h"
#include "ScriptExecutionContext.h"
#include <memory>
+#include <wtf/PassOwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/TypeTraits.h>
@@ -58,6 +59,10 @@ namespace WebCore {
typedef PassRefPtr<T> ParamType;
};
+ template<typename T> struct GenericWorkerTaskTraits<PassOwnPtr<T> > {
+ typedef PassOwnPtr<T> ParamType;
+ };
+
template<typename P1, typename MP1>
class GenericWorkerTask1 : public ScriptExecutionContext::Task {
public:
@@ -323,6 +328,56 @@ namespace WebCore {
P6 m_parameter6;
P7 m_parameter7;
};
+
+ template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6, typename P7, typename MP7, typename P8, typename MP8>
+ class GenericWorkerTask8 : public ScriptExecutionContext::Task {
+ public:
+ typedef void (*Method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7, MP8);
+ typedef GenericWorkerTask8<P1, MP1, P2, MP2, P3, MP3, P4, MP4, P5, MP5, P6, MP6, P7, MP7, P8, MP8> GenericWorkerTask;
+ typedef typename GenericWorkerTaskTraits<P1>::ParamType Param1;
+ typedef typename GenericWorkerTaskTraits<P2>::ParamType Param2;
+ typedef typename GenericWorkerTaskTraits<P3>::ParamType Param3;
+ typedef typename GenericWorkerTaskTraits<P4>::ParamType Param4;
+ typedef typename GenericWorkerTaskTraits<P5>::ParamType Param5;
+ typedef typename GenericWorkerTaskTraits<P6>::ParamType Param6;
+ typedef typename GenericWorkerTaskTraits<P7>::ParamType Param7;
+ typedef typename GenericWorkerTaskTraits<P8>::ParamType Param8;
+
+ static PassRefPtr<GenericWorkerTask> create(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6, Param7 parameter7, Param8 parameter8)
+ {
+ return adoptRef(new GenericWorkerTask(method, parameter1, parameter2, parameter3, parameter4, parameter5, parameter6, parameter7, parameter8));
+ }
+
+ private:
+ GenericWorkerTask8(Method method, Param1 parameter1, Param2 parameter2, Param3 parameter3, Param4 parameter4, Param5 parameter5, Param6 parameter6, Param7 parameter7, Param8 parameter8)
+ : m_method(method)
+ , m_parameter1(parameter1)
+ , m_parameter2(parameter2)
+ , m_parameter3(parameter3)
+ , m_parameter4(parameter4)
+ , m_parameter5(parameter5)
+ , m_parameter6(parameter6)
+ , m_parameter7(parameter7)
+ , m_parameter8(parameter8)
+ {
+ }
+
+ virtual void performTask(ScriptExecutionContext* context)
+ {
+ (*m_method)(context, m_parameter1, m_parameter2, m_parameter3, m_parameter4, m_parameter5, m_parameter6, m_parameter7, m_parameter8);
+ }
+
+ private:
+ Method m_method;
+ P1 m_parameter1;
+ P2 m_parameter2;
+ P3 m_parameter3;
+ P4 m_parameter4;
+ P5 m_parameter5;
+ P6 m_parameter6;
+ P7 m_parameter7;
+ P8 m_parameter8;
+ };
template<typename P1, typename MP1>
PassRefPtr<ScriptExecutionContext::Task> createCallbackTask(
@@ -408,6 +463,21 @@ namespace WebCore {
CrossThreadCopier<P7>::copy(parameter7));
}
+ template<typename P1, typename MP1, typename P2, typename MP2, typename P3, typename MP3, typename P4, typename MP4, typename P5, typename MP5, typename P6, typename MP6, typename P7, typename MP7, typename P8, typename MP8>
+ PassRefPtr<ScriptExecutionContext::Task> createCallbackTask(
+ void (*method)(ScriptExecutionContext*, MP1, MP2, MP3, MP4, MP5, MP6, MP7, MP8),
+ const P1& parameter1, const P2& parameter2, const P3& parameter3, const P4& parameter4, const P5& parameter5, const P6& parameter6, const P7& parameter7, const P8& parameter8)
+ {
+ return GenericWorkerTask8<typename CrossThreadCopier<P1>::Type, MP1, typename CrossThreadCopier<P2>::Type, MP2, typename CrossThreadCopier<P3>::Type, MP3,
+ typename CrossThreadCopier<P4>::Type, MP4, typename CrossThreadCopier<P5>::Type, MP5, typename CrossThreadCopier<P6>::Type, MP6,
+ typename CrossThreadCopier<P7>::Type, MP7, typename CrossThreadCopier<P8>::Type, MP8>::create(
+ method,
+ CrossThreadCopier<P1>::copy(parameter1), CrossThreadCopier<P2>::copy(parameter2),
+ CrossThreadCopier<P3>::copy(parameter3), CrossThreadCopier<P4>::copy(parameter4),
+ CrossThreadCopier<P5>::copy(parameter5), CrossThreadCopier<P6>::copy(parameter6),
+ CrossThreadCopier<P7>::copy(parameter7), CrossThreadCopier<P8>::copy(parameter8));
+ }
+
} // namespace WebCore
#endif // ENABLE(WORKERS)
diff --git a/src/3rdparty/webkit/WebCore/workers/SharedWorker.cpp b/src/3rdparty/webkit/WebCore/workers/SharedWorker.cpp
new file mode 100644
index 0000000..e1d30d3
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/workers/SharedWorker.cpp
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+#include "config.h"
+
+#if ENABLE(SHARED_WORKERS)
+
+#include "SharedWorker.h"
+
+#include "MessagePort.h"
+
+namespace WebCore {
+
+SharedWorker::SharedWorker(const String&, const String&, ScriptExecutionContext* context, ExceptionCode&)
+ : AbstractWorker(context)
+{
+ // Placeholder - ultimately we'll look up the worker in the SharedWorkerRepository.
+}
+
+SharedWorker::~SharedWorker()
+{
+}
+
+} // namespace WebCore
+
+#endif // ENABLE(SHARED_WORKERS)
diff --git a/src/3rdparty/webkit/WebCore/workers/SharedWorker.h b/src/3rdparty/webkit/WebCore/workers/SharedWorker.h
new file mode 100644
index 0000000..36c7d85
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/workers/SharedWorker.h
@@ -0,0 +1,61 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+#ifndef SharedWorker_h
+#define SharedWorker_h
+
+#include "AbstractWorker.h"
+
+#include <wtf/PassRefPtr.h>
+#include <wtf/RefPtr.h>
+
+
+namespace WebCore {
+
+ class SharedWorker : public AbstractWorker {
+ public:
+ static PassRefPtr<SharedWorker> create(const String& url, const String& name, ScriptExecutionContext* context, ExceptionCode& ec)
+ {
+ return adoptRef(new SharedWorker(url, name, context, ec));
+ }
+ ~SharedWorker();
+ MessagePort* port() const { return m_port.get(); }
+
+ virtual SharedWorker* toSharedWorker() { return this; }
+
+ private:
+ SharedWorker(const String& url, const String& name, ScriptExecutionContext*, ExceptionCode&);
+
+ RefPtr<MessagePort> m_port;
+ };
+
+} // namespace WebCore
+
+#endif // SharedWorker_h
diff --git a/src/3rdparty/webkit/WebCore/workers/SharedWorker.idl b/src/3rdparty/webkit/WebCore/workers/SharedWorker.idl
new file mode 100644
index 0000000..09475f7
--- /dev/null
+++ b/src/3rdparty/webkit/WebCore/workers/SharedWorker.idl
@@ -0,0 +1,42 @@
+/*
+ * Copyright (C) 2009 Google Inc. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ *
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following disclaimer
+ * in the documentation and/or other materials provided with the
+ * distribution.
+ * * Neither the name of Google Inc. nor the names of its
+ * contributors may be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+ * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+ * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+ * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+module threads {
+
+ interface [
+ Conditional=SHARED_WORKERS,
+ CustomMarkFunction,
+ GenerateNativeConverter,
+ GenerateToJS
+ ] SharedWorker : AbstractWorker {
+ readonly attribute MessagePort port;
+ };
+
+}
diff --git a/src/3rdparty/webkit/WebCore/workers/Worker.cpp b/src/3rdparty/webkit/WebCore/workers/Worker.cpp
index a810dda..2e03e3d 100644
--- a/src/3rdparty/webkit/WebCore/workers/Worker.cpp
+++ b/src/3rdparty/webkit/WebCore/workers/Worker.cpp
@@ -77,9 +77,18 @@ Worker::~Worker()
m_contextProxy->workerObjectDestroyed();
}
-void Worker::postMessage(const String& message)
+void Worker::postMessage(const String& message, ExceptionCode& ec)
{
- m_contextProxy->postMessageToWorkerContext(message);
+ postMessage(message, 0, ec);
+}
+
+void Worker::postMessage(const String& message, MessagePort* messagePort, ExceptionCode& ec)
+{
+ // Disentangle the port in preparation for sending it to the remote context.
+ OwnPtr<MessagePortChannel> channel = messagePort ? messagePort->disentangle(ec) : 0;
+ if (ec)
+ return;
+ m_contextProxy->postMessageToWorkerContext(message, channel.release());
}
void Worker::terminate()
@@ -180,9 +189,9 @@ bool Worker::dispatchEvent(PassRefPtr<Event> event, ExceptionCode& ec)
return !event->defaultPrevented();
}
-void Worker::dispatchMessage(const String& message)
+void Worker::dispatchMessage(const String& message, PassRefPtr<MessagePort> port)
{
- RefPtr<Event> evt = MessageEvent::create(message, "", "", 0, 0);
+ RefPtr<Event> evt = MessageEvent::create(message, "", "", 0, port);
if (m_onMessageListener.get()) {
evt->setTarget(this);
diff --git a/src/3rdparty/webkit/WebCore/workers/Worker.h b/src/3rdparty/webkit/WebCore/workers/Worker.h
index bd9e556..1fcc8be 100644
--- a/src/3rdparty/webkit/WebCore/workers/Worker.h
+++ b/src/3rdparty/webkit/WebCore/workers/Worker.h
@@ -58,11 +58,12 @@ namespace WebCore {
virtual Worker* toWorker() { return this; }
- void postMessage(const String& message);
+ void postMessage(const String&, ExceptionCode&);
+ void postMessage(const String&, MessagePort*, ExceptionCode&);
void terminate();
- void dispatchMessage(const String&);
+ void dispatchMessage(const String&, PassRefPtr<MessagePort>);
void dispatchErrorEvent();
virtual bool canSuspend() const;
diff --git a/src/3rdparty/webkit/WebCore/workers/Worker.idl b/src/3rdparty/webkit/WebCore/workers/Worker.idl
index 2ef9b62..e078e7c 100644
--- a/src/3rdparty/webkit/WebCore/workers/Worker.idl
+++ b/src/3rdparty/webkit/WebCore/workers/Worker.idl
@@ -30,7 +30,8 @@ module threads {
attribute EventListener onerror;
attribute EventListener onmessage;
- void postMessage(in DOMString message);
+ void postMessage(in DOMString message, in [Optional] MessagePort messagePort)
+ raises(DOMException);
void terminate();
diff --git a/src/3rdparty/webkit/WebCore/workers/WorkerContext.cpp b/src/3rdparty/webkit/WebCore/workers/WorkerContext.cpp
index fd05062..8e9fb97 100644
--- a/src/3rdparty/webkit/WebCore/workers/WorkerContext.cpp
+++ b/src/3rdparty/webkit/WebCore/workers/WorkerContext.cpp
@@ -130,6 +130,14 @@ bool WorkerContext::hasPendingActivity() const
if (iter->first->hasPendingActivity())
return true;
}
+
+ // Keep the worker active as long as there is a MessagePort with pending activity or that is remotely entangled.
+ HashSet<MessagePort*>::const_iterator messagePortsEnd = messagePorts().end();
+ for (HashSet<MessagePort*>::const_iterator iter = messagePorts().begin(); iter != messagePortsEnd; ++iter) {
+ if ((*iter)->hasPendingActivity() || ((*iter)->isEntangled() && !(*iter)->locallyEntangledPort()))
+ return true;
+ }
+
return false;
}
@@ -138,9 +146,9 @@ void WorkerContext::reportException(const String& errorMessage, int lineNumber,
m_thread->workerObjectProxy().postExceptionToWorkerObject(errorMessage, lineNumber, sourceURL);
}
-void WorkerContext::addMessage(MessageDestination destination, MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
+void WorkerContext::addMessage(MessageDestination destination, MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
{
- m_thread->workerObjectProxy().postConsoleMessageToWorkerObject(destination, source, level, message, lineNumber, sourceURL);
+ m_thread->workerObjectProxy().postConsoleMessageToWorkerObject(destination, source, type, level, message, lineNumber, sourceURL);
}
void WorkerContext::resourceRetrievedByXMLHttpRequest(unsigned long, const ScriptString&)
@@ -155,12 +163,20 @@ void WorkerContext::scriptImported(unsigned long, const String&)
notImplemented();
}
-void WorkerContext::postMessage(const String& message)
+void WorkerContext::postMessage(const String& message, ExceptionCode& ec)
+{
+ postMessage(message, 0, ec);
+}
+
+void WorkerContext::postMessage(const String& message, MessagePort* port, ExceptionCode& ec)
{
if (m_closing)
return;
-
- m_thread->workerObjectProxy().postMessageToWorkerObject(message);
+ // Disentangle the port in preparation for sending it to the remote context.
+ OwnPtr<MessagePortChannel> channel = port ? port->disentangle(ec) : 0;
+ if (ec)
+ return;
+ m_thread->workerObjectProxy().postMessageToWorkerObject(message, channel.release());
}
void WorkerContext::addEventListener(const AtomicString& eventType, PassRefPtr<EventListener> eventListener, bool)
@@ -239,11 +255,11 @@ void WorkerContext::clearInterval(int timeoutId)
DOMTimer::removeById(scriptExecutionContext(), timeoutId);
}
-void WorkerContext::dispatchMessage(const String& message)
+void WorkerContext::dispatchMessage(const String& message, PassRefPtr<MessagePort> port)
{
// Since close() stops the thread event loop, this should not ever get called while closing.
ASSERT(!m_closing);
- RefPtr<Event> evt = MessageEvent::create(message, "", "", 0, 0);
+ RefPtr<Event> evt = MessageEvent::create(message, "", "", 0, port);
if (m_onmessageListener.get()) {
evt->setTarget(this);
@@ -283,7 +299,7 @@ void WorkerContext::importScripts(const Vector<String>& urls, const String& call
}
scriptExecutionContext()->scriptImported(scriptLoader.identifier(), scriptLoader.script());
- scriptExecutionContext()->addMessage(InspectorControllerDestination, JSMessageSource, LogMessageLevel, "Worker script imported: \"" + *it + "\".", callerLine, callerURL);
+ scriptExecutionContext()->addMessage(InspectorControllerDestination, JSMessageSource, LogMessageType, LogMessageLevel, "Worker script imported: \"" + *it + "\".", callerLine, callerURL);
ScriptValue exception;
m_script->evaluate(ScriptSourceCode(scriptLoader.script(), *it), &exception);
diff --git a/src/3rdparty/webkit/WebCore/workers/WorkerContext.h b/src/3rdparty/webkit/WebCore/workers/WorkerContext.h
index ce782f8..16f43fd 100644
--- a/src/3rdparty/webkit/WebCore/workers/WorkerContext.h
+++ b/src/3rdparty/webkit/WebCore/workers/WorkerContext.h
@@ -74,13 +74,12 @@ namespace WebCore {
bool hasPendingActivity() const;
virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL);
- virtual void addMessage(MessageDestination, MessageSource, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
+ virtual void addMessage(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
virtual void resourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString);
virtual void scriptImported(unsigned long identifier, const String& sourceString);
virtual void postTask(PassRefPtr<Task>); // Executes the task on context's thread asynchronously.
-
// WorkerGlobalScope
WorkerContext* self() { return this; }
WorkerLocation* location() const;
@@ -90,9 +89,9 @@ namespace WebCore {
void importScripts(const Vector<String>& urls, const String& callerURL, int callerLine, ExceptionCode&);
WorkerNavigator* navigator() const;
-
// DedicatedWorkerGlobalScope
- void postMessage(const String& message);
+ void postMessage(const String&, ExceptionCode&);
+ void postMessage(const String&, MessagePort*, ExceptionCode&);
void setOnmessage(PassRefPtr<EventListener> eventListener) { m_onmessageListener = eventListener; }
EventListener* onmessage() const { return m_onmessageListener.get(); }
@@ -111,7 +110,7 @@ namespace WebCore {
typedef HashMap<AtomicString, ListenerVector> EventListenersMap;
EventListenersMap& eventListeners() { return m_eventListeners; }
- void dispatchMessage(const String&);
+ void dispatchMessage(const String&, PassRefPtr<MessagePort>);
// These methods are used for GC marking. See JSWorkerContext::mark() in
// JSWorkerContextCustom.cpp.
diff --git a/src/3rdparty/webkit/WebCore/workers/WorkerContext.idl b/src/3rdparty/webkit/WebCore/workers/WorkerContext.idl
index 9d5aa79..709410a 100644
--- a/src/3rdparty/webkit/WebCore/workers/WorkerContext.idl
+++ b/src/3rdparty/webkit/WebCore/workers/WorkerContext.idl
@@ -41,7 +41,6 @@ module threads {
#endif
attribute [Replaceable] WorkerLocation location;
void close();
- // attribute EventListener onclose;
// attribute EventListener onerror;
// WorkerUtils
@@ -52,10 +51,10 @@ module threads {
// DedicatedWorkerGlobalScope
- void postMessage(in DOMString message);
+ void postMessage(in DOMString message, in [Optional] MessagePort messagePort)
+ raises(DOMException);
attribute EventListener onmessage;
-
// Timers
[Custom] long setTimeout(in TimeoutHandler handler, in long timeout);
// [Custom] long setTimeout(in DOMString code, in long timeout);
@@ -80,6 +79,9 @@ module threads {
attribute MessageEventConstructor MessageEvent;
attribute WorkerLocationConstructor WorkerLocation;
+#if ENABLE_CHANNEL_MESSAGING
+ attribute [JSCCustomGetter] MessageChannelConstructor MessageChannel;
+#endif
attribute [JSCCustomGetter] XMLHttpRequestConstructor XMLHttpRequest;
};
diff --git a/src/3rdparty/webkit/WebCore/workers/WorkerContextProxy.h b/src/3rdparty/webkit/WebCore/workers/WorkerContextProxy.h
index c8f5761..f42527e 100644
--- a/src/3rdparty/webkit/WebCore/workers/WorkerContextProxy.h
+++ b/src/3rdparty/webkit/WebCore/workers/WorkerContextProxy.h
@@ -33,9 +33,12 @@
#if ENABLE(WORKERS)
+#include <wtf/PassOwnPtr.h>
+
namespace WebCore {
class KURL;
+ class MessagePortChannel;
class String;
class Worker;
@@ -50,7 +53,7 @@ namespace WebCore {
virtual void terminateWorkerContext() = 0;
- virtual void postMessageToWorkerContext(const String&) = 0;
+ virtual void postMessageToWorkerContext(const String&, PassOwnPtr<MessagePortChannel>) = 0;
virtual bool hasPendingActivity() const = 0;
diff --git a/src/3rdparty/webkit/WebCore/workers/WorkerLoaderProxy.h b/src/3rdparty/webkit/WebCore/workers/WorkerLoaderProxy.h
index b51f480..ac7cda1 100644
--- a/src/3rdparty/webkit/WebCore/workers/WorkerLoaderProxy.h
+++ b/src/3rdparty/webkit/WebCore/workers/WorkerLoaderProxy.h
@@ -33,11 +33,11 @@
#if ENABLE(WORKERS)
+#include "ScriptExecutionContext.h"
#include <wtf/PassRefPtr.h>
namespace WebCore {
- class ScriptExecutionContext::Task;
class String;
// A proxy to talk to the loader context. Normally, the document on the main thread
diff --git a/src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.cpp b/src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.cpp
index a6d0d5d..b6e1642 100644
--- a/src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.cpp
+++ b/src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.cpp
@@ -44,14 +44,15 @@ namespace WebCore {
class MessageWorkerContextTask : public ScriptExecutionContext::Task {
public:
- static PassRefPtr<MessageWorkerContextTask> create(const String& message)
+ static PassRefPtr<MessageWorkerContextTask> create(const String& message, PassOwnPtr<MessagePortChannel> channel)
{
- return adoptRef(new MessageWorkerContextTask(message));
+ return adoptRef(new MessageWorkerContextTask(message, channel));
}
private:
- MessageWorkerContextTask(const String& message)
+ MessageWorkerContextTask(const String& message, PassOwnPtr<MessagePortChannel> channel)
: m_message(message.copy())
+ , m_channel(channel)
{
}
@@ -59,41 +60,52 @@ private:
{
ASSERT(scriptContext->isWorkerContext());
WorkerContext* context = static_cast<WorkerContext*>(scriptContext);
-
- context->dispatchMessage(m_message);
-
+ RefPtr<MessagePort> port;
+ if (m_channel) {
+ port = MessagePort::create(*scriptContext);
+ port->entangle(m_channel.release());
+ }
+ context->dispatchMessage(m_message, port.release());
context->thread()->workerObjectProxy().confirmMessageFromWorkerObject(context->hasPendingActivity());
}
private:
String m_message;
+ OwnPtr<MessagePortChannel> m_channel;
};
class MessageWorkerTask : public ScriptExecutionContext::Task {
public:
- static PassRefPtr<MessageWorkerTask> create(const String& message, WorkerMessagingProxy* messagingProxy)
+ static PassRefPtr<MessageWorkerTask> create(const String& message, PassOwnPtr<MessagePortChannel> channel, WorkerMessagingProxy* messagingProxy)
{
- return adoptRef(new MessageWorkerTask(message, messagingProxy));
+ return adoptRef(new MessageWorkerTask(message, channel, messagingProxy));
}
private:
- MessageWorkerTask(const String& message, WorkerMessagingProxy* messagingProxy)
+ MessageWorkerTask(const String& message, PassOwnPtr<MessagePortChannel> channel, WorkerMessagingProxy* messagingProxy)
: m_message(message.copy())
+ , m_channel(channel)
, m_messagingProxy(messagingProxy)
{
}
- virtual void performTask(ScriptExecutionContext*)
+ virtual void performTask(ScriptExecutionContext* scriptContext)
{
Worker* workerObject = m_messagingProxy->workerObject();
if (!workerObject || m_messagingProxy->askedToTerminate())
return;
- workerObject->dispatchMessage(m_message);
+ RefPtr<MessagePort> port;
+ if (m_channel) {
+ port = MessagePort::create(*scriptContext);
+ port->entangle(m_channel.release());
+ }
+ workerObject->dispatchMessage(m_message, port.release());
}
private:
String m_message;
+ OwnPtr<MessagePortChannel> m_channel;
WorkerMessagingProxy* m_messagingProxy;
};
@@ -205,21 +217,21 @@ void WorkerMessagingProxy::startWorkerContext(const KURL& scriptURL, const Strin
thread->start();
}
-void WorkerMessagingProxy::postMessageToWorkerObject(const String& message)
+void WorkerMessagingProxy::postMessageToWorkerObject(const String& message, PassOwnPtr<MessagePortChannel> channel)
{
- m_scriptExecutionContext->postTask(MessageWorkerTask::create(message, this));
+ m_scriptExecutionContext->postTask(MessageWorkerTask::create(message, channel, this));
}
-void WorkerMessagingProxy::postMessageToWorkerContext(const String& message)
+void WorkerMessagingProxy::postMessageToWorkerContext(const String& message, PassOwnPtr<MessagePortChannel> channel)
{
if (m_askedToTerminate)
return;
if (m_workerThread) {
++m_unconfirmedMessageCount;
- m_workerThread->runLoop().postTask(MessageWorkerContextTask::create(message));
+ m_workerThread->runLoop().postTask(MessageWorkerContextTask::create(message, channel));
} else
- m_queuedEarlyTasks.append(MessageWorkerContextTask::create(message));
+ m_queuedEarlyTasks.append(MessageWorkerContextTask::create(message, channel));
}
void WorkerMessagingProxy::postTaskForModeToWorkerContext(PassRefPtr<ScriptExecutionContext::Task> task, const String& mode)
@@ -243,16 +255,16 @@ void WorkerMessagingProxy::postExceptionToWorkerObject(const String& errorMessag
m_scriptExecutionContext->postTask(WorkerExceptionTask::create(errorMessage, lineNumber, sourceURL, this));
}
-static void postConsoleMessageTask(ScriptExecutionContext* context, WorkerMessagingProxy* messagingProxy, MessageDestination destination, MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
+static void postConsoleMessageTask(ScriptExecutionContext* context, WorkerMessagingProxy* messagingProxy, MessageDestination destination, MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
{
if (messagingProxy->askedToTerminate())
return;
- context->addMessage(destination, source, level, message, lineNumber, sourceURL);
+ context->addMessage(destination, source, type, level, message, lineNumber, sourceURL);
}
-void WorkerMessagingProxy::postConsoleMessageToWorkerObject(MessageDestination destination, MessageSource source, MessageLevel level, const String& message, int lineNumber, const String& sourceURL)
+void WorkerMessagingProxy::postConsoleMessageToWorkerObject(MessageDestination destination, MessageSource source, MessageType type, MessageLevel level, const String& message, int lineNumber, const String& sourceURL)
{
- m_scriptExecutionContext->postTask(createCallbackTask(&postConsoleMessageTask, this, destination, source, level, message, lineNumber, sourceURL));
+ m_scriptExecutionContext->postTask(createCallbackTask(&postConsoleMessageTask, this, destination, source, type, level, message, lineNumber, sourceURL));
}
void WorkerMessagingProxy::workerThreadCreated(PassRefPtr<WorkerThread> workerThread)
diff --git a/src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.h b/src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.h
index 7fc9797..f9e1cd4 100644
--- a/src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.h
+++ b/src/3rdparty/webkit/WebCore/workers/WorkerMessagingProxy.h
@@ -34,12 +34,14 @@
#include "WorkerLoaderProxy.h"
#include "WorkerObjectProxy.h"
#include <wtf/Noncopyable.h>
+#include <wtf/PassOwnPtr.h>
#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
#include <wtf/Vector.h>
namespace WebCore {
+ class MessagePortChannel;
class ScriptExecutionContext;
class String;
class Worker;
@@ -53,15 +55,15 @@ namespace WebCore {
// (Only use these methods in the worker object thread.)
virtual void startWorkerContext(const KURL& scriptURL, const String& userAgent, const String& sourceCode);
virtual void terminateWorkerContext();
- virtual void postMessageToWorkerContext(const String& message);
+ virtual void postMessageToWorkerContext(const String&, PassOwnPtr<MessagePortChannel>);
virtual bool hasPendingActivity() const;
virtual void workerObjectDestroyed();
// Implementations of WorkerObjectProxy.
// (Only use these methods in the worker context thread.)
- virtual void postMessageToWorkerObject(const String& message);
+ virtual void postMessageToWorkerObject(const String&, PassOwnPtr<MessagePortChannel>);
virtual void postExceptionToWorkerObject(const String& errorMessage, int lineNumber, const String& sourceURL);
- virtual void postConsoleMessageToWorkerObject(MessageDestination, MessageSource, MessageLevel, const String& message, int lineNumber, const String& sourceURL);
+ virtual void postConsoleMessageToWorkerObject(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, int lineNumber, const String& sourceURL);
virtual void confirmMessageFromWorkerObject(bool hasPendingActivity);
virtual void reportPendingActivity(bool hasPendingActivity);
virtual void workerContextDestroyed();
diff --git a/src/3rdparty/webkit/WebCore/workers/WorkerObjectProxy.h b/src/3rdparty/webkit/WebCore/workers/WorkerObjectProxy.h
index 3b86028..c5f4456 100644
--- a/src/3rdparty/webkit/WebCore/workers/WorkerObjectProxy.h
+++ b/src/3rdparty/webkit/WebCore/workers/WorkerObjectProxy.h
@@ -35,8 +35,11 @@
#include "Console.h"
+#include <wtf/PassOwnPtr.h>
+
namespace WebCore {
+ class MessagePortChannel;
class String;
// A proxy to talk to the worker object.
@@ -44,11 +47,11 @@ namespace WebCore {
public:
virtual ~WorkerObjectProxy() {}
- virtual void postMessageToWorkerObject(const String&) = 0;
+ virtual void postMessageToWorkerObject(const String&, PassOwnPtr<MessagePortChannel>) = 0;
virtual void postExceptionToWorkerObject(const String& errorMessage, int lineNumber, const String& sourceURL) = 0;
- virtual void postConsoleMessageToWorkerObject(MessageDestination, MessageSource, MessageLevel, const String& message, int lineNumber, const String& sourceURL) = 0;
+ virtual void postConsoleMessageToWorkerObject(MessageDestination, MessageSource, MessageType, MessageLevel, const String& message, int lineNumber, const String& sourceURL) = 0;
virtual void confirmMessageFromWorkerObject(bool hasPendingActivity) = 0;
diff --git a/src/3rdparty/webkit/WebCore/workers/WorkerRunLoop.cpp b/src/3rdparty/webkit/WebCore/workers/WorkerRunLoop.cpp
index 1e5e510..b6f6487 100644
--- a/src/3rdparty/webkit/WebCore/workers/WorkerRunLoop.cpp
+++ b/src/3rdparty/webkit/WebCore/workers/WorkerRunLoop.cpp
@@ -125,8 +125,7 @@ String WorkerRunLoop::defaultMode()
return String();
}
-class RunLoopSetup : Noncopyable
-{
+class RunLoopSetup : Noncopyable {
public:
RunLoopSetup(WorkerRunLoop& runLoop)
: m_runLoop(runLoop)