| 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 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 44 #include "wtf/text/TextPosition.h" | 44 #include "wtf/text/TextPosition.h" |
| 45 | 45 |
| 46 namespace WebCore { | 46 namespace WebCore { |
| 47 | 47 |
| 48 class DOMWrapperWorld; | 48 class DOMWrapperWorld; |
| 49 class Event; | 49 class Event; |
| 50 class Frame; | 50 class Frame; |
| 51 class HTMLDocument; | 51 class HTMLDocument; |
| 52 class HTMLPlugInElement; | 52 class HTMLPlugInElement; |
| 53 class KURL; | 53 class KURL; |
| 54 class ScriptDebugServer; |
| 55 class ScriptPreprocessor; |
| 54 class ScriptSourceCode; | 56 class ScriptSourceCode; |
| 55 class ScriptState; | 57 class ScriptState; |
| 56 class SecurityOrigin; | 58 class SecurityOrigin; |
| 57 class V8WindowShell; | 59 class V8WindowShell; |
| 58 class Widget; | 60 class Widget; |
| 59 | 61 |
| 60 typedef WTF::Vector<v8::Extension*> V8Extensions; | 62 typedef WTF::Vector<v8::Extension*> V8Extensions; |
| 61 | 63 |
| 62 enum ReasonForCallingCanExecuteScripts { | 64 enum ReasonForCallingCanExecuteScripts { |
| 63 AboutToExecuteScript, | 65 AboutToExecuteScript, |
| 64 NotAboutToExecuteScript | 66 NotAboutToExecuteScript |
| 65 }; | 67 }; |
| 66 | 68 |
| 67 enum IsolatedWorldConstants { | |
| 68 EmbedderWorldIdLimit = (1 << 29) | |
| 69 }; | |
| 70 | |
| 71 class ScriptController { | 69 class ScriptController { |
| 72 public: | 70 public: |
| 73 ScriptController(Frame*); | 71 ScriptController(Frame*); |
| 74 ~ScriptController(); | 72 ~ScriptController(); |
| 75 | 73 |
| 76 bool initializeMainWorld(); | 74 bool initializeMainWorld(); |
| 77 V8WindowShell* windowShell(DOMWrapperWorld*); | 75 V8WindowShell* windowShell(DOMWrapperWorld*); |
| 78 V8WindowShell* existingWindowShell(DOMWrapperWorld*); | 76 V8WindowShell* existingWindowShell(DOMWrapperWorld*); |
| 79 | 77 |
| 80 ScriptValue executeScript(const ScriptSourceCode&); | 78 ScriptValue executeScript(const ScriptSourceCode&); |
| (...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 152 NPObject* createScriptObjectForPluginElement(HTMLPlugInElement*); | 150 NPObject* createScriptObjectForPluginElement(HTMLPlugInElement*); |
| 153 NPObject* windowScriptNPObject(); | 151 NPObject* windowScriptNPObject(); |
| 154 NPP frameNPP(); | 152 NPP frameNPP(); |
| 155 | 153 |
| 156 // Registers a v8 extension to be available on webpages. Will only | 154 // Registers a v8 extension to be available on webpages. Will only |
| 157 // affect v8 contexts initialized after this call. Takes ownership of | 155 // affect v8 contexts initialized after this call. Takes ownership of |
| 158 // the v8::Extension object passed. | 156 // the v8::Extension object passed. |
| 159 static void registerExtensionIfNeeded(v8::Extension*); | 157 static void registerExtensionIfNeeded(v8::Extension*); |
| 160 static V8Extensions& registeredExtensions(); | 158 static V8Extensions& registeredExtensions(); |
| 161 | 159 |
| 160 void setScriptPreprocessor(const String& preprocessorSource); |
| 161 void clearScriptPreprocessor(); |
| 162 // Source to Source processing iff debugger enabled and it has loaded a prep
rocessor. |
| 163 String preprocess(const String& scriptSource, const String& scriptName); |
| 164 void preprocessEval(ScriptDebugServer* , v8::Handle<v8::Object> eventData); |
| 165 |
| 162 bool setContextDebugId(int); | 166 bool setContextDebugId(int); |
| 163 static int contextDebugId(v8::Handle<v8::Context>); | 167 static int contextDebugId(v8::Handle<v8::Context>); |
| 164 | 168 |
| 165 private: | 169 private: |
| 166 typedef HashMap<int, OwnPtr<V8WindowShell> > IsolatedWorldMap; | 170 typedef HashMap<int, OwnPtr<V8WindowShell> > IsolatedWorldMap; |
| 167 | 171 |
| 168 NPObject* createScriptObjectForFrame(); | 172 NPObject* createScriptObjectForFrame(); |
| 169 void clearForClose(bool destroyGlobal); | 173 void clearForClose(bool destroyGlobal); |
| 170 | 174 |
| 171 Frame* m_frame; | 175 Frame* m_frame; |
| 172 const String* m_sourceURL; | 176 const String* m_sourceURL; |
| 173 v8::Isolate* m_isolate; | 177 v8::Isolate* m_isolate; |
| 174 | 178 |
| 175 OwnPtr<V8WindowShell> m_windowShell; | 179 OwnPtr<V8WindowShell> m_windowShell; |
| 176 IsolatedWorldMap m_isolatedWorlds; | 180 IsolatedWorldMap m_isolatedWorlds; |
| 177 | 181 |
| 178 bool m_paused; | 182 bool m_paused; |
| 179 | 183 |
| 180 NPObject* m_windowScriptNPObject; | 184 NPObject* m_windowScriptNPObject; |
| 181 OwnPtr<NPP_t> m_frameNPP; | 185 OwnPtr<NPP_t> m_frameNPP; |
| 186 |
| 187 // Set by the PageDebuggerAgent on reload |
| 188 String m_preprocessorSource; |
| 189 // Set on the first JS compilation after m_preprocessorSource is set. |
| 190 OwnPtr<ScriptPreprocessor> m_scriptPreprocessor; |
| 182 }; | 191 }; |
| 183 | 192 |
| 184 } // namespace WebCore | 193 } // namespace WebCore |
| 185 | 194 |
| 186 #endif // ScriptController_h | 195 #endif // ScriptController_h |
| OLD | NEW |