| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2008, 2009 Google Inc. All rights reserved. | 2 * Copyright (C) 2008, 2009 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 14 matching lines...) Expand all Loading... |
| 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY | 25 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 26 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 27 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 28 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 */ | 29 */ |
| 30 | 30 |
| 31 #ifndef ScriptController_h | 31 #ifndef ScriptController_h |
| 32 #define ScriptController_h | 32 #define ScriptController_h |
| 33 | 33 |
| 34 #include "bindings/core/v8/SharedPersistent.h" | 34 #include "bindings/core/v8/SharedPersistent.h" |
| 35 #include "bindings/core/v8/WindowProxyManager.h" | 35 |
| 36 #include "core/fetch/CrossOriginAccessControl.h" | 36 #include "core/fetch/CrossOriginAccessControl.h" |
| 37 #include "core/frame/LocalFrame.h" | |
| 38 #include "platform/heap/Handle.h" | 37 #include "platform/heap/Handle.h" |
| 39 #include "wtf/HashMap.h" | 38 #include "wtf/HashMap.h" |
| 40 #include "wtf/Vector.h" | 39 #include "wtf/Vector.h" |
| 41 #include "wtf/text/TextPosition.h" | 40 #include "wtf/text/TextPosition.h" |
| 42 #include <v8.h> | 41 #include <v8.h> |
| 43 | 42 |
| 44 struct NPObject; | 43 struct NPObject; |
| 45 | 44 |
| 46 namespace blink { | 45 namespace blink { |
| 47 | 46 |
| 48 class DOMWrapperWorld; | 47 class DOMWrapperWorld; |
| 49 class ExecutionContext; | 48 class ExecutionContext; |
| 50 class HTMLDocument; | 49 class HTMLDocument; |
| 51 class HTMLPlugInElement; | 50 class HTMLPlugInElement; |
| 52 class KURL; | 51 class KURL; |
| 52 class LocalFrame; |
| 53 class ScriptState; | 53 class ScriptState; |
| 54 class ScriptSourceCode; | 54 class ScriptSourceCode; |
| 55 class SecurityOrigin; | 55 class SecurityOrigin; |
| 56 class WindowProxy; | 56 class WindowProxy; |
| 57 class Widget; | 57 class Widget; |
| 58 | 58 |
| 59 typedef WTF::Vector<v8::Extension*> V8Extensions; | 59 typedef WTF::Vector<v8::Extension*> V8Extensions; |
| 60 | 60 |
| 61 enum ReasonForCallingCanExecuteScripts { | 61 enum ReasonForCallingCanExecuteScripts { |
| 62 AboutToExecuteScript, | 62 AboutToExecuteScript, |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 143 NPObject* windowScriptNPObject(); | 143 NPObject* windowScriptNPObject(); |
| 144 | 144 |
| 145 // Registers a v8 extension to be available on webpages. Will only | 145 // Registers a v8 extension to be available on webpages. Will only |
| 146 // affect v8 contexts initialized after this call. Takes ownership of | 146 // affect v8 contexts initialized after this call. Takes ownership of |
| 147 // the v8::Extension object passed. | 147 // the v8::Extension object passed. |
| 148 static void registerExtensionIfNeeded(v8::Extension*); | 148 static void registerExtensionIfNeeded(v8::Extension*); |
| 149 static V8Extensions& registeredExtensions(); | 149 static V8Extensions& registeredExtensions(); |
| 150 | 150 |
| 151 void setWorldDebugId(int worldId, int debuggerId); | 151 void setWorldDebugId(int worldId, int debuggerId); |
| 152 | 152 |
| 153 v8::Isolate* isolate() const { return m_windowProxyManager->isolate(); } | 153 v8::Isolate* isolate() const { return m_isolate; } |
| 154 | 154 |
| 155 private: | 155 private: |
| 156 explicit ScriptController(LocalFrame*); | 156 explicit ScriptController(LocalFrame*); |
| 157 | 157 |
| 158 LocalFrame* frame() const { return toLocalFrame(m_windowProxyManager->frame(
)); } | 158 typedef WillBeHeapHashMap<int, OwnPtrWillBeMember<WindowProxy> > IsolatedWor
ldMap; |
| 159 | |
| 160 typedef HashMap<Widget*, NPObject*> PluginObjectMap; | 159 typedef HashMap<Widget*, NPObject*> PluginObjectMap; |
| 161 | 160 |
| 162 v8::Local<v8::Value> evaluateScriptInMainWorld(const ScriptSourceCode&, Acce
ssControlStatus, ExecuteScriptPolicy, double* compilationFinishTime = 0); | 161 v8::Local<v8::Value> evaluateScriptInMainWorld(const ScriptSourceCode&, Acce
ssControlStatus, ExecuteScriptPolicy, double* compilationFinishTime = 0); |
| 163 | 162 |
| 164 OwnPtrWillBeMember<WindowProxyManager> m_windowProxyManager; | 163 RawPtrWillBeMember<LocalFrame> m_frame; |
| 165 const String* m_sourceURL; | 164 const String* m_sourceURL; |
| 165 v8::Isolate* m_isolate; |
| 166 |
| 167 OwnPtrWillBeMember<WindowProxy> m_windowProxy; |
| 168 IsolatedWorldMap m_isolatedWorlds; |
| 166 | 169 |
| 167 // A mapping between Widgets and their corresponding script object. | 170 // A mapping between Widgets and their corresponding script object. |
| 168 // This list is used so that when the plugin dies, we can immediately | 171 // This list is used so that when the plugin dies, we can immediately |
| 169 // invalidate all sub-objects which are associated with that plugin. | 172 // invalidate all sub-objects which are associated with that plugin. |
| 170 // The frame keeps a NPObject reference for each item on the list. | 173 // The frame keeps a NPObject reference for each item on the list. |
| 171 PluginObjectMap m_pluginObjects; | 174 PluginObjectMap m_pluginObjects; |
| 172 | 175 |
| 173 NPObject* m_windowScriptNPObject; | 176 NPObject* m_windowScriptNPObject; |
| 174 }; | 177 }; |
| 175 | 178 |
| 176 } // namespace blink | 179 } // namespace blink |
| 177 | 180 |
| 178 #endif // ScriptController_h | 181 #endif // ScriptController_h |
| OLD | NEW |