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

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8InspectorSessionImpl.cpp

Issue 1916023002: [DevTools] Move last inspected objects to V8InspectorSessionImpl (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-part-command-line-api-to-native
Patch Set: Created 4 years, 7 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
OLDNEW
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 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
70 70
71 void V8InspectorSessionImpl::reset() 71 void V8InspectorSessionImpl::reset()
72 { 72 {
73 m_debuggerAgent->reset(); 73 m_debuggerAgent->reset();
74 m_runtimeAgent->reset(); 74 m_runtimeAgent->reset();
75 discardInjectedScripts(); 75 discardInjectedScripts();
76 } 76 }
77 77
78 void V8InspectorSessionImpl::discardInjectedScripts() 78 void V8InspectorSessionImpl::discardInjectedScripts()
79 { 79 {
80 m_injectedScriptHost->clearInspectedObjects(); 80 m_inspectedObjects.clear();
81 const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_ contextGroupId); 81 const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_ contextGroupId);
82 if (!contexts) 82 if (!contexts)
83 return; 83 return;
84 84
85 protocol::Vector<int> keys; 85 protocol::Vector<int> keys;
86 for (auto& idContext : *contexts) 86 for (auto& idContext : *contexts)
87 keys.append(idContext.first); 87 keys.append(idContext.first);
88 for (auto& key : keys) { 88 for (auto& key : keys) {
89 contexts = m_debugger->contextGroup(m_contextGroupId); 89 contexts = m_debugger->contextGroup(m_contextGroupId);
90 if (contexts && contexts->contains(key)) 90 if (contexts && contexts->contains(key))
(...skipping 25 matching lines...) Expand all
116 context->getInjectedScript()->setCustomObjectFormatterEnabled(true); 116 context->getInjectedScript()->setCustomObjectFormatterEnabled(true);
117 } 117 }
118 return context->getInjectedScript(); 118 return context->getInjectedScript();
119 } 119 }
120 120
121 InjectedScript* V8InspectorSessionImpl::findInjectedScript(ErrorString* errorStr ing, RemoteObjectIdBase* objectId) 121 InjectedScript* V8InspectorSessionImpl::findInjectedScript(ErrorString* errorStr ing, RemoteObjectIdBase* objectId)
122 { 122 {
123 return objectId ? findInjectedScript(errorString, objectId->contextId()) : n ullptr; 123 return objectId ? findInjectedScript(errorString, objectId->contextId()) : n ullptr;
124 } 124 }
125 125
126 void V8InspectorSessionImpl::addInspectedObject(PassOwnPtr<V8RuntimeAgent::Inspe ctable> inspectable)
127 {
128 m_injectedScriptHost->addInspectedObject(inspectable);
129 }
130
131 void V8InspectorSessionImpl::releaseObjectGroup(const String16& objectGroup) 126 void V8InspectorSessionImpl::releaseObjectGroup(const String16& objectGroup)
132 { 127 {
133 const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_ contextGroupId); 128 const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_ contextGroupId);
134 if (!contexts) 129 if (!contexts)
135 return; 130 return;
136 131
137 protocol::Vector<int> keys; 132 protocol::Vector<int> keys;
138 for (auto& idContext : *contexts) 133 for (auto& idContext : *contexts)
139 keys.append(idContext.first); 134 keys.append(idContext.first);
140 for (auto& key : keys) { 135 for (auto& key : keys) {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
172 void V8InspectorSessionImpl::changeInstrumentationCounter(int delta) 167 void V8InspectorSessionImpl::changeInstrumentationCounter(int delta)
173 { 168 {
174 ASSERT(m_instrumentationCounter + delta >= 0); 169 ASSERT(m_instrumentationCounter + delta >= 0);
175 if (!m_instrumentationCounter && m_client) 170 if (!m_instrumentationCounter && m_client)
176 m_client->startInstrumenting(); 171 m_client->startInstrumenting();
177 m_instrumentationCounter += delta; 172 m_instrumentationCounter += delta;
178 if (!m_instrumentationCounter && m_client) 173 if (!m_instrumentationCounter && m_client)
179 m_client->stopInstrumenting(); 174 m_client->stopInstrumenting();
180 } 175 }
181 176
177 void V8InspectorSessionImpl::addInspectedObject(PassOwnPtr<V8RuntimeAgent::Inspe ctable> inspectable)
178 {
179 m_inspectedObjects.prepend(inspectable);
180 while (m_inspectedObjects.size() > kInspectedObjectBufferSize)
181 m_inspectedObjects.removeLast();
182 }
183
184 V8RuntimeAgent::Inspectable* V8InspectorSessionImpl::inspectedObject(unsigned nu m)
185 {
186 if (num >= m_inspectedObjects.size())
187 return nullptr;
188 return m_inspectedObjects[num].get();
189 }
190
182 } // namespace blink 191 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698