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

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

Issue 898593002: DevTools: use per-LocalFrame instrumenting agents instead of per-Page ones. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: fixed assertion Created 5 years, 10 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 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
188 InspectorTimelineAgent* retrieveTimelineAgent(const InspectorInstrumentationCook ie& cookie) 188 InspectorTimelineAgent* retrieveTimelineAgent(const InspectorInstrumentationCook ie& cookie)
189 { 189 {
190 if (!cookie.instrumentingAgents()) 190 if (!cookie.instrumentingAgents())
191 return 0; 191 return 0;
192 InspectorTimelineAgent* timelineAgent = cookie.instrumentingAgents()->inspec torTimelineAgent(); 192 InspectorTimelineAgent* timelineAgent = cookie.instrumentingAgents()->inspec torTimelineAgent();
193 if (timelineAgent && cookie.hasMatchingTimelineAgentId(timelineAgent->id())) 193 if (timelineAgent && cookie.hasMatchingTimelineAgentId(timelineAgent->id()))
194 return timelineAgent; 194 return timelineAgent;
195 return 0; 195 return 0;
196 } 196 }
197 197
198 InstrumentingAgents* instrumentingAgentsFor(Page* page) 198 InstrumentingAgents* instrumentingAgentsFor(LocalFrame* frame)
199 { 199 {
200 if (!page) 200 return frame ? frame->instrumentingAgents() : nullptr;
201 return 0;
202 return instrumentationForPage(page);
203 } 201 }
204 202
205 InstrumentingAgents* instrumentingAgentsFor(EventTarget* eventTarget) 203 InstrumentingAgents* instrumentingAgentsFor(EventTarget* eventTarget)
206 { 204 {
207 if (!eventTarget) 205 if (!eventTarget)
208 return 0; 206 return 0;
209 return instrumentingAgentsFor(eventTarget->executionContext()); 207 return instrumentingAgentsFor(eventTarget->executionContext());
210 } 208 }
211 209
212 InstrumentingAgents* instrumentingAgentsFor(RenderObject* renderer) 210 InstrumentingAgents* instrumentingAgentsFor(RenderObject* renderer)
213 { 211 {
214 return instrumentingAgentsFor(renderer->frame()); 212 return instrumentingAgentsFor(renderer->frame());
215 } 213 }
216 214
217 InstrumentingAgents* instrumentingAgentsFor(WorkerGlobalScope* workerGlobalScope ) 215 InstrumentingAgents* instrumentingAgentsFor(WorkerGlobalScope* workerGlobalScope )
218 { 216 {
219 if (!workerGlobalScope) 217 if (!workerGlobalScope)
220 return 0; 218 return 0;
221 return instrumentationForWorkerGlobalScope(workerGlobalScope); 219 return instrumentationForWorkerGlobalScope(workerGlobalScope);
222 } 220 }
223 221
224 InstrumentingAgents* instrumentingAgentsFor(FrameHost* host)
225 {
226 return instrumentationForPage(&host->page());
227 }
228
229 InstrumentingAgents* instrumentingAgentsForNonDocumentContext(ExecutionContext* context) 222 InstrumentingAgents* instrumentingAgentsForNonDocumentContext(ExecutionContext* context)
230 { 223 {
231 if (context->isWorkerGlobalScope()) 224 if (context->isWorkerGlobalScope())
232 return instrumentationForWorkerGlobalScope(toWorkerGlobalScope(context)) ; 225 return instrumentationForWorkerGlobalScope(toWorkerGlobalScope(context)) ;
233 return 0; 226 return 0;
234 } 227 }
235 228
236 } // namespace InspectorInstrumentation 229 } // namespace InspectorInstrumentation
237 230
238 namespace InstrumentationEvents { 231 namespace InstrumentationEvents {
239 const char PaintSetup[] = "PaintSetup"; 232 const char PaintSetup[] = "PaintSetup";
240 const char Paint[] = "Paint"; 233 const char Paint[] = "Paint";
241 const char Layer[] = "Layer"; 234 const char Layer[] = "Layer";
242 const char RequestMainThreadFrame[] = "RequestMainThreadFrame"; 235 const char RequestMainThreadFrame[] = "RequestMainThreadFrame";
243 const char BeginFrame[] = "BeginFrame"; 236 const char BeginFrame[] = "BeginFrame";
244 const char ActivateLayerTree[] = "ActivateLayerTree"; 237 const char ActivateLayerTree[] = "ActivateLayerTree";
245 const char DrawFrame[] = "DrawFrame"; 238 const char DrawFrame[] = "DrawFrame";
246 const char EmbedderCallback[] = "EmbedderCallback"; 239 const char EmbedderCallback[] = "EmbedderCallback";
247 }; 240 };
248 241
249 namespace InstrumentationEventArguments { 242 namespace InstrumentationEventArguments {
250 const char FrameId[] = "frameId"; 243 const char FrameId[] = "frameId";
251 const char LayerId[] = "layerId"; 244 const char LayerId[] = "layerId";
252 const char LayerTreeId[] = "layerTreeId"; 245 const char LayerTreeId[] = "layerTreeId";
253 const char PageId[] = "pageId"; 246 const char PageId[] = "pageId";
254 const char CallbackName[] = "callbackName"; 247 const char CallbackName[] = "callbackName";
255 }; 248 };
256 249
257 InstrumentingAgents* instrumentationForPage(Page* page)
258 {
259 ASSERT(isMainThread());
260 return page->inspectorController().m_instrumentingAgents.get();
261 }
262
263 InstrumentingAgents* instrumentationForWorkerGlobalScope(WorkerGlobalScope* work erGlobalScope) 250 InstrumentingAgents* instrumentationForWorkerGlobalScope(WorkerGlobalScope* work erGlobalScope)
264 { 251 {
265 if (WorkerInspectorController* controller = workerGlobalScope->workerInspect orController()) 252 if (WorkerInspectorController* controller = workerGlobalScope->workerInspect orController())
266 return controller->m_instrumentingAgents.get(); 253 return controller->m_instrumentingAgents.get();
267 return 0; 254 return 0;
268 } 255 }
269 256
270 } // namespace blink 257 } // namespace blink
271 258
OLDNEW
« no previous file with comments | « Source/core/inspector/InspectorInstrumentation.h ('k') | Source/core/inspector/InspectorInstrumentation.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698