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

Unified 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, 8 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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/v8_inspector/V8InspectorSessionImpl.cpp
diff --git a/third_party/WebKit/Source/platform/v8_inspector/V8InspectorSessionImpl.cpp b/third_party/WebKit/Source/platform/v8_inspector/V8InspectorSessionImpl.cpp
index c07fa1f26cda5a39b0cfd82336ca212e209fed39..80e40356bbe2bdf54e04d29eadc49b45e5e6fc65 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/V8InspectorSessionImpl.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/V8InspectorSessionImpl.cpp
@@ -142,6 +142,43 @@ void V8InspectorSessionImpl::releaseObjectGroup(const String16& objectGroup)
}
}
+v8::Local<v8::Value> V8InspectorSessionImpl::findObject(ErrorString* errorString, const String16& objectId, v8::Local<v8::Context>* context, String16* groupName)
+{
+ OwnPtr<RemoteObjectId> remoteId = RemoteObjectId::parse(errorString, objectId);
+ if (!remoteId)
+ return v8::Local<v8::Value>();
+ InjectedScript* injectedScript = findInjectedScript(errorString, remoteId.get());
+ if (!injectedScript)
+ return v8::Local<v8::Value>();
+ v8::Local<v8::Value> objectValue;
+ injectedScript->findObject(errorString, *remoteId, &objectValue);
+ if (objectValue.IsEmpty())
+ return v8::Local<v8::Value>();
+ if (context)
+ *context = injectedScript->context()->context();
+ if (groupName)
+ *groupName = injectedScript->objectGroupName(*remoteId);
+ return objectValue;
+}
+
+PassOwnPtr<protocol::Runtime::RemoteObject> V8InspectorSessionImpl::wrapObject(v8::Local<v8::Context> context, v8::Local<v8::Value> value, const String16& groupName, bool generatePreview)
+{
+ ErrorString errorString;
+ InjectedScript* injectedScript = findInjectedScript(&errorString, V8Debugger::contextId(context));
+ if (!injectedScript)
+ return nullptr;
+ return injectedScript->wrapObject(&errorString, value, groupName, false, generatePreview);
+}
+
+PassOwnPtr<protocol::Runtime::RemoteObject> V8InspectorSessionImpl::wrapTable(v8::Local<v8::Context> context, v8::Local<v8::Value> table, v8::Local<v8::Value> columns)
+{
+ ErrorString errorString;
+ InjectedScript* injectedScript = findInjectedScript(&errorString, V8Debugger::contextId(context));
+ if (!injectedScript)
+ return nullptr;
+ return injectedScript->wrapTable(table, columns);
+}
+
void V8InspectorSessionImpl::setCustomObjectFormatterEnabled(bool enabled)
{
m_customObjectFormatterEnabled = enabled;
@@ -174,14 +211,14 @@ void V8InspectorSessionImpl::changeInstrumentationCounter(int delta)
m_client->stopInstrumenting();
}
-void V8InspectorSessionImpl::addInspectedObject(PassOwnPtr<V8RuntimeAgent::Inspectable> inspectable)
+void V8InspectorSessionImpl::addInspectedObject(PassOwnPtr<V8InspectorSession::Inspectable> inspectable)
{
m_inspectedObjects.prepend(std::move(inspectable));
while (m_inspectedObjects.size() > kInspectedObjectBufferSize)
m_inspectedObjects.removeLast();
}
-V8RuntimeAgent::Inspectable* V8InspectorSessionImpl::inspectedObject(unsigned num)
+V8InspectorSession::Inspectable* V8InspectorSessionImpl::inspectedObject(unsigned num)
{
if (num >= m_inspectedObjects.size())
return nullptr;

Powered by Google App Engine
This is Rietveld 408576698