| 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 25 matching lines...) Expand all Loading... |
| 36 #include "core/dom/ContextLifecycleNotifier.h" | 36 #include "core/dom/ContextLifecycleNotifier.h" |
| 37 #include "core/dom/ErrorEvent.h" | 37 #include "core/dom/ErrorEvent.h" |
| 38 #include "core/dom/Event.h" | 38 #include "core/dom/Event.h" |
| 39 #include "core/dom/MessagePort.h" | 39 #include "core/dom/MessagePort.h" |
| 40 #include "core/html/DOMURL.h" | 40 #include "core/html/DOMURL.h" |
| 41 #include "core/inspector/InspectorConsoleInstrumentation.h" | 41 #include "core/inspector/InspectorConsoleInstrumentation.h" |
| 42 #include "core/inspector/ScriptCallStack.h" | 42 #include "core/inspector/ScriptCallStack.h" |
| 43 #include "core/inspector/WorkerInspectorController.h" | 43 #include "core/inspector/WorkerInspectorController.h" |
| 44 #include "core/loader/WorkerThreadableLoader.h" | 44 #include "core/loader/WorkerThreadableLoader.h" |
| 45 #include "core/page/ContentSecurityPolicy.h" | 45 #include "core/page/ContentSecurityPolicy.h" |
| 46 #include "core/page/DOMTimer.h" | |
| 47 #include "core/page/DOMWindow.h" | 46 #include "core/page/DOMWindow.h" |
| 48 #include "core/page/WorkerNavigator.h" | 47 #include "core/page/WorkerNavigator.h" |
| 49 #include "core/platform/NotImplemented.h" | 48 #include "core/platform/NotImplemented.h" |
| 50 #include "core/workers/WorkerLocation.h" | 49 #include "core/workers/WorkerLocation.h" |
| 51 #include "core/workers/WorkerObjectProxy.h" | 50 #include "core/workers/WorkerObjectProxy.h" |
| 52 #include "core/workers/WorkerScriptLoader.h" | 51 #include "core/workers/WorkerScriptLoader.h" |
| 53 #include "core/workers/WorkerThread.h" | 52 #include "core/workers/WorkerThread.h" |
| 54 #include "weborigin/KURL.h" | 53 #include "weborigin/KURL.h" |
| 55 #include "weborigin/SecurityOrigin.h" | 54 #include "weborigin/SecurityOrigin.h" |
| 56 #include "wtf/RefPtr.h" | 55 #include "wtf/RefPtr.h" |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 if (!m_navigator) | 171 if (!m_navigator) |
| 173 m_navigator = WorkerNavigator::create(m_userAgent); | 172 m_navigator = WorkerNavigator::create(m_userAgent); |
| 174 return m_navigator.get(); | 173 return m_navigator.get(); |
| 175 } | 174 } |
| 176 | 175 |
| 177 void WorkerGlobalScope::postTask(PassOwnPtr<Task> task) | 176 void WorkerGlobalScope::postTask(PassOwnPtr<Task> task) |
| 178 { | 177 { |
| 179 thread()->runLoop().postTask(task); | 178 thread()->runLoop().postTask(task); |
| 180 } | 179 } |
| 181 | 180 |
| 182 int WorkerGlobalScope::setTimeout(PassOwnPtr<ScheduledAction> action, int timeou
t) | |
| 183 { | |
| 184 return DOMTimer::install(scriptExecutionContext(), action, timeout, true); | |
| 185 } | |
| 186 | |
| 187 void WorkerGlobalScope::clearTimeout(int timeoutID) | |
| 188 { | |
| 189 DOMTimer::removeByID(scriptExecutionContext(), timeoutID); | |
| 190 } | |
| 191 | |
| 192 void WorkerGlobalScope::clearInspector() | 181 void WorkerGlobalScope::clearInspector() |
| 193 { | 182 { |
| 194 m_workerInspectorController.clear(); | 183 m_workerInspectorController.clear(); |
| 195 } | 184 } |
| 196 | 185 |
| 197 int WorkerGlobalScope::setInterval(PassOwnPtr<ScheduledAction> action, int timeo
ut) | |
| 198 { | |
| 199 return DOMTimer::install(scriptExecutionContext(), action, timeout, false); | |
| 200 } | |
| 201 | |
| 202 void WorkerGlobalScope::clearInterval(int timeoutID) | |
| 203 { | |
| 204 DOMTimer::removeByID(scriptExecutionContext(), timeoutID); | |
| 205 } | |
| 206 | |
| 207 void WorkerGlobalScope::importScripts(const Vector<String>& urls, ExceptionCode&
ec) | 186 void WorkerGlobalScope::importScripts(const Vector<String>& urls, ExceptionCode&
ec) |
| 208 { | 187 { |
| 209 ASSERT(contentSecurityPolicy()); | 188 ASSERT(contentSecurityPolicy()); |
| 210 ec = 0; | 189 ec = 0; |
| 211 Vector<String>::const_iterator urlsEnd = urls.end(); | 190 Vector<String>::const_iterator urlsEnd = urls.end(); |
| 212 Vector<KURL> completedURLs; | 191 Vector<KURL> completedURLs; |
| 213 for (Vector<String>::const_iterator it = urls.begin(); it != urlsEnd; ++it)
{ | 192 for (Vector<String>::const_iterator it = urls.begin(); it != urlsEnd; ++it)
{ |
| 214 const KURL& url = scriptExecutionContext()->completeURL(*it); | 193 const KURL& url = scriptExecutionContext()->completeURL(*it); |
| 215 if (!url.isValid()) { | 194 if (!url.isValid()) { |
| 216 ec = SyntaxError; | 195 ec = SyntaxError; |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 348 iter = m_workerObservers.begin(); | 327 iter = m_workerObservers.begin(); |
| 349 } | 328 } |
| 350 } | 329 } |
| 351 | 330 |
| 352 WorkerEventQueue* WorkerGlobalScope::eventQueue() const | 331 WorkerEventQueue* WorkerGlobalScope::eventQueue() const |
| 353 { | 332 { |
| 354 return m_eventQueue.get(); | 333 return m_eventQueue.get(); |
| 355 } | 334 } |
| 356 | 335 |
| 357 } // namespace WebCore | 336 } // namespace WebCore |
| OLD | NEW |