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(); | 91 static WorkerScriptController* controllerForContext(); |
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 // Returns a local handle of the context. | 96 // Returns a local handle of the context. |
97 v8::Local<v8::Context> context() { return m_context.newLocal(v8::Isolate
::GetCurrent()); } | 97 v8::Local<v8::Context> context() { return m_context.newLocal(m_isolate);
} |
98 | 98 |
99 // Send a notification about current thread is going to be idle. | 99 // Send a notification about current thread is going to be idle. |
100 // Returns true if the embedder should stop calling idleNotification | 100 // Returns true if the embedder should stop calling idleNotification |
101 // until real work has been done. | 101 // until real work has been done. |
102 bool idleNotification() { return v8::V8::IdleNotification(); } | 102 bool idleNotification() { return v8::V8::IdleNotification(); } |
103 | 103 |
| 104 v8::Isolate* isolate() const { return m_isolate; } |
| 105 |
104 private: | 106 private: |
105 bool initializeContextIfNeeded(); | 107 bool initializeContextIfNeeded(); |
106 void disposeContext(); | 108 void disposeContext(); |
107 | 109 |
108 WorkerGlobalScope* m_workerGlobalScope; | 110 WorkerGlobalScope* m_workerGlobalScope; |
109 v8::Isolate* m_isolate; | 111 v8::Isolate* m_isolate; |
110 ScopedPersistent<v8::Context> m_context; | 112 ScopedPersistent<v8::Context> m_context; |
111 OwnPtr<V8PerContextData> m_perContextData; | 113 OwnPtr<V8PerContextData> m_perContextData; |
112 String m_disableEvalPending; | 114 String m_disableEvalPending; |
113 OwnPtr<DOMDataStore> m_domDataStore; | 115 OwnPtr<DOMDataStore> m_domDataStore; |
114 bool m_executionForbidden; | 116 bool m_executionForbidden; |
115 bool m_executionScheduledToTerminate; | 117 bool m_executionScheduledToTerminate; |
116 mutable Mutex m_scheduledTerminationMutex; | 118 mutable Mutex m_scheduledTerminationMutex; |
117 RefPtr<ErrorEvent> m_errorEventFromImportedScript; | 119 RefPtr<ErrorEvent> m_errorEventFromImportedScript; |
118 }; | 120 }; |
119 | 121 |
120 } // namespace WebCore | 122 } // namespace WebCore |
121 | 123 |
122 #endif // WorkerScriptController_h | 124 #endif // WorkerScriptController_h |
OLD | NEW |