| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "platform/v8_inspector/V8InspectorSessionImpl.h" | 5 #include "platform/v8_inspector/V8InspectorSessionImpl.h" |
| 6 | 6 |
| 7 #include "platform/v8_inspector/InjectedScript.h" | 7 #include "platform/v8_inspector/InjectedScript.h" |
| 8 #include "platform/v8_inspector/InjectedScriptHost.h" | 8 #include "platform/v8_inspector/InjectedScriptHost.h" |
| 9 #include "platform/v8_inspector/InspectedContext.h" | 9 #include "platform/v8_inspector/InspectedContext.h" |
| 10 #include "platform/v8_inspector/RemoteObjectId.h" | 10 #include "platform/v8_inspector/RemoteObjectId.h" |
| 11 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" | 11 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" |
| 12 #include "platform/v8_inspector/V8DebuggerImpl.h" | 12 #include "platform/v8_inspector/V8DebuggerImpl.h" |
| 13 #include "platform/v8_inspector/V8HeapProfilerAgentImpl.h" | 13 #include "platform/v8_inspector/V8HeapProfilerAgentImpl.h" |
| 14 #include "platform/v8_inspector/V8ProfilerAgentImpl.h" | 14 #include "platform/v8_inspector/V8ProfilerAgentImpl.h" |
| 15 #include "platform/v8_inspector/V8RuntimeAgentImpl.h" | 15 #include "platform/v8_inspector/V8RuntimeAgentImpl.h" |
| 16 #include "platform/v8_inspector/public/V8ContextInfo.h" | 16 #include "platform/v8_inspector/public/V8ContextInfo.h" |
| 17 #include "platform/v8_inspector/public/V8DebuggerClient.h" | 17 #include "platform/v8_inspector/public/V8DebuggerClient.h" |
| 18 | 18 |
| 19 namespace blink { | 19 namespace blink { |
| 20 | 20 |
| 21 PassOwnPtr<V8InspectorSessionImpl> V8InspectorSessionImpl::create(V8DebuggerImpl
* debugger, int contextGroupId) | 21 PassOwnPtr<V8InspectorSessionImpl> V8InspectorSessionImpl::create(V8DebuggerImpl
* debugger, int contextGroupId) |
| 22 { | 22 { |
| 23 return adoptPtr(new V8InspectorSessionImpl(debugger, contextGroupId)); | 23 return adoptPtr(new V8InspectorSessionImpl(debugger, contextGroupId)); |
| 24 } | 24 } |
| 25 | 25 |
| 26 V8InspectorSessionImpl::V8InspectorSessionImpl(V8DebuggerImpl* debugger, int con
textGroupId) | 26 V8InspectorSessionImpl::V8InspectorSessionImpl(V8DebuggerImpl* debugger, int con
textGroupId) |
| 27 : m_contextGroupId(contextGroupId) | 27 : m_contextGroupId(contextGroupId) |
| 28 , m_debugger(debugger) | 28 , m_debugger(debugger) |
| 29 , m_client(nullptr) |
| 29 , m_injectedScriptHost(InjectedScriptHost::create(debugger, this)) | 30 , m_injectedScriptHost(InjectedScriptHost::create(debugger, this)) |
| 30 , m_customObjectFormatterEnabled(false) | 31 , m_customObjectFormatterEnabled(false) |
| 32 , m_instrumentationCounter(0) |
| 31 , m_runtimeAgent(adoptPtr(new V8RuntimeAgentImpl(this))) | 33 , m_runtimeAgent(adoptPtr(new V8RuntimeAgentImpl(this))) |
| 32 , m_debuggerAgent(adoptPtr(new V8DebuggerAgentImpl(this))) | 34 , m_debuggerAgent(adoptPtr(new V8DebuggerAgentImpl(this))) |
| 33 , m_heapProfilerAgent(adoptPtr(new V8HeapProfilerAgentImpl(this))) | 35 , m_heapProfilerAgent(adoptPtr(new V8HeapProfilerAgentImpl(this))) |
| 34 , m_profilerAgent(adoptPtr(new V8ProfilerAgentImpl(this))) | 36 , m_profilerAgent(adoptPtr(new V8ProfilerAgentImpl(this))) |
| 35 , m_clearConsoleCallback(nullptr) | 37 , m_clearConsoleCallback(nullptr) |
| 36 { | 38 { |
| 37 } | 39 } |
| 38 | 40 |
| 39 V8InspectorSessionImpl::~V8InspectorSessionImpl() | 41 V8InspectorSessionImpl::~V8InspectorSessionImpl() |
| 40 { | 42 { |
| (...skipping 14 matching lines...) Expand all Loading... |
| 55 V8ProfilerAgent* V8InspectorSessionImpl::profilerAgent() | 57 V8ProfilerAgent* V8InspectorSessionImpl::profilerAgent() |
| 56 { | 58 { |
| 57 return m_profilerAgent.get(); | 59 return m_profilerAgent.get(); |
| 58 } | 60 } |
| 59 | 61 |
| 60 V8RuntimeAgent* V8InspectorSessionImpl::runtimeAgent() | 62 V8RuntimeAgent* V8InspectorSessionImpl::runtimeAgent() |
| 61 { | 63 { |
| 62 return m_runtimeAgent.get(); | 64 return m_runtimeAgent.get(); |
| 63 } | 65 } |
| 64 | 66 |
| 67 void V8InspectorSessionImpl::setClient(V8InspectorSessionClient* client) |
| 68 { |
| 69 m_client = client; |
| 70 } |
| 71 |
| 65 void V8InspectorSessionImpl::reset() | 72 void V8InspectorSessionImpl::reset() |
| 66 { | 73 { |
| 67 m_debuggerAgent->reset(); | 74 m_debuggerAgent->reset(); |
| 68 m_runtimeAgent->reset(); | 75 m_runtimeAgent->reset(); |
| 69 discardInjectedScripts(); | 76 discardInjectedScripts(); |
| 70 } | 77 } |
| 71 | 78 |
| 72 void V8InspectorSessionImpl::discardInjectedScripts() | 79 void V8InspectorSessionImpl::discardInjectedScripts() |
| 73 { | 80 { |
| 74 m_injectedScriptHost->clearInspectedObjects(); | 81 m_injectedScriptHost->clearInspectedObjects(); |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 | 163 |
| 157 void V8InspectorSessionImpl::reportAllContexts(V8RuntimeAgentImpl* agent) | 164 void V8InspectorSessionImpl::reportAllContexts(V8RuntimeAgentImpl* agent) |
| 158 { | 165 { |
| 159 const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_
contextGroupId); | 166 const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_
contextGroupId); |
| 160 if (!contexts) | 167 if (!contexts) |
| 161 return; | 168 return; |
| 162 for (auto& idContext : *contexts) | 169 for (auto& idContext : *contexts) |
| 163 agent->reportExecutionContextCreated(idContext.second); | 170 agent->reportExecutionContextCreated(idContext.second); |
| 164 } | 171 } |
| 165 | 172 |
| 173 void V8InspectorSessionImpl::changeInstrumentationCounter(int delta) |
| 174 { |
| 175 ASSERT(m_instrumentationCounter + delta >= 0); |
| 176 if (!m_instrumentationCounter && m_client) |
| 177 m_client->startInstrumenting(); |
| 178 m_instrumentationCounter += delta; |
| 179 if (!m_instrumentationCounter && m_client) |
| 180 m_client->stopInstrumenting(); |
| 181 } |
| 182 |
| 166 } // namespace blink | 183 } // namespace blink |
| OLD | NEW |