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) 2011 Google Inc. All Rights Reserved. | 3 * Copyright (C) 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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 } | 155 } |
156 } | 156 } |
157 | 157 |
158 void WorkerScriptController::setException(ScriptValue exception) | 158 void WorkerScriptController::setException(ScriptValue exception) |
159 { | 159 { |
160 throwError(m_workerContextWrapper->globalExec(), exception.jsValue()); | 160 throwError(m_workerContextWrapper->globalExec(), exception.jsValue()); |
161 } | 161 } |
162 | 162 |
163 void WorkerScriptController::scheduleExecutionTermination() | 163 void WorkerScriptController::scheduleExecutionTermination() |
164 { | 164 { |
| 165 MutexLocker locker(m_scheduledTerminationMutex); |
165 m_globalData->terminator.terminateSoon(); | 166 m_globalData->terminator.terminateSoon(); |
166 } | 167 } |
167 | 168 |
| 169 bool WorkerScriptController::isExecutionTerminating() const |
| 170 { |
| 171 MutexLocker locker(m_scheduledTerminationMutex); |
| 172 return m_globalData->terminator.shouldTerminate(); |
| 173 } |
| 174 |
168 void WorkerScriptController::forbidExecution() | 175 void WorkerScriptController::forbidExecution() |
169 { | 176 { |
170 ASSERT(m_workerContext->isContextThread()); | 177 ASSERT(m_workerContext->isContextThread()); |
171 m_executionForbidden = true; | 178 m_executionForbidden = true; |
172 } | 179 } |
173 | 180 |
174 bool WorkerScriptController::isExecutionForbidden() const | 181 bool WorkerScriptController::isExecutionForbidden() const |
175 { | 182 { |
176 ASSERT(m_workerContext->isContextThread()); | 183 ASSERT(m_workerContext->isContextThread()); |
177 return m_executionForbidden; | 184 return m_executionForbidden; |
178 } | 185 } |
179 | 186 |
180 void WorkerScriptController::disableEval() | 187 void WorkerScriptController::disableEval() |
181 { | 188 { |
182 initScriptIfNeeded(); | 189 initScriptIfNeeded(); |
183 JSLock lock(SilenceAssertionsOnly); | 190 JSLock lock(SilenceAssertionsOnly); |
184 | 191 |
185 m_workerContextWrapper->setEvalEnabled(false); | 192 m_workerContextWrapper->setEvalEnabled(false); |
186 } | 193 } |
187 | 194 |
188 } // namespace WebCore | 195 } // namespace WebCore |
189 | 196 |
190 #endif // ENABLE(WORKERS) | 197 #endif // ENABLE(WORKERS) |
OLD | NEW |