Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(16)

Side by Side Diff: Source/bindings/v8/ScriptController.h

Issue 13575004: Apply script preprocessor to Web page scripts only. (Closed) Base URL: https://chromium.googlesource.com/external/WebKit_trimmed.git@master
Patch Set: rebase Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 class V8WindowShell; 57 class V8WindowShell;
58 class Widget; 58 class Widget;
59 59
60 typedef WTF::Vector<v8::Extension*> V8Extensions; 60 typedef WTF::Vector<v8::Extension*> V8Extensions;
61 61
62 enum ReasonForCallingCanExecuteScripts { 62 enum ReasonForCallingCanExecuteScripts {
63 AboutToExecuteScript, 63 AboutToExecuteScript,
64 NotAboutToExecuteScript 64 NotAboutToExecuteScript
65 }; 65 };
66 66
67 enum InternalIsoloatedWorldIds {
68 ScriptPreprocessorIsolatedWorldId = 10001,
abarth-chromium 2013/07/08 23:57:08 Why is it safe to steal this world ID? It's valid
johnjbarton 2013/07/09 22:44:54 It is not absolutely safe, only relatively safe gi
69 };
70
67 class ScriptController { 71 class ScriptController {
68 public: 72 public:
69 ScriptController(Frame*); 73 ScriptController(Frame*);
70 ~ScriptController(); 74 ~ScriptController();
71 75
72 bool initializeMainWorld(); 76 bool initializeMainWorld();
73 V8WindowShell* windowShell(DOMWrapperWorld*); 77 V8WindowShell* windowShell(DOMWrapperWorld*);
74 V8WindowShell* existingWindowShell(DOMWrapperWorld*); 78 V8WindowShell* existingWindowShell(DOMWrapperWorld*);
75 79
76 ScriptValue executeScript(const ScriptSourceCode&); 80 ScriptValue executeScript(const ScriptSourceCode&);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
150 NPObject* createScriptObjectForPluginElement(HTMLPlugInElement*); 154 NPObject* createScriptObjectForPluginElement(HTMLPlugInElement*);
151 NPObject* windowScriptNPObject(); 155 NPObject* windowScriptNPObject();
152 NPP frameNPP(); 156 NPP frameNPP();
153 157
154 // Registers a v8 extension to be available on webpages. Will only 158 // Registers a v8 extension to be available on webpages. Will only
155 // affect v8 contexts initialized after this call. Takes ownership of 159 // affect v8 contexts initialized after this call. Takes ownership of
156 // the v8::Extension object passed. 160 // the v8::Extension object passed.
157 static void registerExtensionIfNeeded(v8::Extension*); 161 static void registerExtensionIfNeeded(v8::Extension*);
158 static V8Extensions& registeredExtensions(); 162 static V8Extensions& registeredExtensions();
159 163
164 // Empty string disables preprocessing.
abarth-chromium 2013/07/08 23:57:08 Rather than using in-band signaling, I'd recommend
johnjbarton 2013/07/09 22:44:54 Done.
165 void setScriptPreprocessor(const String& preprocessorSource);
166 // Source to Source processing iff debugger enabled and preprocessor loaded.
167 String preprocess(const String& scriptSource, const String& scriptName);
168 bool hasScriptPreprocessor();
169 bool isScriptPreprocessing();
abarth-chromium 2013/07/08 23:57:08 isPreprocessingScript
johnjbarton 2013/07/09 22:44:54 Done.
170
160 bool setContextDebugId(int); 171 bool setContextDebugId(int);
161 static int contextDebugId(v8::Handle<v8::Context>); 172 static int contextDebugId(v8::Handle<v8::Context>);
162 173
163 private: 174 private:
164 typedef HashMap<int, OwnPtr<V8WindowShell> > IsolatedWorldMap; 175 typedef HashMap<int, OwnPtr<V8WindowShell> > IsolatedWorldMap;
165 176
166 NPObject* createScriptObjectForFrame(); 177 NPObject* createScriptObjectForFrame();
167 void clearForClose(bool destroyGlobal); 178 void clearForClose(bool destroyGlobal);
168 179
169 Frame* m_frame; 180 Frame* m_frame;
170 const String* m_sourceURL; 181 const String* m_sourceURL;
171 v8::Isolate* m_isolate; 182 v8::Isolate* m_isolate;
172 183
173 OwnPtr<V8WindowShell> m_windowShell; 184 OwnPtr<V8WindowShell> m_windowShell;
174 IsolatedWorldMap m_isolatedWorlds; 185 IsolatedWorldMap m_isolatedWorlds;
175 186
176 bool m_paused; 187 bool m_paused;
177 188
178 NPObject* m_windowScriptNPObject; 189 NPObject* m_windowScriptNPObject;
179 OwnPtr<NPP_t> m_frameNPP; 190 OwnPtr<NPP_t> m_frameNPP;
180 191
181 typedef HashSet<NPP> PluginInstances; 192 typedef HashSet<NPP> PluginInstances;
182 PluginInstances m_pluginNPPs; 193 PluginInstances m_pluginNPPs;
194
195 class ScriptPreprocessor;
196 String m_preprocessorSource;
197 OwnPtr<ScriptPreprocessor> m_scriptPreprocessor;
183 }; 198 };
184 199
185 } // namespace WebCore 200 } // namespace WebCore
186 201
187 #endif // ScriptController_h 202 #endif // ScriptController_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698