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

Unified Diff: third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp

Issue 1999843002: [DevTools] Move CommandLineAPI.getEventListeners to native (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-monitor-events-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 side-by-side diff with in-line comments
Download patch
Index: third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
diff --git a/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp b/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
index 02b29a1cd201e33364a3a1edbbf3f41a9fc3c9d7..6d9e6aac821b500a33cf70c7579a74d873485aa6 100644
--- a/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
+++ b/third_party/WebKit/Source/platform/v8_inspector/InjectedScript.cpp
@@ -366,18 +366,10 @@ void InjectedScript::wrapEvaluateResult(ErrorString* errorString, v8::MaybeLocal
}
}
-v8::MaybeLocal<v8::Object> InjectedScript::commandLineAPI(ErrorString* errorString)
-{
- v8::Isolate* isolate = m_context->isolate();
- if (m_commandLineAPI.IsEmpty()) {
- V8FunctionCall function(m_context->debugger(), m_context->context(), v8Value(), "installCommandLineAPI");
- function.appendArgument(V8Console::createCommandLineAPI(m_context));
- bool hadException = false;
- v8::Local<v8::Value> extension = function.call(hadException, false);
- if (hasInternalError(errorString, hadException || extension.IsEmpty() || !extension->IsObject()))
- return v8::MaybeLocal<v8::Object>();
- m_commandLineAPI.Reset(isolate, extension.As<v8::Object>());
- }
+v8::Local<v8::Object> InjectedScript::commandLineAPI()
+{
+ if (m_commandLineAPI.IsEmpty())
+ m_commandLineAPI.Reset(m_context->isolate(), V8Console::createCommandLineAPI(m_context));
return m_commandLineAPI.Get(m_context->isolate());
}
@@ -414,12 +406,9 @@ bool InjectedScript::Scope::initialize()
bool InjectedScript::Scope::installCommandLineAPI()
{
DCHECK(m_injectedScript && !m_context.IsEmpty() && m_global.IsEmpty());
- v8::Local<v8::Object> extensionObject;
- if (!m_injectedScript->commandLineAPI(m_errorString).ToLocal(&extensionObject))
- return false;
m_extensionPrivate = V8Debugger::scopeExtensionPrivate(m_debugger->isolate());
v8::Local<v8::Object> global = m_context->Global();
- if (!global->SetPrivate(m_context, m_extensionPrivate, extensionObject).FromMaybe(false)) {
+ if (!global->SetPrivate(m_context, m_extensionPrivate, m_injectedScript->commandLineAPI()).FromMaybe(false)) {
*m_errorString = "Internal error";
return false;
}

Powered by Google App Engine
This is Rietveld 408576698