| 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" |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 63 | 63 |
| 64 void V8InspectorSessionImpl::reset() | 64 void V8InspectorSessionImpl::reset() |
| 65 { | 65 { |
| 66 m_debuggerAgent->reset(); | 66 m_debuggerAgent->reset(); |
| 67 m_runtimeAgent->reset(); | 67 m_runtimeAgent->reset(); |
| 68 discardInjectedScripts(); | 68 discardInjectedScripts(); |
| 69 } | 69 } |
| 70 | 70 |
| 71 void V8InspectorSessionImpl::discardInjectedScripts() | 71 void V8InspectorSessionImpl::discardInjectedScripts() |
| 72 { | 72 { |
| 73 m_injectedScriptHost->clearInspectedObjects(); | 73 m_inspectedObjects.clear(); |
| 74 const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_
contextGroupId); | 74 const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_
contextGroupId); |
| 75 if (!contexts) | 75 if (!contexts) |
| 76 return; | 76 return; |
| 77 | 77 |
| 78 protocol::Vector<int> keys; | 78 protocol::Vector<int> keys; |
| 79 for (auto& idContext : *contexts) | 79 for (auto& idContext : *contexts) |
| 80 keys.append(idContext.first); | 80 keys.append(idContext.first); |
| 81 for (auto& key : keys) { | 81 for (auto& key : keys) { |
| 82 contexts = m_debugger->contextGroup(m_contextGroupId); | 82 contexts = m_debugger->contextGroup(m_contextGroupId); |
| 83 if (contexts && contexts->contains(key)) | 83 if (contexts && contexts->contains(key)) |
| (...skipping 25 matching lines...) Expand all Loading... |
| 109 context->getInjectedScript()->setCustomObjectFormatterEnabled(true); | 109 context->getInjectedScript()->setCustomObjectFormatterEnabled(true); |
| 110 } | 110 } |
| 111 return context->getInjectedScript(); | 111 return context->getInjectedScript(); |
| 112 } | 112 } |
| 113 | 113 |
| 114 InjectedScript* V8InspectorSessionImpl::findInjectedScript(ErrorString* errorStr
ing, RemoteObjectIdBase* objectId) | 114 InjectedScript* V8InspectorSessionImpl::findInjectedScript(ErrorString* errorStr
ing, RemoteObjectIdBase* objectId) |
| 115 { | 115 { |
| 116 return objectId ? findInjectedScript(errorString, objectId->contextId()) : n
ullptr; | 116 return objectId ? findInjectedScript(errorString, objectId->contextId()) : n
ullptr; |
| 117 } | 117 } |
| 118 | 118 |
| 119 void V8InspectorSessionImpl::addInspectedObject(PassOwnPtr<V8RuntimeAgent::Inspe
ctable> inspectable) | |
| 120 { | |
| 121 m_injectedScriptHost->addInspectedObject(inspectable); | |
| 122 } | |
| 123 | |
| 124 void V8InspectorSessionImpl::releaseObjectGroup(const String16& objectGroup) | 119 void V8InspectorSessionImpl::releaseObjectGroup(const String16& objectGroup) |
| 125 { | 120 { |
| 126 const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_
contextGroupId); | 121 const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_
contextGroupId); |
| 127 if (!contexts) | 122 if (!contexts) |
| 128 return; | 123 return; |
| 129 | 124 |
| 130 protocol::Vector<int> keys; | 125 protocol::Vector<int> keys; |
| 131 for (auto& idContext : *contexts) | 126 for (auto& idContext : *contexts) |
| 132 keys.append(idContext.first); | 127 keys.append(idContext.first); |
| 133 for (auto& key : keys) { | 128 for (auto& key : keys) { |
| (...skipping 21 matching lines...) Expand all Loading... |
| 155 | 150 |
| 156 void V8InspectorSessionImpl::reportAllContexts(V8RuntimeAgentImpl* agent) | 151 void V8InspectorSessionImpl::reportAllContexts(V8RuntimeAgentImpl* agent) |
| 157 { | 152 { |
| 158 const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_
contextGroupId); | 153 const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_
contextGroupId); |
| 159 if (!contexts) | 154 if (!contexts) |
| 160 return; | 155 return; |
| 161 for (auto& idContext : *contexts) | 156 for (auto& idContext : *contexts) |
| 162 agent->reportExecutionContextCreated(idContext.second); | 157 agent->reportExecutionContextCreated(idContext.second); |
| 163 } | 158 } |
| 164 | 159 |
| 160 void V8InspectorSessionImpl::addInspectedObject(PassOwnPtr<V8RuntimeAgent::Inspe
ctable> inspectable) |
| 161 { |
| 162 m_inspectedObjects.prepend(inspectable); |
| 163 while (m_inspectedObjects.size() > inspectedObjectBufferSize) |
| 164 m_inspectedObjects.removeLast(); |
| 165 } |
| 166 |
| 167 V8RuntimeAgent::Inspectable* V8InspectorSessionImpl::inspectedObject(unsigned nu
m) |
| 168 { |
| 169 if (num >= m_inspectedObjects.size()) |
| 170 return nullptr; |
| 171 return m_inspectedObjects[num].get(); |
| 172 } |
| 173 |
| 165 } // namespace blink | 174 } // namespace blink |
| OLD | NEW |