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

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

Issue 1924663006: [DevTools] Move API methods from V8RuntimeAgent to V8InspectorSession. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@debugger-into-session
Patch Set: rebased 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/InspectedContext.h" 8 #include "platform/v8_inspector/InspectedContext.h"
9 #include "platform/v8_inspector/RemoteObjectId.h" 9 #include "platform/v8_inspector/RemoteObjectId.h"
10 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" 10 #include "platform/v8_inspector/V8DebuggerAgentImpl.h"
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 for (auto& key : keys) { 135 for (auto& key : keys) {
136 contexts = m_debugger->contextGroup(m_contextGroupId); 136 contexts = m_debugger->contextGroup(m_contextGroupId);
137 if (contexts && contexts->contains(key)) { 137 if (contexts && contexts->contains(key)) {
138 InjectedScript* injectedScript = contexts->get(key)->getInjectedScri pt(); 138 InjectedScript* injectedScript = contexts->get(key)->getInjectedScri pt();
139 if (injectedScript) 139 if (injectedScript)
140 injectedScript->releaseObjectGroup(objectGroup); // This may des troy some contexts. 140 injectedScript->releaseObjectGroup(objectGroup); // This may des troy some contexts.
141 } 141 }
142 } 142 }
143 } 143 }
144 144
145 v8::Local<v8::Value> V8InspectorSessionImpl::findObject(ErrorString* errorString , const String16& objectId, v8::Local<v8::Context>* context, String16* groupName )
146 {
147 OwnPtr<RemoteObjectId> remoteId = RemoteObjectId::parse(errorString, objectI d);
148 if (!remoteId)
149 return v8::Local<v8::Value>();
150 InjectedScript* injectedScript = findInjectedScript(errorString, remoteId.ge t());
151 if (!injectedScript)
152 return v8::Local<v8::Value>();
153 v8::Local<v8::Value> objectValue;
154 injectedScript->findObject(errorString, *remoteId, &objectValue);
155 if (objectValue.IsEmpty())
156 return v8::Local<v8::Value>();
157 if (context)
158 *context = injectedScript->context()->context();
159 if (groupName)
160 *groupName = injectedScript->objectGroupName(*remoteId);
161 return objectValue;
162 }
163
164 PassOwnPtr<protocol::Runtime::RemoteObject> V8InspectorSessionImpl::wrapObject(v 8::Local<v8::Context> context, v8::Local<v8::Value> value, const String16& group Name, bool generatePreview)
165 {
166 ErrorString errorString;
167 InjectedScript* injectedScript = findInjectedScript(&errorString, V8Debugger ::contextId(context));
168 if (!injectedScript)
169 return nullptr;
170 return injectedScript->wrapObject(&errorString, value, groupName, false, gen eratePreview);
171 }
172
173 PassOwnPtr<protocol::Runtime::RemoteObject> V8InspectorSessionImpl::wrapTable(v8 ::Local<v8::Context> context, v8::Local<v8::Value> table, v8::Local<v8::Value> c olumns)
174 {
175 ErrorString errorString;
176 InjectedScript* injectedScript = findInjectedScript(&errorString, V8Debugger ::contextId(context));
177 if (!injectedScript)
178 return nullptr;
179 return injectedScript->wrapTable(table, columns);
180 }
181
145 void V8InspectorSessionImpl::setCustomObjectFormatterEnabled(bool enabled) 182 void V8InspectorSessionImpl::setCustomObjectFormatterEnabled(bool enabled)
146 { 183 {
147 m_customObjectFormatterEnabled = enabled; 184 m_customObjectFormatterEnabled = enabled;
148 const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_ contextGroupId); 185 const V8DebuggerImpl::ContextByIdMap* contexts = m_debugger->contextGroup(m_ contextGroupId);
149 if (!contexts) 186 if (!contexts)
150 return; 187 return;
151 for (auto& idContext : *contexts) { 188 for (auto& idContext : *contexts) {
152 InjectedScript* injectedScript = idContext.second->getInjectedScript(); 189 InjectedScript* injectedScript = idContext.second->getInjectedScript();
153 if (injectedScript) 190 if (injectedScript)
154 injectedScript->setCustomObjectFormatterEnabled(enabled); 191 injectedScript->setCustomObjectFormatterEnabled(enabled);
(...skipping 12 matching lines...) Expand all
167 void V8InspectorSessionImpl::changeInstrumentationCounter(int delta) 204 void V8InspectorSessionImpl::changeInstrumentationCounter(int delta)
168 { 205 {
169 ASSERT(m_instrumentationCounter + delta >= 0); 206 ASSERT(m_instrumentationCounter + delta >= 0);
170 if (!m_instrumentationCounter && m_client) 207 if (!m_instrumentationCounter && m_client)
171 m_client->startInstrumenting(); 208 m_client->startInstrumenting();
172 m_instrumentationCounter += delta; 209 m_instrumentationCounter += delta;
173 if (!m_instrumentationCounter && m_client) 210 if (!m_instrumentationCounter && m_client)
174 m_client->stopInstrumenting(); 211 m_client->stopInstrumenting();
175 } 212 }
176 213
177 void V8InspectorSessionImpl::addInspectedObject(PassOwnPtr<V8RuntimeAgent::Inspe ctable> inspectable) 214 void V8InspectorSessionImpl::addInspectedObject(PassOwnPtr<V8InspectorSession::I nspectable> inspectable)
178 { 215 {
179 m_inspectedObjects.prepend(std::move(inspectable)); 216 m_inspectedObjects.prepend(std::move(inspectable));
180 while (m_inspectedObjects.size() > kInspectedObjectBufferSize) 217 while (m_inspectedObjects.size() > kInspectedObjectBufferSize)
181 m_inspectedObjects.removeLast(); 218 m_inspectedObjects.removeLast();
182 } 219 }
183 220
184 V8RuntimeAgent::Inspectable* V8InspectorSessionImpl::inspectedObject(unsigned nu m) 221 V8InspectorSession::Inspectable* V8InspectorSessionImpl::inspectedObject(unsigne d num)
185 { 222 {
186 if (num >= m_inspectedObjects.size()) 223 if (num >= m_inspectedObjects.size())
187 return nullptr; 224 return nullptr;
188 return m_inspectedObjects[num].get(); 225 return m_inspectedObjects[num].get();
189 } 226 }
190 227
191 void V8InspectorSessionImpl::schedulePauseOnNextStatement(const String16& breakR eason, PassOwnPtr<protocol::DictionaryValue> data) 228 void V8InspectorSessionImpl::schedulePauseOnNextStatement(const String16& breakR eason, PassOwnPtr<protocol::DictionaryValue> data)
192 { 229 {
193 m_debuggerAgent->schedulePauseOnNextStatement(breakReason, std::move(data)); 230 m_debuggerAgent->schedulePauseOnNextStatement(breakReason, std::move(data));
194 } 231 }
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
233 { 270 {
234 m_debuggerAgent->asyncTaskFinished(task); 271 m_debuggerAgent->asyncTaskFinished(task);
235 } 272 }
236 273
237 void V8InspectorSessionImpl::allAsyncTasksCanceled() 274 void V8InspectorSessionImpl::allAsyncTasksCanceled()
238 { 275 {
239 m_debuggerAgent->allAsyncTasksCanceled(); 276 m_debuggerAgent->allAsyncTasksCanceled();
240 } 277 }
241 278
242 } // namespace blink 279 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698