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

Side by Side Diff: Source/core/inspector/PageRuntimeAgent.cpp

Issue 24989007: Model each Dart library as its own ScriptState when devtools are enabled. (Closed) Base URL: svn://svn.chromium.org/multivm/trunk/webkit
Patch Set: PTAL Created 7 years, 2 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 | Annotate | Revision Log
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 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 13 matching lines...) Expand all
24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 24 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
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 #include "config.h" 31 #include "config.h"
32 #include "core/inspector/PageRuntimeAgent.h" 32 #include "core/inspector/PageRuntimeAgent.h"
33 33
34 #include "bindings/dart/DartController.h"
34 #include "bindings/v8/DOMWrapperWorld.h" 35 #include "bindings/v8/DOMWrapperWorld.h"
35 #include "bindings/v8/ScriptController.h" 36 #include "bindings/v8/ScriptController.h"
36 #include "core/inspector/InjectedScript.h" 37 #include "core/inspector/InjectedScript.h"
37 #include "core/inspector/InjectedScriptManager.h" 38 #include "core/inspector/InjectedScriptManager.h"
38 #include "core/inspector/InspectorPageAgent.h" 39 #include "core/inspector/InspectorPageAgent.h"
39 #include "core/inspector/InspectorState.h" 40 #include "core/inspector/InspectorState.h"
40 #include "core/inspector/InstrumentingAgents.h" 41 #include "core/inspector/InstrumentingAgents.h"
41 #include "core/page/Frame.h" 42 #include "core/page/Frame.h"
42 #include "core/page/Page.h" 43 #include "core/page/Page.h"
43 #include "core/page/PageConsole.h" 44 #include "core/page/PageConsole.h"
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after
161 void PageRuntimeAgent::reportExecutionContextCreation() 162 void PageRuntimeAgent::reportExecutionContextCreation()
162 { 163 {
163 Vector<std::pair<ScriptState*, SecurityOrigin*> > isolatedContexts; 164 Vector<std::pair<ScriptState*, SecurityOrigin*> > isolatedContexts;
164 for (Frame* frame = m_inspectedPage->mainFrame(); frame; frame = frame->tree ()->traverseNext()) { 165 for (Frame* frame = m_inspectedPage->mainFrame(); frame; frame = frame->tree ()->traverseNext()) {
165 if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript)) 166 if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript))
166 continue; 167 continue;
167 String frameId = m_pageAgent->frameId(frame); 168 String frameId = m_pageAgent->frameId(frame);
168 169
169 ScriptState* scriptState = mainWorldScriptState(frame); 170 ScriptState* scriptState = mainWorldScriptState(frame);
170 notifyContextCreated(frameId, scriptState, 0, true); 171 notifyContextCreated(frameId, scriptState, 0, true);
172 notifyDartContextCreated(frameId, scriptState);
173
171 frame->script()->collectIsolatedContexts(isolatedContexts); 174 frame->script()->collectIsolatedContexts(isolatedContexts);
172 if (isolatedContexts.isEmpty()) 175 if (isolatedContexts.isEmpty())
173 continue; 176 continue;
174 for (size_t i = 0; i< isolatedContexts.size(); i++) 177 for (size_t i = 0; i< isolatedContexts.size(); i++)
175 notifyContextCreated(frameId, isolatedContexts[i].first, isolatedCon texts[i].second, false); 178 notifyContextCreated(frameId, isolatedContexts[i].first, isolatedCon texts[i].second, false);
176 isolatedContexts.clear(); 179 isolatedContexts.clear();
177 } 180 }
178 } 181 }
179 182
183 void PageRuntimeAgent::notifyDartContextCreated(const String& frameId, ScriptSta te* v8ScriptState)
184 {
vsm 2013/10/03 17:59:31 Is the runtime type of v8ScriptState a ScriptState
jacob314 2013/10/03 20:43:15 Unfortunately the runtime type of v8ScriptState is
185 ScriptExecutionContext* scriptExecutionContext = v8ScriptState->scriptExecut ionContext();
186 DartController* dartController = DartController::retrieve(scriptExecutionCon text);
187 if (dartController) {
188 Vector<ScriptState*> scriptStates;
189 dartController->collectScriptStates(v8ScriptState, scriptStates);
190 for (size_t i = 0; i< scriptStates.size(); i++)
191 notifyContextCreated(frameId, scriptStates[i], 0, false);
192 }
193 }
194
180 void PageRuntimeAgent::notifyContextCreated(const String& frameId, ScriptState* scriptState, SecurityOrigin* securityOrigin, bool isPageContext) 195 void PageRuntimeAgent::notifyContextCreated(const String& frameId, ScriptState* scriptState, SecurityOrigin* securityOrigin, bool isPageContext)
181 { 196 {
182 ASSERT(securityOrigin || isPageContext); 197 // FIXME: should Dart scripts have a security origin?
vsm 2013/10/03 17:59:31 I think so. Can you file a bug on this?
jacob314 2013/10/03 20:43:15 updated comment and filed a bug. dartbug.com/13801
198 ASSERT(securityOrigin || isPageContext || !scriptState->isJavaScript());
183 int executionContextId = injectedScriptManager()->injectedScriptIdFor(script State); 199 int executionContextId = injectedScriptManager()->injectedScriptIdFor(script State);
184 String name = securityOrigin ? securityOrigin->toRawString() : ""; 200 String name = scriptState->name() ? *scriptState->name() : (securityOrigin ? securityOrigin->toRawString() : "");
201
185 m_frontend->executionContextCreated(ExecutionContextDescription::create() 202 m_frontend->executionContextCreated(ExecutionContextDescription::create()
186 .setId(executionContextId) 203 .setId(executionContextId)
187 .setIsPageContext(isPageContext) 204 .setIsPageContext(isPageContext)
188 .setName(name) 205 .setName(name)
189 .setFrameId(frameId) 206 .setFrameId(frameId)
190 .release()); 207 .release());
191 } 208 }
192 209
193 } // namespace WebCore 210 } // namespace WebCore
194 211
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698