| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2009, 2012 Google Inc. All rights reserved. | 2 * Copyright (C) 2009, 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 |
| (...skipping 23 matching lines...) Expand all Loading... |
| 34 #include "bindings/core/v8/ScriptValue.h" | 34 #include "bindings/core/v8/ScriptValue.h" |
| 35 #include "bindings/core/v8/V8Binding.h" | 35 #include "bindings/core/v8/V8Binding.h" |
| 36 #include "wtf/OwnPtr.h" | 36 #include "wtf/OwnPtr.h" |
| 37 #include "wtf/ThreadingPrimitives.h" | 37 #include "wtf/ThreadingPrimitives.h" |
| 38 #include "wtf/text/TextPosition.h" | 38 #include "wtf/text/TextPosition.h" |
| 39 #include <v8.h> | 39 #include <v8.h> |
| 40 | 40 |
| 41 namespace WebCore { | 41 namespace WebCore { |
| 42 | 42 |
| 43 class ErrorEvent; | 43 class ErrorEvent; |
| 44 class ExceptionState; |
| 44 class ScriptSourceCode; | 45 class ScriptSourceCode; |
| 45 class ScriptValue; | 46 class ScriptValue; |
| 46 class WorkerGlobalScope; | 47 class WorkerGlobalScope; |
| 47 | 48 |
| 48 struct WorkerGlobalScopeExecutionState { | 49 struct WorkerGlobalScopeExecutionState { |
| 49 WorkerGlobalScopeExecutionState() | 50 WorkerGlobalScopeExecutionState() |
| 50 : hadException(false) | 51 : hadException(false) |
| 51 , lineNumber(0) | 52 , lineNumber(0) |
| 52 , columnNumber(0) | 53 , columnNumber(0) |
| 53 { | 54 { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 65 public: | 66 public: |
| 66 explicit WorkerScriptController(WorkerGlobalScope&); | 67 explicit WorkerScriptController(WorkerGlobalScope&); |
| 67 ~WorkerScriptController(); | 68 ~WorkerScriptController(); |
| 68 | 69 |
| 69 WorkerGlobalScope& workerGlobalScope() { return m_workerGlobalScope; } | 70 WorkerGlobalScope& workerGlobalScope() { return m_workerGlobalScope; } |
| 70 | 71 |
| 71 bool initializeContextIfNeeded(); | 72 bool initializeContextIfNeeded(); |
| 72 | 73 |
| 73 void evaluate(const ScriptSourceCode&, RefPtrWillBeRawPtr<ErrorEvent>* = 0); | 74 void evaluate(const ScriptSourceCode&, RefPtrWillBeRawPtr<ErrorEvent>* = 0); |
| 74 | 75 |
| 75 void rethrowExceptionFromImportedScript(PassRefPtrWillBeRawPtr<ErrorEvent>); | 76 void rethrowExceptionFromImportedScript(PassRefPtrWillBeRawPtr<ErrorEvent>,
ExceptionState&); |
| 76 | 77 |
| 77 // Async request to terminate a future JS execution. Eventually causes termi
nation | 78 // Async request to terminate a future JS execution. Eventually causes termi
nation |
| 78 // exception raised during JS execution, if the worker thread happens to run
JS. | 79 // exception raised during JS execution, if the worker thread happens to run
JS. |
| 79 // After JS execution was terminated in this way, the Worker thread has to u
se | 80 // After JS execution was terminated in this way, the Worker thread has to u
se |
| 80 // forbidExecution()/isExecutionForbidden() to guard against reentry into JS
. | 81 // forbidExecution()/isExecutionForbidden() to guard against reentry into JS
. |
| 81 // Can be called from any thread. | 82 // Can be called from any thread. |
| 82 void scheduleExecutionTermination(); | 83 void scheduleExecutionTermination(); |
| 83 bool isExecutionTerminating() const; | 84 bool isExecutionTerminating() const; |
| 84 | 85 |
| 85 // Called on Worker thread when JS exits with termination exception caused b
y forbidExecution() request, | 86 // Called on Worker thread when JS exits with termination exception caused b
y forbidExecution() request, |
| (...skipping 27 matching lines...) Expand all Loading... |
| 113 bool m_executionForbidden; | 114 bool m_executionForbidden; |
| 114 bool m_executionScheduledToTerminate; | 115 bool m_executionScheduledToTerminate; |
| 115 mutable Mutex m_scheduledTerminationMutex; | 116 mutable Mutex m_scheduledTerminationMutex; |
| 116 RefPtrWillBePersistent<ErrorEvent> m_errorEventFromImportedScript; | 117 RefPtrWillBePersistent<ErrorEvent> m_errorEventFromImportedScript; |
| 117 OwnPtr<V8IsolateInterruptor> m_interruptor; | 118 OwnPtr<V8IsolateInterruptor> m_interruptor; |
| 118 }; | 119 }; |
| 119 | 120 |
| 120 } // namespace WebCore | 121 } // namespace WebCore |
| 121 | 122 |
| 122 #endif // WorkerScriptController_h | 123 #endif // WorkerScriptController_h |
| OLD | NEW |