| 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 19 matching lines...) Expand all Loading... |
| 30 | 30 |
| 31 #include "config.h" | 31 #include "config.h" |
| 32 #include "core/inspector/InspectorInstrumentation.h" | 32 #include "core/inspector/InspectorInstrumentation.h" |
| 33 | 33 |
| 34 #include "core/events/EventTarget.h" | 34 #include "core/events/EventTarget.h" |
| 35 #include "core/fetch/FetchInitiatorInfo.h" | 35 #include "core/fetch/FetchInitiatorInfo.h" |
| 36 #include "core/frame/FrameHost.h" | 36 #include "core/frame/FrameHost.h" |
| 37 #include "core/inspector/InspectorCSSAgent.h" | 37 #include "core/inspector/InspectorCSSAgent.h" |
| 38 #include "core/inspector/InspectorConsoleAgent.h" | 38 #include "core/inspector/InspectorConsoleAgent.h" |
| 39 #include "core/inspector/InspectorDebuggerAgent.h" | 39 #include "core/inspector/InspectorDebuggerAgent.h" |
| 40 #include "core/inspector/InspectorInspectorAgent.h" | |
| 41 #include "core/inspector/InspectorProfilerAgent.h" | 40 #include "core/inspector/InspectorProfilerAgent.h" |
| 42 #include "core/inspector/InspectorResourceAgent.h" | 41 #include "core/inspector/InspectorResourceAgent.h" |
| 43 #include "core/inspector/InstrumentingAgents.h" | 42 #include "core/inspector/InstrumentingAgents.h" |
| 44 #include "core/inspector/ScriptAsyncCallStack.h" | 43 #include "core/inspector/ScriptAsyncCallStack.h" |
| 45 #include "core/inspector/ScriptCallStack.h" | 44 #include "core/inspector/ScriptCallStack.h" |
| 46 #include "core/inspector/WorkerInspectorController.h" | 45 #include "core/inspector/WorkerInspectorController.h" |
| 47 #include "core/page/Page.h" | 46 #include "core/page/Page.h" |
| 48 #include "core/workers/WorkerGlobalScope.h" | 47 #include "core/workers/WorkerGlobalScope.h" |
| 49 | 48 |
| 50 namespace blink { | 49 namespace blink { |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 didReceiveResourceResponseButCanceledImpl(frame, loader, identifier, r); | 101 didReceiveResourceResponseButCanceledImpl(frame, loader, identifier, r); |
| 103 } | 102 } |
| 104 | 103 |
| 105 void continueWithPolicyIgnoreImpl(LocalFrame* frame, DocumentLoader* loader, uns
igned long identifier, const ResourceResponse& r) | 104 void continueWithPolicyIgnoreImpl(LocalFrame* frame, DocumentLoader* loader, uns
igned long identifier, const ResourceResponse& r) |
| 106 { | 105 { |
| 107 didReceiveResourceResponseButCanceledImpl(frame, loader, identifier, r); | 106 didReceiveResourceResponseButCanceledImpl(frame, loader, identifier, r); |
| 108 } | 107 } |
| 109 | 108 |
| 110 void willDestroyResourceImpl(Resource* cachedResource) | 109 void willDestroyResourceImpl(Resource* cachedResource) |
| 111 { | 110 { |
| 111 ASSERT(isMainThread()); |
| 112 if (!instrumentingAgentsSet) | 112 if (!instrumentingAgentsSet) |
| 113 return; | 113 return; |
| 114 for (InstrumentingAgents* instrumentingAgents: *instrumentingAgentsSet) { | 114 for (InstrumentingAgents* instrumentingAgents: *instrumentingAgentsSet) { |
| 115 if (InspectorResourceAgent* inspectorResourceAgent = instrumentingAgents
->inspectorResourceAgent()) | 115 if (InspectorResourceAgent* inspectorResourceAgent = instrumentingAgents
->inspectorResourceAgent()) |
| 116 inspectorResourceAgent->willDestroyResource(cachedResource); | 116 inspectorResourceAgent->willDestroyResource(cachedResource); |
| 117 } | 117 } |
| 118 } | 118 } |
| 119 | 119 |
| 120 bool collectingHTMLParseErrorsImpl(InstrumentingAgents* instrumentingAgents) | 120 bool collectingHTMLParseErrorsImpl(InstrumentingAgents* instrumentingAgents) |
| 121 { | 121 { |
| 122 if (InspectorInspectorAgent* inspectorAgent = instrumentingAgents->inspector
InspectorAgent()) | 122 ASSERT(isMainThread()); |
| 123 return inspectorAgent->hasFrontend(); | 123 if (!instrumentingAgentsSet) |
| 124 return false; | 124 return false; |
| 125 return instrumentingAgentsSet->contains(instrumentingAgents); |
| 125 } | 126 } |
| 126 | 127 |
| 127 void appendAsyncCallStack(ExecutionContext* executionContext, ScriptCallStack* c
allStack) | 128 void appendAsyncCallStack(ExecutionContext* executionContext, ScriptCallStack* c
allStack) |
| 128 { | 129 { |
| 129 InstrumentingAgents* instrumentingAgents = instrumentingAgentsFor(executionC
ontext); | 130 InstrumentingAgents* instrumentingAgents = instrumentingAgentsFor(executionC
ontext); |
| 130 if (!instrumentingAgents) | 131 if (!instrumentingAgents) |
| 131 return; | 132 return; |
| 132 if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDe
buggerAgent()) | 133 if (InspectorDebuggerAgent* debuggerAgent = instrumentingAgents->inspectorDe
buggerAgent()) |
| 133 callStack->setAsyncCallStack(debuggerAgent->currentAsyncStackTraceForCon
sole()); | 134 callStack->setAsyncCallStack(debuggerAgent->currentAsyncStackTraceForCon
sole()); |
| 134 } | 135 } |
| 135 | 136 |
| 136 bool canvasAgentEnabled(ExecutionContext* executionContext) | 137 bool canvasAgentEnabled(ExecutionContext* executionContext) |
| 137 { | 138 { |
| 138 InstrumentingAgents* instrumentingAgents = instrumentingAgentsFor(executionC
ontext); | 139 InstrumentingAgents* instrumentingAgents = instrumentingAgentsFor(executionC
ontext); |
| 139 return instrumentingAgents && instrumentingAgents->inspectorCanvasAgent(); | 140 return instrumentingAgents && instrumentingAgents->inspectorCanvasAgent(); |
| 140 } | 141 } |
| 141 | 142 |
| 142 bool consoleAgentEnabled(ExecutionContext* executionContext) | 143 bool consoleAgentEnabled(ExecutionContext* executionContext) |
| 143 { | 144 { |
| 144 InstrumentingAgents* instrumentingAgents = instrumentingAgentsFor(executionC
ontext); | 145 InstrumentingAgents* instrumentingAgents = instrumentingAgentsFor(executionC
ontext); |
| 145 InspectorConsoleAgent* consoleAgent = instrumentingAgents ? instrumentingAge
nts->inspectorConsoleAgent() : 0; | 146 InspectorConsoleAgent* consoleAgent = instrumentingAgents ? instrumentingAge
nts->inspectorConsoleAgent() : 0; |
| 146 return consoleAgent && consoleAgent->enabled(); | 147 return consoleAgent && consoleAgent->enabled(); |
| 147 } | 148 } |
| 148 | 149 |
| 149 void registerInstrumentingAgents(InstrumentingAgents* instrumentingAgents) | 150 void registerInstrumentingAgents(InstrumentingAgents* instrumentingAgents) |
| 150 { | 151 { |
| 152 ASSERT(isMainThread()); |
| 151 if (!instrumentingAgentsSet) | 153 if (!instrumentingAgentsSet) |
| 152 instrumentingAgentsSet = new HashSet<InstrumentingAgents*>(); | 154 instrumentingAgentsSet = new HashSet<InstrumentingAgents*>(); |
| 153 instrumentingAgentsSet->add(instrumentingAgents); | 155 instrumentingAgentsSet->add(instrumentingAgents); |
| 154 } | 156 } |
| 155 | 157 |
| 156 void unregisterInstrumentingAgents(InstrumentingAgents* instrumentingAgents) | 158 void unregisterInstrumentingAgents(InstrumentingAgents* instrumentingAgents) |
| 157 { | 159 { |
| 160 ASSERT(isMainThread()); |
| 158 if (!instrumentingAgentsSet) | 161 if (!instrumentingAgentsSet) |
| 159 return; | 162 return; |
| 160 instrumentingAgentsSet->remove(instrumentingAgents); | 163 instrumentingAgentsSet->remove(instrumentingAgents); |
| 161 if (instrumentingAgentsSet->isEmpty()) { | 164 if (instrumentingAgentsSet->isEmpty()) { |
| 162 delete instrumentingAgentsSet; | 165 delete instrumentingAgentsSet; |
| 163 instrumentingAgentsSet = 0; | 166 instrumentingAgentsSet = 0; |
| 164 } | 167 } |
| 165 } | 168 } |
| 166 | 169 |
| 167 InstrumentingAgents* instrumentingAgentsFor(LocalFrame* frame) | 170 InstrumentingAgents* instrumentingAgentsFor(LocalFrame* frame) |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 | 221 |
| 219 InstrumentingAgents* instrumentationForWorkerGlobalScope(WorkerGlobalScope* work
erGlobalScope) | 222 InstrumentingAgents* instrumentationForWorkerGlobalScope(WorkerGlobalScope* work
erGlobalScope) |
| 220 { | 223 { |
| 221 if (WorkerInspectorController* controller = workerGlobalScope->workerInspect
orController()) | 224 if (WorkerInspectorController* controller = workerGlobalScope->workerInspect
orController()) |
| 222 return controller->m_instrumentingAgents.get(); | 225 return controller->m_instrumentingAgents.get(); |
| 223 return 0; | 226 return 0; |
| 224 } | 227 } |
| 225 | 228 |
| 226 } // namespace blink | 229 } // namespace blink |
| 227 | 230 |
| OLD | NEW |