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

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

Issue 33523002: Have Frame::script() return a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 1 month 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
« no previous file with comments | « Source/core/inspector/InspectorPageAgent.cpp ('k') | Source/core/loader/FrameLoader.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 155
156 void PageRuntimeAgent::unmuteConsole() 156 void PageRuntimeAgent::unmuteConsole()
157 { 157 {
158 PageConsole::unmute(); 158 PageConsole::unmute();
159 } 159 }
160 160
161 void PageRuntimeAgent::reportExecutionContextCreation() 161 void PageRuntimeAgent::reportExecutionContextCreation()
162 { 162 {
163 Vector<std::pair<ScriptState*, SecurityOrigin*> > isolatedContexts; 163 Vector<std::pair<ScriptState*, SecurityOrigin*> > isolatedContexts;
164 for (Frame* frame = m_inspectedPage->mainFrame(); frame; frame = frame->tree ().traverseNext()) { 164 for (Frame* frame = m_inspectedPage->mainFrame(); frame; frame = frame->tree ().traverseNext()) {
165 if (!frame->script()->canExecuteScripts(NotAboutToExecuteScript)) 165 if (!frame->script().canExecuteScripts(NotAboutToExecuteScript))
166 continue; 166 continue;
167 String frameId = m_pageAgent->frameId(frame); 167 String frameId = m_pageAgent->frameId(frame);
168 168
169 ScriptState* scriptState = mainWorldScriptState(frame); 169 ScriptState* scriptState = mainWorldScriptState(frame);
170 notifyContextCreated(frameId, scriptState, 0, true); 170 notifyContextCreated(frameId, scriptState, 0, true);
171 frame->script()->collectIsolatedContexts(isolatedContexts); 171 frame->script().collectIsolatedContexts(isolatedContexts);
172 if (isolatedContexts.isEmpty()) 172 if (isolatedContexts.isEmpty())
173 continue; 173 continue;
174 for (size_t i = 0; i< isolatedContexts.size(); i++) 174 for (size_t i = 0; i< isolatedContexts.size(); i++)
175 notifyContextCreated(frameId, isolatedContexts[i].first, isolatedCon texts[i].second, false); 175 notifyContextCreated(frameId, isolatedContexts[i].first, isolatedCon texts[i].second, false);
176 isolatedContexts.clear(); 176 isolatedContexts.clear();
177 } 177 }
178 } 178 }
179 179
180 void PageRuntimeAgent::notifyContextCreated(const String& frameId, ScriptState* scriptState, SecurityOrigin* securityOrigin, bool isPageContext) 180 void PageRuntimeAgent::notifyContextCreated(const String& frameId, ScriptState* scriptState, SecurityOrigin* securityOrigin, bool isPageContext)
181 { 181 {
182 ASSERT(securityOrigin || isPageContext); 182 ASSERT(securityOrigin || isPageContext);
183 int executionContextId = injectedScriptManager()->injectedScriptIdFor(script State); 183 int executionContextId = injectedScriptManager()->injectedScriptIdFor(script State);
184 String name = securityOrigin ? securityOrigin->toRawString() : ""; 184 String name = securityOrigin ? securityOrigin->toRawString() : "";
185 m_frontend->executionContextCreated(ExecutionContextDescription::create() 185 m_frontend->executionContextCreated(ExecutionContextDescription::create()
186 .setId(executionContextId) 186 .setId(executionContextId)
187 .setIsPageContext(isPageContext) 187 .setIsPageContext(isPageContext)
188 .setName(name) 188 .setName(name)
189 .setFrameId(frameId) 189 .setFrameId(frameId)
190 .release()); 190 .release());
191 } 191 }
192 192
193 } // namespace WebCore 193 } // namespace WebCore
194 194
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorPageAgent.cpp ('k') | Source/core/loader/FrameLoader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698