| 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 87 | 87 |
| 88 void disableEval(const String&); | 88 void disableEval(const String&); |
| 89 | 89 |
| 90 // Returns WorkerScriptController for the currently executing context. 0
will be returned if the current executing context is not the worker context. | 90 // Returns WorkerScriptController for the currently executing context. 0
will be returned if the current executing context is not the worker context. |
| 91 static WorkerScriptController* controllerForContext(v8::Isolate*); | 91 static WorkerScriptController* controllerForContext(v8::Isolate*); |
| 92 | 92 |
| 93 // Evaluate a script file in the current execution environment. | 93 // Evaluate a script file in the current execution environment. |
| 94 ScriptValue evaluate(const String& script, const String& fileName, const
TextPosition& scriptStartPosition, WorkerGlobalScopeExecutionState*); | 94 ScriptValue evaluate(const String& script, const String& fileName, const
TextPosition& scriptStartPosition, WorkerGlobalScopeExecutionState*); |
| 95 | 95 |
| 96 v8::Isolate* isolate() const { return m_isolate; } | 96 v8::Isolate* isolate() const { return m_isolate; } |
| 97 DOMWrapperWorld* world() const { return m_world.get(); } |
| 97 v8::Local<v8::Context> context() { return m_perContextData ? m_perContex
tData->context() : v8::Local<v8::Context>(); } | 98 v8::Local<v8::Context> context() { return m_perContextData ? m_perContex
tData->context() : v8::Local<v8::Context>(); } |
| 98 | 99 |
| 99 // Send a notification about current thread is going to be idle. | 100 // Send a notification about current thread is going to be idle. |
| 100 // Returns true if the embedder should stop calling idleNotification | 101 // Returns true if the embedder should stop calling idleNotification |
| 101 // until real work has been done. | 102 // until real work has been done. |
| 102 bool idleNotification() { return v8::V8::IdleNotification(); } | 103 bool idleNotification() { return v8::V8::IdleNotification(); } |
| 103 | 104 |
| 104 private: | 105 private: |
| 105 bool initializeContextIfNeeded(); | 106 bool initializeContextIfNeeded(); |
| 106 void disposeContext(); | 107 void disposeContext(); |
| 107 | 108 |
| 108 v8::Isolate* m_isolate; | 109 v8::Isolate* m_isolate; |
| 109 WorkerGlobalScope& m_workerGlobalScope; | 110 WorkerGlobalScope& m_workerGlobalScope; |
| 110 OwnPtr<V8PerContextData> m_perContextData; | 111 OwnPtr<V8PerContextData> m_perContextData; |
| 111 String m_disableEvalPending; | 112 String m_disableEvalPending; |
| 112 RefPtr<DOMWrapperWorld> m_world; | 113 RefPtr<DOMWrapperWorld> m_world; |
| 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 RefPtr<ErrorEvent> m_errorEventFromImportedScript; | 117 RefPtr<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 |