| 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 17 matching lines...) Expand all Loading... |
| 28 #include "config.h" | 28 #include "config.h" |
| 29 | 29 |
| 30 #include "core/workers/WorkerContext.h" | 30 #include "core/workers/WorkerContext.h" |
| 31 | 31 |
| 32 #include <wtf/RefPtr.h> | 32 #include <wtf/RefPtr.h> |
| 33 #include <wtf/UnusedParam.h> | 33 #include <wtf/UnusedParam.h> |
| 34 #include "bindings/v8/ScheduledAction.h" | 34 #include "bindings/v8/ScheduledAction.h" |
| 35 #include "bindings/v8/ScriptSourceCode.h" | 35 #include "bindings/v8/ScriptSourceCode.h" |
| 36 #include "bindings/v8/ScriptValue.h" | 36 #include "bindings/v8/ScriptValue.h" |
| 37 #include "core/dom/ActiveDOMObject.h" | 37 #include "core/dom/ActiveDOMObject.h" |
| 38 #include "core/dom/ContextLifecycleNotifier.h" | |
| 39 #include "core/dom/ErrorEvent.h" | 38 #include "core/dom/ErrorEvent.h" |
| 40 #include "core/dom/Event.h" | 39 #include "core/dom/Event.h" |
| 41 #include "core/dom/MessagePort.h" | 40 #include "core/dom/MessagePort.h" |
| 42 #include "core/html/DOMURL.h" | 41 #include "core/html/DOMURL.h" |
| 43 #include "core/inspector/InspectorConsoleInstrumentation.h" | 42 #include "core/inspector/InspectorConsoleInstrumentation.h" |
| 44 #include "core/inspector/ScriptCallStack.h" | 43 #include "core/inspector/ScriptCallStack.h" |
| 45 #include "core/inspector/WorkerInspectorController.h" | 44 #include "core/inspector/WorkerInspectorController.h" |
| 46 #include "core/loader/WorkerThreadableLoader.h" | 45 #include "core/loader/WorkerThreadableLoader.h" |
| 47 #include "core/page/ContentSecurityPolicy.h" | 46 #include "core/page/ContentSecurityPolicy.h" |
| 48 #include "core/page/DOMTimer.h" | 47 #include "core/page/DOMTimer.h" |
| (...skipping 120 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 postTask(CloseWorkerContextTask::create()); | 168 postTask(CloseWorkerContextTask::create()); |
| 170 } | 169 } |
| 171 | 170 |
| 172 WorkerNavigator* WorkerContext::navigator() const | 171 WorkerNavigator* WorkerContext::navigator() const |
| 173 { | 172 { |
| 174 if (!m_navigator) | 173 if (!m_navigator) |
| 175 m_navigator = WorkerNavigator::create(m_userAgent); | 174 m_navigator = WorkerNavigator::create(m_userAgent); |
| 176 return m_navigator.get(); | 175 return m_navigator.get(); |
| 177 } | 176 } |
| 178 | 177 |
| 178 bool WorkerContext::hasPendingActivity() const |
| 179 { |
| 180 ActiveDOMObjectsSet::const_iterator activeObjectsEnd = activeDOMObjects().en
d(); |
| 181 for (ActiveDOMObjectsSet::const_iterator iter = activeDOMObjects().begin();
iter != activeObjectsEnd; ++iter) { |
| 182 if ((*iter)->hasPendingActivity()) |
| 183 return true; |
| 184 } |
| 185 |
| 186 HashSet<MessagePort*>::const_iterator messagePortsEnd = messagePorts().end()
; |
| 187 for (HashSet<MessagePort*>::const_iterator iter = messagePorts().begin(); it
er != messagePortsEnd; ++iter) { |
| 188 if ((*iter)->hasPendingActivity()) |
| 189 return true; |
| 190 } |
| 191 |
| 192 return false; |
| 193 } |
| 194 |
| 179 void WorkerContext::postTask(PassOwnPtr<Task> task) | 195 void WorkerContext::postTask(PassOwnPtr<Task> task) |
| 180 { | 196 { |
| 181 thread()->runLoop().postTask(task); | 197 thread()->runLoop().postTask(task); |
| 182 } | 198 } |
| 183 | 199 |
| 184 int WorkerContext::setTimeout(PassOwnPtr<ScheduledAction> action, int timeout) | 200 int WorkerContext::setTimeout(PassOwnPtr<ScheduledAction> action, int timeout) |
| 185 { | 201 { |
| 186 return DOMTimer::install(scriptExecutionContext(), action, timeout, true); | 202 return DOMTimer::install(scriptExecutionContext(), action, timeout, true); |
| 187 } | 203 } |
| 188 | 204 |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 350 iter = m_workerObservers.begin(); | 366 iter = m_workerObservers.begin(); |
| 351 } | 367 } |
| 352 } | 368 } |
| 353 | 369 |
| 354 WorkerEventQueue* WorkerContext::eventQueue() const | 370 WorkerEventQueue* WorkerContext::eventQueue() const |
| 355 { | 371 { |
| 356 return m_eventQueue.get(); | 372 return m_eventQueue.get(); |
| 357 } | 373 } |
| 358 | 374 |
| 359 } // namespace WebCore | 375 } // namespace WebCore |
| OLD | NEW |