OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2009, 2011 Google Inc. All Rights Reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
49 #include "core/workers/WorkerClients.h" | 49 #include "core/workers/WorkerClients.h" |
50 #include "core/workers/WorkerLocation.h" | 50 #include "core/workers/WorkerLocation.h" |
51 #include "core/workers/WorkerReportingProxy.h" | 51 #include "core/workers/WorkerReportingProxy.h" |
52 #include "core/workers/WorkerScriptLoader.h" | 52 #include "core/workers/WorkerScriptLoader.h" |
53 #include "core/workers/WorkerThread.h" | 53 #include "core/workers/WorkerThread.h" |
54 #include "platform/weborigin/KURL.h" | 54 #include "platform/weborigin/KURL.h" |
55 #include "platform/weborigin/SecurityOrigin.h" | 55 #include "platform/weborigin/SecurityOrigin.h" |
56 | 56 |
57 namespace WebCore { | 57 namespace WebCore { |
58 | 58 |
| 59 DEFINE_GC_INFO(WorkerGlobalScope); |
| 60 |
59 class CloseWorkerGlobalScopeTask : public ExecutionContextTask { | 61 class CloseWorkerGlobalScopeTask : public ExecutionContextTask { |
60 public: | 62 public: |
61 static PassOwnPtr<CloseWorkerGlobalScopeTask> create() | 63 static PassOwnPtr<CloseWorkerGlobalScopeTask> create() |
62 { | 64 { |
63 return adoptPtr(new CloseWorkerGlobalScopeTask); | 65 return adoptPtr(new CloseWorkerGlobalScopeTask); |
64 } | 66 } |
65 | 67 |
66 virtual void performTask(ExecutionContext *context) | 68 virtual void performTask(ExecutionContext *context) |
67 { | 69 { |
68 WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context); | 70 WorkerGlobalScope* workerGlobalScope = toWorkerGlobalScope(context); |
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
198 const KURL& url = executionContext()->completeURL(*it); | 200 const KURL& url = executionContext()->completeURL(*it); |
199 if (!url.isValid()) { | 201 if (!url.isValid()) { |
200 exceptionState.throwDOMException(SyntaxError, "The URL '" + *it + "'
is invalid."); | 202 exceptionState.throwDOMException(SyntaxError, "The URL '" + *it + "'
is invalid."); |
201 return; | 203 return; |
202 } | 204 } |
203 completedURLs.append(url); | 205 completedURLs.append(url); |
204 } | 206 } |
205 Vector<KURL>::const_iterator end = completedURLs.end(); | 207 Vector<KURL>::const_iterator end = completedURLs.end(); |
206 | 208 |
207 for (Vector<KURL>::const_iterator it = completedURLs.begin(); it != end; ++i
t) { | 209 for (Vector<KURL>::const_iterator it = completedURLs.begin(); it != end; ++i
t) { |
208 RefPtr<WorkerScriptLoader> scriptLoader(WorkerScriptLoader::create()); | 210 RefPtrWillBeRawPtr<WorkerScriptLoader> scriptLoader(WorkerScriptLoader::
create()); |
209 scriptLoader->setTargetType(ResourceRequest::TargetIsScript); | 211 scriptLoader->setTargetType(ResourceRequest::TargetIsScript); |
210 scriptLoader->loadSynchronously(executionContext(), *it, AllowCrossOrigi
nRequests); | 212 scriptLoader->loadSynchronously(executionContext(), *it, AllowCrossOrigi
nRequests); |
211 | 213 |
212 // If the fetching attempt failed, throw a NetworkError exception and ab
ort all these steps. | 214 // If the fetching attempt failed, throw a NetworkError exception and ab
ort all these steps. |
213 if (scriptLoader->failed()) { | 215 if (scriptLoader->failed()) { |
214 exceptionState.throwDOMException(NetworkError, "The script at '" + i
t->elidedString() + "' failed to load."); | 216 exceptionState.throwDOMException(NetworkError, "The script at '" + i
t->elidedString() + "' failed to load."); |
215 return; | 217 return; |
216 } | 218 } |
217 | 219 |
218 InspectorInstrumentation::scriptImported(executionContext(), scriptLoade
r->identifier(), scriptLoader->script()); | 220 InspectorInstrumentation::scriptImported(executionContext(), scriptLoade
r->identifier(), scriptLoader->script()); |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 bool WorkerGlobalScope::idleNotification() | 275 bool WorkerGlobalScope::idleNotification() |
274 { | 276 { |
275 return script()->idleNotification(); | 277 return script()->idleNotification(); |
276 } | 278 } |
277 | 279 |
278 WorkerEventQueue* WorkerGlobalScope::eventQueue() const | 280 WorkerEventQueue* WorkerGlobalScope::eventQueue() const |
279 { | 281 { |
280 return m_eventQueue.get(); | 282 return m_eventQueue.get(); |
281 } | 283 } |
282 | 284 |
| 285 void WorkerGlobalScope::trace(Visitor* visitor) |
| 286 { |
| 287 visitor->trace(m_console); |
| 288 visitor->trace(m_location); |
| 289 visitor->trace(m_navigator); |
| 290 } |
| 291 |
283 } // namespace WebCore | 292 } // namespace WebCore |
OLD | NEW |