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

Unified Diff: third_party/WebKit/Source/core/inspector/MainThreadDebugger.cpp

Issue 1992913006: [DevTools] Move monitor/unmonitor events CommandLineAPI to native (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@move-selectors-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
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/inspector/ThreadDebugger.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/inspector/MainThreadDebugger.cpp
diff --git a/third_party/WebKit/Source/core/inspector/MainThreadDebugger.cpp b/third_party/WebKit/Source/core/inspector/MainThreadDebugger.cpp
index 7664998975d44ec016313fb0cf613940dbd2af3c..ed7a8a390ad7840087c8fb621913eb6b8f122c07 100644
--- a/third_party/WebKit/Source/core/inspector/MainThreadDebugger.cpp
+++ b/third_party/WebKit/Source/core/inspector/MainThreadDebugger.cpp
@@ -249,31 +249,12 @@ bool MainThreadDebugger::isCommandLineAPIMethod(const String& name)
for (size_t i = 0; i < WTF_ARRAY_LENGTH(members); ++i)
methods.add(members[i]);
}
- return methods.find(name) != methods.end() || V8Debugger::isCommandLineAPIMethod(name);
-}
-
-static void returnDataCallback(const v8::FunctionCallbackInfo<v8::Value>& info)
-{
- info.GetReturnValue().Set(info.Data());
-}
-
-static void createFunctionProperty(v8::Local<v8::Context> context, v8::Local<v8::Object> object, const char* name, v8::FunctionCallback callback, const char* description)
-{
- v8::Local<v8::String> funcName = v8String(context->GetIsolate(), name);
- v8::Local<v8::Function> func;
- if (!v8::Function::New(context, callback).ToLocal(&func))
- return;
- func->SetName(funcName);
- v8::Local<v8::String> returnValue = v8String(context->GetIsolate(), description);
- v8::Local<v8::Function> toStringFunction;
- if (v8::Function::New(context, returnDataCallback, returnValue).ToLocal(&toStringFunction))
- func->Set(v8String(context->GetIsolate(), "toString"), toStringFunction);
- if (!object->Set(context, funcName, func).FromMaybe(false))
- return;
+ return methods.find(name) != methods.end() || ThreadDebugger::isCommandLineAPIMethod(name);
}
void MainThreadDebugger::installAdditionalCommandLineAPI(v8::Local<v8::Context> context, v8::Local<v8::Object> object)
{
+ ThreadDebugger::installAdditionalCommandLineAPI(context, object);
createFunctionProperty(context, object, "$", MainThreadDebugger::querySelectorCallback, "function $(selector, [startNode]) { [Command Line API] }");
createFunctionProperty(context, object, "$$", MainThreadDebugger::querySelectorAllCallback, "function $$(selector, [startNode]) { [Command Line API] }");
createFunctionProperty(context, object, "$x", MainThreadDebugger::xpathSelectorCallback, "function $x(xpath, [startNode]) { [Command Line API] }");
« no previous file with comments | « no previous file | third_party/WebKit/Source/core/inspector/ThreadDebugger.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698