| OLD | NEW |
| 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 Loading... |
| 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(LocalFrame* frame) | 198 InstrumentingAgents* instrumentingAgentsFor(Page* page) |
| 199 { | 199 { |
| 200 return frame ? frame->instrumentingAgents() : nullptr; | 200 if (!page) |
| 201 return 0; |
| 202 return instrumentationForPage(page); |
| 201 } | 203 } |
| 202 | 204 |
| 203 InstrumentingAgents* instrumentingAgentsFor(EventTarget* eventTarget) | 205 InstrumentingAgents* instrumentingAgentsFor(EventTarget* eventTarget) |
| 204 { | 206 { |
| 205 if (!eventTarget) | 207 if (!eventTarget) |
| 206 return 0; | 208 return 0; |
| 207 return instrumentingAgentsFor(eventTarget->executionContext()); | 209 return instrumentingAgentsFor(eventTarget->executionContext()); |
| 208 } | 210 } |
| 209 | 211 |
| 210 InstrumentingAgents* instrumentingAgentsFor(RenderObject* renderer) | 212 InstrumentingAgents* instrumentingAgentsFor(RenderObject* renderer) |
| 211 { | 213 { |
| 212 return instrumentingAgentsFor(renderer->frame()); | 214 return instrumentingAgentsFor(renderer->frame()); |
| 213 } | 215 } |
| 214 | 216 |
| 215 InstrumentingAgents* instrumentingAgentsFor(WorkerGlobalScope* workerGlobalScope
) | 217 InstrumentingAgents* instrumentingAgentsFor(WorkerGlobalScope* workerGlobalScope
) |
| 216 { | 218 { |
| 217 if (!workerGlobalScope) | 219 if (!workerGlobalScope) |
| 218 return 0; | 220 return 0; |
| 219 return instrumentationForWorkerGlobalScope(workerGlobalScope); | 221 return instrumentationForWorkerGlobalScope(workerGlobalScope); |
| 220 } | 222 } |
| 221 | 223 |
| 224 InstrumentingAgents* instrumentingAgentsFor(FrameHost* host) |
| 225 { |
| 226 return instrumentationForPage(&host->page()); |
| 227 } |
| 228 |
| 222 InstrumentingAgents* instrumentingAgentsForNonDocumentContext(ExecutionContext*
context) | 229 InstrumentingAgents* instrumentingAgentsForNonDocumentContext(ExecutionContext*
context) |
| 223 { | 230 { |
| 224 if (context->isWorkerGlobalScope()) | 231 if (context->isWorkerGlobalScope()) |
| 225 return instrumentationForWorkerGlobalScope(toWorkerGlobalScope(context))
; | 232 return instrumentationForWorkerGlobalScope(toWorkerGlobalScope(context))
; |
| 226 return 0; | 233 return 0; |
| 227 } | 234 } |
| 228 | 235 |
| 229 } // namespace InspectorInstrumentation | 236 } // namespace InspectorInstrumentation |
| 230 | 237 |
| 231 namespace InstrumentationEvents { | 238 namespace InstrumentationEvents { |
| 232 const char PaintSetup[] = "PaintSetup"; | 239 const char PaintSetup[] = "PaintSetup"; |
| 233 const char Paint[] = "Paint"; | 240 const char Paint[] = "Paint"; |
| 234 const char Layer[] = "Layer"; | 241 const char Layer[] = "Layer"; |
| 235 const char RequestMainThreadFrame[] = "RequestMainThreadFrame"; | 242 const char RequestMainThreadFrame[] = "RequestMainThreadFrame"; |
| 236 const char BeginFrame[] = "BeginFrame"; | 243 const char BeginFrame[] = "BeginFrame"; |
| 237 const char ActivateLayerTree[] = "ActivateLayerTree"; | 244 const char ActivateLayerTree[] = "ActivateLayerTree"; |
| 238 const char DrawFrame[] = "DrawFrame"; | 245 const char DrawFrame[] = "DrawFrame"; |
| 239 const char EmbedderCallback[] = "EmbedderCallback"; | 246 const char EmbedderCallback[] = "EmbedderCallback"; |
| 240 }; | 247 }; |
| 241 | 248 |
| 242 namespace InstrumentationEventArguments { | 249 namespace InstrumentationEventArguments { |
| 243 const char FrameId[] = "frameId"; | 250 const char FrameId[] = "frameId"; |
| 244 const char LayerId[] = "layerId"; | 251 const char LayerId[] = "layerId"; |
| 245 const char LayerTreeId[] = "layerTreeId"; | 252 const char LayerTreeId[] = "layerTreeId"; |
| 246 const char PageId[] = "pageId"; | 253 const char PageId[] = "pageId"; |
| 247 const char CallbackName[] = "callbackName"; | 254 const char CallbackName[] = "callbackName"; |
| 248 }; | 255 }; |
| 249 | 256 |
| 257 InstrumentingAgents* instrumentationForPage(Page* page) |
| 258 { |
| 259 ASSERT(isMainThread()); |
| 260 return page->inspectorController().m_instrumentingAgents.get(); |
| 261 } |
| 262 |
| 250 InstrumentingAgents* instrumentationForWorkerGlobalScope(WorkerGlobalScope* work
erGlobalScope) | 263 InstrumentingAgents* instrumentationForWorkerGlobalScope(WorkerGlobalScope* work
erGlobalScope) |
| 251 { | 264 { |
| 252 if (WorkerInspectorController* controller = workerGlobalScope->workerInspect
orController()) | 265 if (WorkerInspectorController* controller = workerGlobalScope->workerInspect
orController()) |
| 253 return controller->m_instrumentingAgents.get(); | 266 return controller->m_instrumentingAgents.get(); |
| 254 return 0; | 267 return 0; |
| 255 } | 268 } |
| 256 | 269 |
| 257 } // namespace blink | 270 } // namespace blink |
| 258 | 271 |
| OLD | NEW |