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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 bool isExecutionForbidden() const; | 92 bool isExecutionForbidden() const; |
93 | 93 |
94 void disableEval(const String&); | 94 void disableEval(const String&); |
95 | 95 |
96 // Returns WorkerScriptController for the currently executing context. 0
will be returned if the current executing context is not the worker context. | 96 // Returns WorkerScriptController for the currently executing context. 0
will be returned if the current executing context is not the worker context. |
97 static WorkerScriptController* controllerForContext(v8::Isolate*); | 97 static WorkerScriptController* controllerForContext(v8::Isolate*); |
98 | 98 |
99 // Evaluate a script file in the current execution environment. | 99 // Evaluate a script file in the current execution environment. |
100 ScriptValue evaluate(const String& script, const String& fileName, const
TextPosition& scriptStartPosition, WorkerGlobalScopeExecutionState*); | 100 ScriptValue evaluate(const String& script, const String& fileName, const
TextPosition& scriptStartPosition, WorkerGlobalScopeExecutionState*); |
101 | 101 |
102 // Returns a local handle of the context. | 102 v8::Local<v8::Context> context() { return m_perContextData ? m_perContex
tData->context() : v8::Local<v8::Context>(); } |
103 v8::Local<v8::Context> context() { return m_contextHolder ? m_contextHol
der->context() : v8::Local<v8::Context>(); } | |
104 | 103 |
105 // Send a notification about current thread is going to be idle. | 104 // Send a notification about current thread is going to be idle. |
106 // Returns true if the embedder should stop calling idleNotification | 105 // Returns true if the embedder should stop calling idleNotification |
107 // until real work has been done. | 106 // until real work has been done. |
108 bool idleNotification() { return v8::V8::IdleNotification(); } | 107 bool idleNotification() { return v8::V8::IdleNotification(); } |
109 | 108 |
110 v8::Isolate* isolate() const { return m_isolateHolder->isolate(); } | 109 v8::Isolate* isolate() const { return m_isolateHolder->isolate(); } |
111 | 110 |
112 private: | 111 private: |
113 bool initializeContextIfNeeded(); | 112 bool initializeContextIfNeeded(); |
114 void disposeContext(); | 113 void disposeContext(); |
115 | 114 |
116 WorkerGlobalScope& m_workerGlobalScope; | 115 WorkerGlobalScope& m_workerGlobalScope; |
117 OwnPtr<gin::IsolateHolder> m_isolateHolder; | 116 OwnPtr<gin::IsolateHolder> m_isolateHolder; |
118 OwnPtr<gin::ContextHolder> m_contextHolder; | |
119 OwnPtr<V8PerContextData> m_perContextData; | 117 OwnPtr<V8PerContextData> m_perContextData; |
120 String m_disableEvalPending; | 118 String m_disableEvalPending; |
121 RefPtr<DOMWrapperWorld> m_world; | 119 RefPtr<DOMWrapperWorld> m_world; |
122 bool m_executionForbidden; | 120 bool m_executionForbidden; |
123 bool m_executionScheduledToTerminate; | 121 bool m_executionScheduledToTerminate; |
124 mutable Mutex m_scheduledTerminationMutex; | 122 mutable Mutex m_scheduledTerminationMutex; |
125 RefPtr<ErrorEvent> m_errorEventFromImportedScript; | 123 RefPtr<ErrorEvent> m_errorEventFromImportedScript; |
126 OwnPtr<V8IsolateInterruptor> m_interruptor; | 124 OwnPtr<V8IsolateInterruptor> m_interruptor; |
127 }; | 125 }; |
128 | 126 |
129 } // namespace WebCore | 127 } // namespace WebCore |
130 | 128 |
131 #endif // WorkerScriptController_h | 129 #endif // WorkerScriptController_h |
OLD | NEW |