summaryrefslogtreecommitdiffstats
path: root/Source/WebCore/workers
diff options
context:
space:
mode:
authorBen Murdoch <benm@google.com>2011-05-16 16:25:10 +0100
committerBen Murdoch <benm@google.com>2011-05-23 18:54:14 +0100
commitab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb (patch)
treedb769fadd053248f85db67434a5b275224defef7 /Source/WebCore/workers
parent52e2557aeb8477967e97fd24f20f8f407a10fa15 (diff)
downloadexternal_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.zip
external_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.tar.gz
external_webkit-ab9e7a118cf1ea2e3a93dce683b2ded3e7291ddb.tar.bz2
Merge WebKit at r76408: Initial merge by git.
Change-Id: I5b91decbd693ccbf5c1b8354b37cd68cc9a1ea53
Diffstat (limited to 'Source/WebCore/workers')
-rw-r--r--Source/WebCore/workers/DefaultSharedWorkerRepository.cpp5
-rw-r--r--Source/WebCore/workers/DefaultSharedWorkerRepository.h3
-rw-r--r--Source/WebCore/workers/WorkerContext.cpp24
-rw-r--r--Source/WebCore/workers/WorkerContext.h10
-rw-r--r--Source/WebCore/workers/WorkerMessagingProxy.cpp5
-rw-r--r--Source/WebCore/workers/WorkerMessagingProxy.h3
-rw-r--r--Source/WebCore/workers/WorkerRunLoop.cpp3
-rw-r--r--Source/WebCore/workers/WorkerRunLoop.h3
-rw-r--r--Source/WebCore/workers/WorkerThread.cpp3
9 files changed, 31 insertions, 28 deletions
diff --git a/Source/WebCore/workers/DefaultSharedWorkerRepository.cpp b/Source/WebCore/workers/DefaultSharedWorkerRepository.cpp
index 3a14b62..c20cd30 100644
--- a/Source/WebCore/workers/DefaultSharedWorkerRepository.cpp
+++ b/Source/WebCore/workers/DefaultSharedWorkerRepository.cpp
@@ -42,6 +42,7 @@
#include "MessagePort.h"
#include "NotImplemented.h"
#include "PlatformString.h"
+#include "ScriptCallStack.h"
#include "SecurityOrigin.h"
#include "SecurityOriginHash.h"
#include "SharedWorker.h"
@@ -155,7 +156,7 @@ void SharedWorkerProxy::postTaskForModeToWorkerContext(PassOwnPtr<ScriptExecutio
static void postExceptionTask(ScriptExecutionContext* context, const String& errorMessage, int lineNumber, const String& sourceURL)
{
- context->reportException(errorMessage, lineNumber, sourceURL);
+ context->reportException(errorMessage, lineNumber, sourceURL, 0);
}
void SharedWorkerProxy::postExceptionToWorkerObject(const String& errorMessage, int lineNumber, const String& sourceURL)
@@ -167,7 +168,7 @@ void SharedWorkerProxy::postExceptionToWorkerObject(const String& errorMessage,
static void postConsoleMessageTask(ScriptExecutionContext* document, MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
{
- document->addMessage(source, type, level, message, lineNumber, sourceURL);
+ document->addMessage(source, type, level, message, lineNumber, sourceURL, 0);
}
void SharedWorkerProxy::postConsoleMessageToWorkerObject(MessageSource source, MessageType type, MessageLevel level, const String& message, int lineNumber, const String& sourceURL)
diff --git a/Source/WebCore/workers/DefaultSharedWorkerRepository.h b/Source/WebCore/workers/DefaultSharedWorkerRepository.h
index 21e14a1..435b613 100644
--- a/Source/WebCore/workers/DefaultSharedWorkerRepository.h
+++ b/Source/WebCore/workers/DefaultSharedWorkerRepository.h
@@ -53,7 +53,8 @@ namespace WebCore {
class SharedWorkerProxy;
// Platform-specific implementation of the SharedWorkerRepository static interface.
- class DefaultSharedWorkerRepository : public Noncopyable {
+ class DefaultSharedWorkerRepository {
+ WTF_MAKE_NONCOPYABLE(DefaultSharedWorkerRepository); WTF_MAKE_FAST_ALLOCATED;
public:
// Invoked once the worker script has been loaded to fire up the worker thread.
void workerScriptLoaded(SharedWorkerProxy&, const String& userAgent, const String& workerScript, PassOwnPtr<MessagePortChannel>);
diff --git a/Source/WebCore/workers/WorkerContext.cpp b/Source/WebCore/workers/WorkerContext.cpp
index d5d1ccc..36c4215 100644
--- a/Source/WebCore/workers/WorkerContext.cpp
+++ b/Source/WebCore/workers/WorkerContext.cpp
@@ -47,6 +47,7 @@
#include "KURL.h"
#include "MessagePort.h"
#include "NotImplemented.h"
+#include "ScriptCallStack.h"
#include "ScriptSourceCode.h"
#include "ScriptValue.h"
#include "SecurityOrigin.h"
@@ -103,7 +104,6 @@ WorkerContext::WorkerContext(const KURL& url, const String& userAgent, WorkerThr
, m_script(new WorkerScriptController(this))
, m_thread(thread)
, m_closing(false)
- , m_reportingException(false)
{
setSecurityOrigin(SecurityOrigin::create(url));
}
@@ -257,23 +257,17 @@ void WorkerContext::importScripts(const Vector<String>& urls, ExceptionCode& ec)
}
}
-void WorkerContext::reportException(const String& errorMessage, int lineNumber, const String& sourceURL)
+EventTarget* WorkerContext::errorEventTarget()
{
- bool errorHandled = false;
- if (!m_reportingException) {
- if (onerror()) {
- m_reportingException = true;
- RefPtr<ErrorEvent> errorEvent(ErrorEvent::create(errorMessage, sourceURL, lineNumber));
- onerror()->handleEvent(this, errorEvent.get());
- errorHandled = errorEvent->defaultPrevented();
- m_reportingException = false;
- }
- }
- if (!errorHandled)
- thread()->workerReportingProxy().postExceptionToWorkerObject(errorMessage, lineNumber, sourceURL);
+ return this;
+}
+
+void WorkerContext::logExceptionToConsole(const String& errorMessage, int lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack>)
+{
+ thread()->workerReportingProxy().postExceptionToWorkerObject(errorMessage, lineNumber, sourceURL);
}
-void WorkerContext::addMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL)
+void WorkerContext::addMessage(MessageSource source, MessageType type, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack>)
{
thread()->workerReportingProxy().postConsoleMessageToWorkerObject(source, type, level, message, lineNumber, sourceURL);
}
diff --git a/Source/WebCore/workers/WorkerContext.h b/Source/WebCore/workers/WorkerContext.h
index a0dbaae..2e802f2 100644
--- a/Source/WebCore/workers/WorkerContext.h
+++ b/Source/WebCore/workers/WorkerContext.h
@@ -101,8 +101,7 @@ namespace WebCore {
void clearInterval(int timeoutId);
// ScriptExecutionContext
- virtual void reportException(const String& errorMessage, int lineNumber, const String& sourceURL);
- virtual void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL);
+ virtual void addMessage(MessageSource, MessageType, MessageLevel, const String& message, unsigned lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack>);
#if ENABLE(NOTIFICATIONS)
NotificationCenter* webkitNotifications() const;
@@ -145,7 +144,8 @@ namespace WebCore {
bool isClosing() { return m_closing; }
// An observer interface to be notified when the worker thread is getting stopped.
- class Observer : public Noncopyable {
+ class Observer {
+ WTF_MAKE_NONCOPYABLE(Observer);
public:
Observer(WorkerContext*);
virtual ~Observer();
@@ -174,6 +174,9 @@ namespace WebCore {
virtual const KURL& virtualURL() const;
virtual KURL virtualCompleteURL(const String&) const;
+ virtual EventTarget* errorEventTarget();
+ virtual void logExceptionToConsole(const String& errorMessage, int lineNumber, const String& sourceURL, PassRefPtr<ScriptCallStack>);
+
KURL m_url;
String m_userAgent;
@@ -190,7 +193,6 @@ namespace WebCore {
mutable RefPtr<DOMURL> m_domURL;
#endif
bool m_closing;
- bool m_reportingException;
EventTargetData m_eventTargetData;
HashSet<Observer*> m_workerObservers;
diff --git a/Source/WebCore/workers/WorkerMessagingProxy.cpp b/Source/WebCore/workers/WorkerMessagingProxy.cpp
index e89ccb4..eca8e2e 100644
--- a/Source/WebCore/workers/WorkerMessagingProxy.cpp
+++ b/Source/WebCore/workers/WorkerMessagingProxy.cpp
@@ -39,6 +39,7 @@
#include "ErrorEvent.h"
#include "ExceptionCode.h"
#include "MessageEvent.h"
+#include "ScriptCallStack.h"
#include "ScriptExecutionContext.h"
#include "Worker.h"
@@ -130,7 +131,7 @@ private:
bool errorHandled = !workerObject->dispatchEvent(ErrorEvent::create(m_errorMessage, m_sourceURL, m_lineNumber));
if (!errorHandled)
- context->reportException(m_errorMessage, m_lineNumber, m_sourceURL);
+ context->reportException(m_errorMessage, m_lineNumber, m_sourceURL, 0);
}
String m_errorMessage;
@@ -282,7 +283,7 @@ static void postConsoleMessageTask(ScriptExecutionContext* context, WorkerMessag
{
if (messagingProxy->askedToTerminate())
return;
- context->addMessage(source, type, level, message, lineNumber, sourceURL);
+ context->addMessage(source, type, level, message, lineNumber, sourceURL, 0);
}
void WorkerMessagingProxy::postConsoleMessageToWorkerObject(MessageSource source, MessageType type, MessageLevel level, const String& message, int lineNumber, const String& sourceURL)
diff --git a/Source/WebCore/workers/WorkerMessagingProxy.h b/Source/WebCore/workers/WorkerMessagingProxy.h
index 33937ce..ab6113a 100644
--- a/Source/WebCore/workers/WorkerMessagingProxy.h
+++ b/Source/WebCore/workers/WorkerMessagingProxy.h
@@ -46,7 +46,8 @@ namespace WebCore {
class ScriptExecutionContext;
class Worker;
- class WorkerMessagingProxy : public WorkerContextProxy, public WorkerObjectProxy, public WorkerLoaderProxy, public Noncopyable {
+ class WorkerMessagingProxy : public WorkerContextProxy, public WorkerObjectProxy, public WorkerLoaderProxy {
+ WTF_MAKE_NONCOPYABLE(WorkerMessagingProxy); WTF_MAKE_FAST_ALLOCATED;
public:
WorkerMessagingProxy(Worker*);
diff --git a/Source/WebCore/workers/WorkerRunLoop.cpp b/Source/WebCore/workers/WorkerRunLoop.cpp
index 83f243f..7b3149c 100644
--- a/Source/WebCore/workers/WorkerRunLoop.cpp
+++ b/Source/WebCore/workers/WorkerRunLoop.cpp
@@ -104,7 +104,8 @@ String WorkerRunLoop::defaultMode()
return String();
}
-class RunLoopSetup : public Noncopyable {
+class RunLoopSetup {
+ WTF_MAKE_NONCOPYABLE(RunLoopSetup);
public:
RunLoopSetup(WorkerRunLoop& runLoop)
: m_runLoop(runLoop)
diff --git a/Source/WebCore/workers/WorkerRunLoop.h b/Source/WebCore/workers/WorkerRunLoop.h
index 9d4edfd..3feb4e8 100644
--- a/Source/WebCore/workers/WorkerRunLoop.h
+++ b/Source/WebCore/workers/WorkerRunLoop.h
@@ -65,7 +65,8 @@ namespace WebCore {
static String defaultMode();
- class Task : public Noncopyable {
+ class Task {
+ WTF_MAKE_NONCOPYABLE(Task); WTF_MAKE_FAST_ALLOCATED;
public:
static PassOwnPtr<Task> create(PassOwnPtr<ScriptExecutionContext::Task> task, const String& mode);
~Task() { }
diff --git a/Source/WebCore/workers/WorkerThread.cpp b/Source/WebCore/workers/WorkerThread.cpp
index f61120e..e1f1a66 100644
--- a/Source/WebCore/workers/WorkerThread.cpp
+++ b/Source/WebCore/workers/WorkerThread.cpp
@@ -61,7 +61,8 @@ unsigned WorkerThread::workerThreadCount()
return m_threadCount;
}
-struct WorkerThreadStartupData : Noncopyable {
+struct WorkerThreadStartupData {
+ WTF_MAKE_NONCOPYABLE(WorkerThreadStartupData); WTF_MAKE_FAST_ALLOCATED;
public:
static PassOwnPtr<WorkerThreadStartupData> create(const KURL& scriptURL, const String& userAgent, const String& sourceCode)
{