OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2012 Google 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 are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * 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 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
11 * copyright notice, this list of conditions and the following disclaimer | 11 * copyright notice, this list of conditions and the following disclaimer |
12 * in the documentation and/or other materials provided with the | 12 * in the documentation and/or other materials provided with the |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 void evaluate(const ScriptSourceCode&, ScriptValue* exception); | 59 void evaluate(const ScriptSourceCode&, ScriptValue* exception); |
60 | 60 |
61 void setException(ScriptValue); | 61 void setException(ScriptValue); |
62 | 62 |
63 // Async request to terminate a future JS execution. Eventually causes t
ermination | 63 // Async request to terminate a future JS execution. Eventually causes t
ermination |
64 // exception raised during JS execution, if the worker thread happens to
run JS. | 64 // exception raised during JS execution, if the worker thread happens to
run JS. |
65 // After JS execution was terminated in this way, the Worker thread has
to use | 65 // After JS execution was terminated in this way, the Worker thread has
to use |
66 // forbidExecution()/isExecutionForbidden() to guard against reentry int
o JS. | 66 // forbidExecution()/isExecutionForbidden() to guard against reentry int
o JS. |
67 // Can be called from any thread. | 67 // Can be called from any thread. |
68 void scheduleExecutionTermination(); | 68 void scheduleExecutionTermination(); |
| 69 bool isExecutionTerminating() const; |
69 | 70 |
70 // Called on Worker thread when JS exits with termination exception caus
ed by forbidExecution() request, | 71 // Called on Worker thread when JS exits with termination exception caus
ed by forbidExecution() request, |
71 // or by Worker thread termination code to prevent future entry into JS. | 72 // or by Worker thread termination code to prevent future entry into JS. |
72 void forbidExecution(); | 73 void forbidExecution(); |
73 bool isExecutionForbidden() const; | 74 bool isExecutionForbidden() const; |
74 | 75 |
75 void disableEval(); | 76 void disableEval(); |
76 | 77 |
77 // Returns WorkerScriptController for the currently executing context. 0
will be returned if the current executing context is not the worker context. | 78 // Returns WorkerScriptController for the currently executing context. 0
will be returned if the current executing context is not the worker context. |
78 static WorkerScriptController* controllerForContext(); | 79 static WorkerScriptController* controllerForContext(); |
79 | 80 |
80 private: | 81 private: |
81 WorkerContext* m_workerContext; | 82 WorkerContext* m_workerContext; |
82 OwnPtr<WorkerContextExecutionProxy> m_proxy; | 83 OwnPtr<WorkerContextExecutionProxy> m_proxy; |
83 v8::Isolate* m_isolate; | 84 v8::Isolate* m_isolate; |
84 ScopedDOMDataStore m_DOMDataStore; | 85 ScopedDOMDataStore m_DOMDataStore; |
85 bool m_executionForbidden; | 86 bool m_executionForbidden; |
| 87 bool m_executionScheduledToTerminate; |
| 88 mutable Mutex m_scheduledTerminationMutex; |
86 }; | 89 }; |
87 | 90 |
88 } // namespace WebCore | 91 } // namespace WebCore |
89 | 92 |
90 #endif // ENABLE(WORKERS) | 93 #endif // ENABLE(WORKERS) |
91 | 94 |
92 #endif // WorkerScriptController_h | 95 #endif // WorkerScriptController_h |
OLD | NEW |