| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. | 2 * Copyright (C) 2008 Apple Inc. All Rights Reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 60 void evaluate(const ScriptSourceCode&, ScriptValue* exception); | 60 void evaluate(const ScriptSourceCode&, ScriptValue* exception); |
| 61 | 61 |
| 62 void setException(ScriptValue); | 62 void setException(ScriptValue); |
| 63 | 63 |
| 64 // Async request to terminate a JS run execution. Eventually causes term
ination | 64 // Async request to terminate a JS run execution. Eventually causes term
ination |
| 65 // exception raised during JS execution, if the worker thread happens to
run JS. | 65 // exception raised during JS execution, if the worker thread happens to
run JS. |
| 66 // After JS execution was terminated in this way, the Worker thread has
to use | 66 // After JS execution was terminated in this way, the Worker thread has
to use |
| 67 // forbidExecution()/isExecutionForbidden() to guard against reentry int
o JS. | 67 // forbidExecution()/isExecutionForbidden() to guard against reentry int
o JS. |
| 68 // Can be called from any thread. | 68 // Can be called from any thread. |
| 69 void scheduleExecutionTermination(); | 69 void scheduleExecutionTermination(); |
| 70 bool isExecutionTerminating() const; |
| 70 | 71 |
| 71 // Called on Worker thread when JS exits with termination exception caus
ed by forbidExecution() request, | 72 // Called on Worker thread when JS exits with termination exception caus
ed by forbidExecution() request, |
| 72 // or by Worker thread termination code to prevent future entry into JS. | 73 // or by Worker thread termination code to prevent future entry into JS. |
| 73 void forbidExecution(); | 74 void forbidExecution(); |
| 74 bool isExecutionForbidden() const; | 75 bool isExecutionForbidden() const; |
| 75 | 76 |
| 76 void disableEval(); | 77 void disableEval(); |
| 77 | 78 |
| 78 JSC::JSGlobalData* globalData() { return m_globalData.get(); } | 79 JSC::JSGlobalData* globalData() { return m_globalData.get(); } |
| 79 | 80 |
| 80 private: | 81 private: |
| 81 void initScriptIfNeeded() | 82 void initScriptIfNeeded() |
| 82 { | 83 { |
| 83 if (!m_workerContextWrapper) | 84 if (!m_workerContextWrapper) |
| 84 initScript(); | 85 initScript(); |
| 85 } | 86 } |
| 86 void initScript(); | 87 void initScript(); |
| 87 | 88 |
| 88 RefPtr<JSC::JSGlobalData> m_globalData; | 89 RefPtr<JSC::JSGlobalData> m_globalData; |
| 89 WorkerContext* m_workerContext; | 90 WorkerContext* m_workerContext; |
| 90 JSC::Strong<JSWorkerContext> m_workerContextWrapper; | 91 JSC::Strong<JSWorkerContext> m_workerContextWrapper; |
| 91 bool m_executionForbidden; | 92 bool m_executionForbidden; |
| 93 mutable Mutex m_scheduledTerminationMutex; |
| 92 }; | 94 }; |
| 93 | 95 |
| 94 } // namespace WebCore | 96 } // namespace WebCore |
| 95 | 97 |
| 96 #endif // ENABLE(WORKERS) | 98 #endif // ENABLE(WORKERS) |
| 97 | 99 |
| 98 #endif // WorkerScriptController_h | 100 #endif // WorkerScriptController_h |
| OLD | NEW |