|
Lines 1-5
a/WebCore/dom/WorkerMessagingProxy.cpp_sec1
|
| 1 |
/* |
1 |
/* |
| 2 |
* Copyright (C) 2008 Apple Inc. All Rights Reserved. |
2 |
* Copyright (C) 2008 Apple Inc. All Rights Reserved. |
|
|
3 |
* Copyright (C) 2008 David Levin (levin@chromium.org) |
| 3 |
* |
4 |
* |
| 4 |
* Redistribution and use in source and binary forms, with or without |
5 |
* Redistribution and use in source and binary forms, with or without |
| 5 |
* modification, are permitted provided that the following conditions |
6 |
* modification, are permitted provided that the following conditions |
|
Lines 33-38
a/WebCore/dom/WorkerMessagingProxy.cpp_sec2
|
| 33 |
#include "DOMWindow.h" |
34 |
#include "DOMWindow.h" |
| 34 |
#include "Document.h" |
35 |
#include "Document.h" |
| 35 |
#include "MessageEvent.h" |
36 |
#include "MessageEvent.h" |
|
|
37 |
#include "ScriptString.h" |
| 36 |
#include "Worker.h" |
38 |
#include "Worker.h" |
| 37 |
#include "WorkerContext.h" |
39 |
#include "WorkerContext.h" |
| 38 |
#include "WorkerTask.h" |
40 |
#include "WorkerTask.h" |
|
Lines 141-146
private:
a/WebCore/dom/WorkerMessagingProxy.cpp_sec3
|
| 141 |
WorkerMessagingProxy* m_messagingProxy; |
143 |
WorkerMessagingProxy* m_messagingProxy; |
| 142 |
}; |
144 |
}; |
| 143 |
|
145 |
|
|
|
146 |
class WorkerMessageToConsoleTask : public ScriptExecutionContext::Task { |
| 147 |
public: |
| 148 |
static PassRefPtr<WorkerMessageToConsoleTask> create(MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL, bool inspectorOnly, WorkerMessagingProxy* messagingProxy) |
| 149 |
{ |
| 150 |
return adoptRef(new WorkerMessageToConsoleTask(source, level, message, lineNumber, sourceURL, inspectorOnly, messagingProxy)); |
| 151 |
} |
| 152 |
|
| 153 |
private: |
| 154 |
WorkerMessageToConsoleTask(MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL, bool inspectorOnly, WorkerMessagingProxy* messagingProxy) |
| 155 |
: m_source(source) |
| 156 |
, m_level(level) |
| 157 |
, m_message(message.copy()) |
| 158 |
, m_lineNumber(lineNumber) |
| 159 |
, m_sourceURL(sourceURL.copy()) |
| 160 |
, m_inspectorOnly(inspectorOnly) |
| 161 |
, m_messagingProxy(messagingProxy) |
| 162 |
{ |
| 163 |
} |
| 164 |
|
| 165 |
virtual void performTask(ScriptExecutionContext* context) |
| 166 |
{ |
| 167 |
if (m_messagingProxy->askedToTerminate()) |
| 168 |
return; |
| 169 |
context->addMessageToConsole(m_source, m_level, m_message, m_lineNumber, m_sourceURL, m_inspectorOnly); |
| 170 |
} |
| 171 |
|
| 172 |
private: |
| 173 |
MessageSource m_source; |
| 174 |
MessageLevel m_level; |
| 175 |
String m_message; |
| 176 |
unsigned m_lineNumber; |
| 177 |
String m_sourceURL; |
| 178 |
bool m_inspectorOnly; |
| 179 |
WorkerMessagingProxy* m_messagingProxy; |
| 180 |
}; |
| 181 |
|
| 182 |
class WorkerResourceRetrievedByXMLHttpRequestTask : public ScriptExecutionContext::Task { |
| 183 |
public: |
| 184 |
static PassRefPtr<WorkerResourceRetrievedByXMLHttpRequestTask> create(unsigned long identifier, const ScriptString& sourceString, WorkerMessagingProxy* messagingProxy) |
| 185 |
{ |
| 186 |
return adoptRef(new WorkerResourceRetrievedByXMLHttpRequestTask(identifier, sourceString, messagingProxy)); |
| 187 |
} |
| 188 |
|
| 189 |
private: |
| 190 |
WorkerResourceRetrievedByXMLHttpRequestTask(unsigned long identifier, const ScriptString& sourceString, WorkerMessagingProxy* messagingProxy) |
| 191 |
: m_identifier(identifier) |
| 192 |
, m_sourceString(sourceString.copy()) |
| 193 |
, m_messagingProxy(messagingProxy) |
| 194 |
{ |
| 195 |
} |
| 196 |
|
| 197 |
virtual void performTask(ScriptExecutionContext* context) |
| 198 |
{ |
| 199 |
if (m_messagingProxy->askedToTerminate()) |
| 200 |
return; |
| 201 |
context->resourceRetrievedByXMLHttpRequest(m_identifier, m_sourceString); |
| 202 |
} |
| 203 |
|
| 204 |
private: |
| 205 |
unsigned long m_identifier; |
| 206 |
ScriptString m_sourceString; |
| 207 |
WorkerMessagingProxy* m_messagingProxy; |
| 208 |
}; |
| 209 |
|
| 144 |
class WorkerContextDestroyedTask : public ScriptExecutionContext::Task { |
210 |
class WorkerContextDestroyedTask : public ScriptExecutionContext::Task { |
| 145 |
public: |
211 |
public: |
| 146 |
static PassRefPtr<WorkerContextDestroyedTask> create(WorkerMessagingProxy* messagingProxy) |
212 |
static PassRefPtr<WorkerContextDestroyedTask> create(WorkerMessagingProxy* messagingProxy) |
|
Lines 231-236
void WorkerMessagingProxy::postWorkerException(const String& errorMessage, int l
a/WebCore/dom/WorkerMessagingProxy.cpp_sec4
|
| 231 |
m_scriptExecutionContext->postTask(WorkerExceptionTask::create(errorMessage, lineNumber, sourceURL, this)); |
297 |
m_scriptExecutionContext->postTask(WorkerExceptionTask::create(errorMessage, lineNumber, sourceURL, this)); |
| 232 |
} |
298 |
} |
| 233 |
|
299 |
|
|
|
300 |
void WorkerMessagingProxy::postMessageToConsole(MessageSource source, MessageLevel level, const String& message, unsigned lineNumber, const String& sourceURL, bool inspectorOnly) |
| 301 |
{ |
| 302 |
m_scriptExecutionContext->postTask(WorkerMessageToConsoleTask::create(source, level, message, lineNumber, sourceURL, inspectorOnly, this)); |
| 303 |
} |
| 304 |
|
| 305 |
void WorkerMessagingProxy::postResourceRetrievedByXMLHttpRequest(unsigned long identifier, const ScriptString& sourceString) |
| 306 |
{ |
| 307 |
m_scriptExecutionContext->postTask(WorkerResourceRetrievedByXMLHttpRequestTask::create(identifier, sourceString, this)); |
| 308 |
} |
| 309 |
|
| 234 |
void WorkerMessagingProxy::workerThreadCreated(PassRefPtr<WorkerThread> workerThread) |
310 |
void WorkerMessagingProxy::workerThreadCreated(PassRefPtr<WorkerThread> workerThread) |
| 235 |
{ |
311 |
{ |
| 236 |
m_workerThread = workerThread; |
312 |
m_workerThread = workerThread; |