Chromium Code Reviews| 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 ScriptPreprocessor; | |
| 54 class ScriptSourceCode; | 55 class ScriptSourceCode; |
| 55 class ScriptState; | 56 class ScriptState; |
| 56 class SecurityOrigin; | 57 class SecurityOrigin; |
| 57 class V8WindowShell; | 58 class V8WindowShell; |
| 58 class Widget; | 59 class Widget; |
| 59 | 60 |
| 60 typedef WTF::Vector<v8::Extension*> V8Extensions; | 61 typedef WTF::Vector<v8::Extension*> V8Extensions; |
| 61 | 62 |
| 62 enum ReasonForCallingCanExecuteScripts { | 63 enum ReasonForCallingCanExecuteScripts { |
| 63 AboutToExecuteScript, | 64 AboutToExecuteScript, |
| 64 NotAboutToExecuteScript | 65 NotAboutToExecuteScript |
| 65 }; | 66 }; |
| 66 | 67 |
| 67 enum IsolatedWorldConstants { | 68 enum IsolatedWorldConstants { |
|
haraken
2013/07/11 01:13:59
Shall we move this to ScriptPreprocessor.h?
johnjbarton
2013/07/11 19:14:42
The most logical place would be DOMWrapperWorld.h.
| |
| 68 EmbedderWorldIdLimit = (1 << 29) | 69 EmbedderWorldIdLimit = (1 << 29), |
| 70 ScriptPreprocessorIsolatedWorldId | |
| 69 }; | 71 }; |
| 70 | 72 |
| 71 class ScriptController { | 73 class ScriptController { |
| 72 public: | 74 public: |
| 73 ScriptController(Frame*); | 75 ScriptController(Frame*); |
| 74 ~ScriptController(); | 76 ~ScriptController(); |
| 75 | 77 |
| 76 bool initializeMainWorld(); | 78 bool initializeMainWorld(); |
| 77 V8WindowShell* windowShell(DOMWrapperWorld*); | 79 V8WindowShell* windowShell(DOMWrapperWorld*); |
| 78 V8WindowShell* existingWindowShell(DOMWrapperWorld*); | 80 V8WindowShell* existingWindowShell(DOMWrapperWorld*); |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 152 NPObject* createScriptObjectForPluginElement(HTMLPlugInElement*); | 154 NPObject* createScriptObjectForPluginElement(HTMLPlugInElement*); |
| 153 NPObject* windowScriptNPObject(); | 155 NPObject* windowScriptNPObject(); |
| 154 NPP frameNPP(); | 156 NPP frameNPP(); |
| 155 | 157 |
| 156 // Registers a v8 extension to be available on webpages. Will only | 158 // Registers a v8 extension to be available on webpages. Will only |
| 157 // affect v8 contexts initialized after this call. Takes ownership of | 159 // affect v8 contexts initialized after this call. Takes ownership of |
| 158 // the v8::Extension object passed. | 160 // the v8::Extension object passed. |
| 159 static void registerExtensionIfNeeded(v8::Extension*); | 161 static void registerExtensionIfNeeded(v8::Extension*); |
| 160 static V8Extensions& registeredExtensions(); | 162 static V8Extensions& registeredExtensions(); |
| 161 | 163 |
| 164 void setScriptPreprocessor(const String& preprocessorSource); | |
| 165 bool hasScriptPreprocessor(); | |
| 166 void clearScriptPreprocessor(); | |
| 167 // Source to Source processing iff debugger enabled and preprocessor loaded. | |
| 168 String preprocess(const String& scriptSource, const String& scriptName); | |
| 169 bool isPreprocessingScript(); | |
| 170 | |
| 162 bool setContextDebugId(int); | 171 bool setContextDebugId(int); |
| 163 static int contextDebugId(v8::Handle<v8::Context>); | 172 static int contextDebugId(v8::Handle<v8::Context>); |
| 164 | 173 |
| 165 private: | 174 private: |
| 166 typedef HashMap<int, OwnPtr<V8WindowShell> > IsolatedWorldMap; | 175 typedef HashMap<int, OwnPtr<V8WindowShell> > IsolatedWorldMap; |
| 167 | 176 |
| 168 NPObject* createScriptObjectForFrame(); | 177 NPObject* createScriptObjectForFrame(); |
| 169 void clearForClose(bool destroyGlobal); | 178 void clearForClose(bool destroyGlobal); |
| 170 | 179 |
| 171 Frame* m_frame; | 180 Frame* m_frame; |
| 172 const String* m_sourceURL; | 181 const String* m_sourceURL; |
| 173 v8::Isolate* m_isolate; | 182 v8::Isolate* m_isolate; |
| 174 | 183 |
| 175 OwnPtr<V8WindowShell> m_windowShell; | 184 OwnPtr<V8WindowShell> m_windowShell; |
| 176 IsolatedWorldMap m_isolatedWorlds; | 185 IsolatedWorldMap m_isolatedWorlds; |
| 177 | 186 |
| 178 bool m_paused; | 187 bool m_paused; |
| 179 | 188 |
| 180 NPObject* m_windowScriptNPObject; | 189 NPObject* m_windowScriptNPObject; |
| 181 OwnPtr<NPP_t> m_frameNPP; | 190 OwnPtr<NPP_t> m_frameNPP; |
| 191 | |
| 192 String m_preprocessorSource; | |
| 193 OwnPtr<ScriptPreprocessor> m_scriptPreprocessor; | |
| 182 }; | 194 }; |
| 183 | 195 |
| 184 } // namespace WebCore | 196 } // namespace WebCore |
| 185 | 197 |
| 186 #endif // ScriptController_h | 198 #endif // ScriptController_h |
| OLD | NEW |