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 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
75 | 75 |
76 ScriptController(LocalFrame*); | 76 ScriptController(LocalFrame*); |
77 ~ScriptController(); | 77 ~ScriptController(); |
78 | 78 |
79 bool initializeMainWorld(); | 79 bool initializeMainWorld(); |
80 WindowProxy* windowProxy(DOMWrapperWorld&); | 80 WindowProxy* windowProxy(DOMWrapperWorld&); |
81 WindowProxy* existingWindowProxy(DOMWrapperWorld&); | 81 WindowProxy* existingWindowProxy(DOMWrapperWorld&); |
82 | 82 |
83 // Evaluate JavaScript in the main world. | 83 // Evaluate JavaScript in the main world. |
84 void executeScriptInMainWorld(const String&, ExecuteScriptPolicy = DoNotExec
uteScriptWhenScriptsDisabled); | 84 void executeScriptInMainWorld(const String&, ExecuteScriptPolicy = DoNotExec
uteScriptWhenScriptsDisabled); |
85 void executeScriptInMainWorld(const ScriptSourceCode&, AccessControlStatus =
NotSharableCrossOrigin); | 85 void executeScriptInMainWorld(const ScriptSourceCode&, AccessControlStatus =
NotSharableCrossOrigin, double* compilationFinishTime = 0); |
86 v8::Local<v8::Value> executeScriptInMainWorldAndReturnValue(const ScriptSour
ceCode&); | 86 v8::Local<v8::Value> executeScriptInMainWorldAndReturnValue(const ScriptSour
ceCode&); |
87 v8::Local<v8::Value> executeScriptAndReturnValue(v8::Handle<v8::Context>, co
nst ScriptSourceCode&, AccessControlStatus = NotSharableCrossOrigin); | 87 v8::Local<v8::Value> executeScriptAndReturnValue(v8::Handle<v8::Context>, co
nst ScriptSourceCode&, AccessControlStatus = NotSharableCrossOrigin, double* com
pilationFinishTime = 0); |
88 | 88 |
89 // Executes JavaScript in an isolated world. The script gets its own global
scope, | 89 // Executes JavaScript in an isolated world. The script gets its own global
scope, |
90 // its own prototypes for intrinsic JavaScript objects (String, Array, and s
o-on), | 90 // its own prototypes for intrinsic JavaScript objects (String, Array, and s
o-on), |
91 // and its own wrappers for all DOM nodes and DOM constructors. | 91 // and its own wrappers for all DOM nodes and DOM constructors. |
92 // | 92 // |
93 // If an isolated world with the specified ID already exists, it is reused. | 93 // If an isolated world with the specified ID already exists, it is reused. |
94 // Otherwise, a new world is created. | 94 // Otherwise, a new world is created. |
95 // | 95 // |
96 // FIXME: Get rid of extensionGroup here. | 96 // FIXME: Get rid of extensionGroup here. |
97 void executeScriptInIsolatedWorld(int worldID, const Vector<ScriptSourceCode
>& sources, int extensionGroup, Vector<v8::Local<v8::Value> >* results); | 97 void executeScriptInIsolatedWorld(int worldID, const Vector<ScriptSourceCode
>& sources, int extensionGroup, Vector<v8::Local<v8::Value> >* results); |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
146 static V8Extensions& registeredExtensions(); | 146 static V8Extensions& registeredExtensions(); |
147 | 147 |
148 void setWorldDebugId(int worldId, int debuggerId); | 148 void setWorldDebugId(int worldId, int debuggerId); |
149 | 149 |
150 v8::Isolate* isolate() const { return m_isolate; } | 150 v8::Isolate* isolate() const { return m_isolate; } |
151 | 151 |
152 private: | 152 private: |
153 typedef HashMap<int, OwnPtr<WindowProxy> > IsolatedWorldMap; | 153 typedef HashMap<int, OwnPtr<WindowProxy> > IsolatedWorldMap; |
154 typedef HashMap<Widget*, NPObject*> PluginObjectMap; | 154 typedef HashMap<Widget*, NPObject*> PluginObjectMap; |
155 | 155 |
156 v8::Local<v8::Value> evaluateScriptInMainWorld(const ScriptSourceCode&, Acce
ssControlStatus, ExecuteScriptPolicy); | 156 v8::Local<v8::Value> evaluateScriptInMainWorld(const ScriptSourceCode&, Acce
ssControlStatus, ExecuteScriptPolicy, double* compilationFinishTime = 0); |
157 | 157 |
158 LocalFrame* m_frame; | 158 LocalFrame* m_frame; |
159 const String* m_sourceURL; | 159 const String* m_sourceURL; |
160 v8::Isolate* m_isolate; | 160 v8::Isolate* m_isolate; |
161 | 161 |
162 OwnPtr<WindowProxy> m_windowProxy; | 162 OwnPtr<WindowProxy> m_windowProxy; |
163 IsolatedWorldMap m_isolatedWorlds; | 163 IsolatedWorldMap m_isolatedWorlds; |
164 | 164 |
165 // A mapping between Widgets and their corresponding script object. | 165 // A mapping between Widgets and their corresponding script object. |
166 // This list is used so that when the plugin dies, we can immediately | 166 // This list is used so that when the plugin dies, we can immediately |
167 // invalidate all sub-objects which are associated with that plugin. | 167 // invalidate all sub-objects which are associated with that plugin. |
168 // The frame keeps a NPObject reference for each item on the list. | 168 // The frame keeps a NPObject reference for each item on the list. |
169 PluginObjectMap m_pluginObjects; | 169 PluginObjectMap m_pluginObjects; |
170 | 170 |
171 NPObject* m_windowScriptNPObject; | 171 NPObject* m_windowScriptNPObject; |
172 }; | 172 }; |
173 | 173 |
174 } // namespace blink | 174 } // namespace blink |
175 | 175 |
176 #endif // ScriptController_h | 176 #endif // ScriptController_h |
OLD | NEW |