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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 void ExecutionContext::stopActiveDOMObjects() | 100 void ExecutionContext::stopActiveDOMObjects() |
101 { | 101 { |
102 m_activeDOMObjectsAreStopped = true; | 102 m_activeDOMObjectsAreStopped = true; |
103 notifyStoppingActiveDOMObjects(); | 103 notifyStoppingActiveDOMObjects(); |
104 } | 104 } |
105 | 105 |
106 void ExecutionContext::postSuspendableTask(PassOwnPtr<SuspendableTask> task) | 106 void ExecutionContext::postSuspendableTask(PassOwnPtr<SuspendableTask> task) |
107 { | 107 { |
108 m_suspendedTasks.append(task); | 108 m_suspendedTasks.append(task); |
109 if (!m_activeDOMObjectsAreSuspended) | 109 if (!m_activeDOMObjectsAreSuspended) |
110 postTask(FROM_HERE, createSameThreadTask(&ExecutionContext::runSuspendab
leTasks, this)); | 110 postTask(BLINK_FROM_HERE, createSameThreadTask(&ExecutionContext::runSus
pendableTasks, this)); |
111 } | 111 } |
112 | 112 |
113 void ExecutionContext::notifyContextDestroyed() | 113 void ExecutionContext::notifyContextDestroyed() |
114 { | 114 { |
115 Deque<OwnPtr<SuspendableTask>> suspendedTasks; | 115 Deque<OwnPtr<SuspendableTask>> suspendedTasks; |
116 suspendedTasks.swap(m_suspendedTasks); | 116 suspendedTasks.swap(m_suspendedTasks); |
117 for (Deque<OwnPtr<SuspendableTask>>::iterator it = suspendedTasks.begin(); i
t != suspendedTasks.end(); ++it) | 117 for (Deque<OwnPtr<SuspendableTask>>::iterator it = suspendedTasks.begin(); i
t != suspendedTasks.end(); ++it) |
118 (*it)->contextDestroyed(); | 118 (*it)->contextDestroyed(); |
119 ContextLifecycleNotifier::notifyContextDestroyed(); | 119 ContextLifecycleNotifier::notifyContextDestroyed(); |
120 } | 120 } |
121 | 121 |
122 void ExecutionContext::suspendScheduledTasks() | 122 void ExecutionContext::suspendScheduledTasks() |
123 { | 123 { |
124 suspendActiveDOMObjects(); | 124 suspendActiveDOMObjects(); |
125 tasksWereSuspended(); | 125 tasksWereSuspended(); |
126 } | 126 } |
127 | 127 |
128 void ExecutionContext::resumeScheduledTasks() | 128 void ExecutionContext::resumeScheduledTasks() |
129 { | 129 { |
130 resumeActiveDOMObjects(); | 130 resumeActiveDOMObjects(); |
131 tasksWereResumed(); | 131 tasksWereResumed(); |
132 // We need finish stack unwiding before running next task because it can sus
pend this context. | 132 // We need finish stack unwiding before running next task because it can sus
pend this context. |
133 if (m_isRunSuspendableTasksScheduled) | 133 if (m_isRunSuspendableTasksScheduled) |
134 return; | 134 return; |
135 m_isRunSuspendableTasksScheduled = true; | 135 m_isRunSuspendableTasksScheduled = true; |
136 postTask(FROM_HERE, createSameThreadTask(&ExecutionContext::runSuspendableTa
sks, this)); | 136 postTask(BLINK_FROM_HERE, createSameThreadTask(&ExecutionContext::runSuspend
ableTasks, this)); |
137 } | 137 } |
138 | 138 |
139 void ExecutionContext::suspendActiveDOMObjectIfNeeded(ActiveDOMObject* object) | 139 void ExecutionContext::suspendActiveDOMObjectIfNeeded(ActiveDOMObject* object) |
140 { | 140 { |
141 ASSERT(contains(object)); | 141 ASSERT(contains(object)); |
142 // Ensure all ActiveDOMObjects are suspended also newly created ones. | 142 // Ensure all ActiveDOMObjects are suspended also newly created ones. |
143 if (m_activeDOMObjectsAreSuspended) | 143 if (m_activeDOMObjectsAreSuspended) |
144 object->suspend(); | 144 object->suspend(); |
145 } | 145 } |
146 | 146 |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
297 { | 297 { |
298 #if ENABLE(OILPAN) | 298 #if ENABLE(OILPAN) |
299 visitor->trace(m_pendingExceptions); | 299 visitor->trace(m_pendingExceptions); |
300 visitor->trace(m_publicURLManager); | 300 visitor->trace(m_publicURLManager); |
301 HeapSupplementable<ExecutionContext>::trace(visitor); | 301 HeapSupplementable<ExecutionContext>::trace(visitor); |
302 #endif | 302 #endif |
303 ContextLifecycleNotifier::trace(visitor); | 303 ContextLifecycleNotifier::trace(visitor); |
304 } | 304 } |
305 | 305 |
306 } // namespace blink | 306 } // namespace blink |
OLD | NEW |