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) 2012 Google Inc. All Rights Reserved. | 3 * Copyright (C) 2012 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 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 notifySuspendingActiveDOMObjects(); | 60 notifySuspendingActiveDOMObjects(); |
61 m_activeDOMObjectsAreSuspended = true; | 61 m_activeDOMObjectsAreSuspended = true; |
62 } | 62 } |
63 | 63 |
64 void ExecutionContext::resumeActiveDOMObjects() { | 64 void ExecutionContext::resumeActiveDOMObjects() { |
65 DCHECK(m_activeDOMObjectsAreSuspended); | 65 DCHECK(m_activeDOMObjectsAreSuspended); |
66 m_activeDOMObjectsAreSuspended = false; | 66 m_activeDOMObjectsAreSuspended = false; |
67 notifyResumingActiveDOMObjects(); | 67 notifyResumingActiveDOMObjects(); |
68 } | 68 } |
69 | 69 |
70 void ExecutionContext::stopActiveDOMObjects() { | |
71 m_activeDOMObjectsAreStopped = true; | |
72 notifyStoppingActiveDOMObjects(); | |
73 } | |
74 | |
75 void ExecutionContext::postSuspendableTask( | 70 void ExecutionContext::postSuspendableTask( |
76 std::unique_ptr<SuspendableTask> task) { | 71 std::unique_ptr<SuspendableTask> task) { |
77 m_suspendedTasks.append(std::move(task)); | 72 m_suspendedTasks.append(std::move(task)); |
78 if (!m_activeDOMObjectsAreSuspended) | 73 if (!m_activeDOMObjectsAreSuspended) |
79 postTask(BLINK_FROM_HERE, | 74 postTask(BLINK_FROM_HERE, |
80 createSameThreadTask(&ExecutionContext::runSuspendableTasks, | 75 createSameThreadTask(&ExecutionContext::runSuspendableTasks, |
81 wrapPersistent(this))); | 76 wrapPersistent(this))); |
82 } | 77 } |
83 | 78 |
84 void ExecutionContext::notifyContextDestroyed() { | 79 void ExecutionContext::notifyContextDestroyed() { |
| 80 m_activeDOMObjectsAreStopped = true; |
| 81 |
85 Deque<std::unique_ptr<SuspendableTask>> suspendedTasks; | 82 Deque<std::unique_ptr<SuspendableTask>> suspendedTasks; |
86 suspendedTasks.swap(m_suspendedTasks); | 83 suspendedTasks.swap(m_suspendedTasks); |
87 for (Deque<std::unique_ptr<SuspendableTask>>::iterator it = | 84 for (Deque<std::unique_ptr<SuspendableTask>>::iterator it = |
88 suspendedTasks.begin(); | 85 suspendedTasks.begin(); |
89 it != suspendedTasks.end(); ++it) | 86 it != suspendedTasks.end(); ++it) |
90 (*it)->contextDestroyed(); | 87 (*it)->contextDestroyed(); |
91 ContextLifecycleNotifier::notifyContextDestroyed(); | 88 ContextLifecycleNotifier::notifyContextDestroyed(); |
92 } | 89 } |
93 | 90 |
94 void ExecutionContext::suspendScheduledTasks() { | 91 void ExecutionContext::suspendScheduledTasks() { |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
273 } | 270 } |
274 | 271 |
275 DEFINE_TRACE(ExecutionContext) { | 272 DEFINE_TRACE(ExecutionContext) { |
276 visitor->trace(m_publicURLManager); | 273 visitor->trace(m_publicURLManager); |
277 visitor->trace(m_pendingExceptions); | 274 visitor->trace(m_pendingExceptions); |
278 ContextLifecycleNotifier::trace(visitor); | 275 ContextLifecycleNotifier::trace(visitor); |
279 Supplementable<ExecutionContext>::trace(visitor); | 276 Supplementable<ExecutionContext>::trace(visitor); |
280 } | 277 } |
281 | 278 |
282 } // namespace blink | 279 } // namespace blink |
OLD | NEW |