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

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

Issue 1983423002: [DevTools] Move CommandLineAPI querySelector and querySelectorAll to native (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@pass-bind-remote-object
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/V8Console.h" 5 #include "platform/v8_inspector/V8Console.h"
6 6
7 #include "platform/inspector_protocol/String16.h" 7 #include "platform/inspector_protocol/String16.h"
8 #include "platform/v8_inspector/InjectedScript.h" 8 #include "platform/v8_inspector/InjectedScript.h"
9 #include "platform/v8_inspector/InspectedContext.h" 9 #include "platform/v8_inspector/InspectedContext.h"
10 #include "platform/v8_inspector/V8Compat.h" 10 #include "platform/v8_inspector/V8Compat.h"
(...skipping 675 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 createBoundFunctionProperty(context, commandLineAPI, "unmonitor", V8Console: :unmonitorFunctionCallback, "function unmonitor(function) { [Command Line API] } "); 686 createBoundFunctionProperty(context, commandLineAPI, "unmonitor", V8Console: :unmonitorFunctionCallback, "function unmonitor(function) { [Command Line API] } ");
687 createBoundFunctionProperty(context, commandLineAPI, "inspect", V8Console::i nspectCallback, "function inspect(object) { [Command Line API] }"); 687 createBoundFunctionProperty(context, commandLineAPI, "inspect", V8Console::i nspectCallback, "function inspect(object) { [Command Line API] }");
688 createBoundFunctionProperty(context, commandLineAPI, "copy", V8Console::copy Callback, "function copy(value) { [Command Line API] }"); 688 createBoundFunctionProperty(context, commandLineAPI, "copy", V8Console::copy Callback, "function copy(value) { [Command Line API] }");
689 createBoundFunctionProperty(context, commandLineAPI, "$_", V8Console::lastEv aluationResultCallback); 689 createBoundFunctionProperty(context, commandLineAPI, "$_", V8Console::lastEv aluationResultCallback);
690 createBoundFunctionProperty(context, commandLineAPI, "$0", V8Console::inspec tedObject0); 690 createBoundFunctionProperty(context, commandLineAPI, "$0", V8Console::inspec tedObject0);
691 createBoundFunctionProperty(context, commandLineAPI, "$1", V8Console::inspec tedObject1); 691 createBoundFunctionProperty(context, commandLineAPI, "$1", V8Console::inspec tedObject1);
692 createBoundFunctionProperty(context, commandLineAPI, "$2", V8Console::inspec tedObject2); 692 createBoundFunctionProperty(context, commandLineAPI, "$2", V8Console::inspec tedObject2);
693 createBoundFunctionProperty(context, commandLineAPI, "$3", V8Console::inspec tedObject3); 693 createBoundFunctionProperty(context, commandLineAPI, "$3", V8Console::inspec tedObject3);
694 createBoundFunctionProperty(context, commandLineAPI, "$4", V8Console::inspec tedObject4); 694 createBoundFunctionProperty(context, commandLineAPI, "$4", V8Console::inspec tedObject4);
695 695
696 inspectedContext->debugger()->client()->installAdditionalCommandLineAPI(cont ext, commandLineAPI);
697
696 commandLineAPI->SetPrivate(context, inspectedContextPrivateKey(isolate), v8: :External::New(isolate, inspectedContext)); 698 commandLineAPI->SetPrivate(context, inspectedContextPrivateKey(isolate), v8: :External::New(isolate, inspectedContext));
697 return commandLineAPI; 699 return commandLineAPI;
698 } 700 }
699 701
700 void V8Console::clearInspectedContextIfNeeded(v8::Local<v8::Context> context, v8 ::Local<v8::Object> console) 702 void V8Console::clearInspectedContextIfNeeded(v8::Local<v8::Context> context, v8 ::Local<v8::Object> console)
701 { 703 {
702 v8::Isolate* isolate = context->GetIsolate(); 704 v8::Isolate* isolate = context->GetIsolate();
703 console->SetPrivate(context, inspectedContextPrivateKey(isolate), v8::Extern al::New(isolate, nullptr)); 705 console->SetPrivate(context, inspectedContextPrivateKey(isolate), v8::Extern al::New(isolate, nullptr));
704 } 706 }
705 707
706 bool V8Debugger::isCommandLineAPIMethod(const String16& name) 708 bool V8Debugger::isCommandLineAPIMethod(const String16& name)
707 { 709 {
708 DEFINE_STATIC_LOCAL(protocol::HashSet<String16>, methods, ()); 710 DEFINE_STATIC_LOCAL(protocol::HashSet<String16>, methods, ());
709 if (methods.size() == 0) { 711 if (methods.size() == 0) {
710 const char* members[] = { "$", "$$", "$x", "dir", "dirxml", "keys", "val ues", "profile", "profileEnd", 712 const char* members[] = { "dir", "dirxml", "keys", "values", "profile", "profileEnd",
711 "monitorEvents", "unmonitorEvents", "inspect", "copy", "clear", "get EventListeners", 713 "monitorEvents", "unmonitorEvents", "inspect", "copy", "clear", "get EventListeners",
712 "debug", "undebug", "monitor", "unmonitor", "table" }; 714 "debug", "undebug", "monitor", "unmonitor", "table" };
713 for (size_t i = 0; i < WTF_ARRAY_LENGTH(members); ++i) 715 for (size_t i = 0; i < WTF_ARRAY_LENGTH(members); ++i)
714 methods.add(members[i]); 716 methods.add(members[i]);
715 } 717 }
716 return methods.find(name) != methods.end(); 718 return methods.find(name) != methods.end();
717 } 719 }
718 720
719 bool V8Debugger::isCommandLineAPIGetter(const String16& name) 721 bool V8Debugger::isCommandLineAPIGetter(const String16& name)
720 { 722 {
721 DEFINE_STATIC_LOCAL(protocol::HashSet<String16>, getters, ()); 723 DEFINE_STATIC_LOCAL(protocol::HashSet<String16>, getters, ());
722 if (getters.size() == 0) { 724 if (getters.size() == 0) {
723 const char* members[] = { "$0", "$1", "$2", "$3", "$4", "$_" }; 725 const char* members[] = { "$0", "$1", "$2", "$3", "$4", "$_" };
724 for (size_t i = 0; i < WTF_ARRAY_LENGTH(members); ++i) 726 for (size_t i = 0; i < WTF_ARRAY_LENGTH(members); ++i)
725 getters.add(members[i]); 727 getters.add(members[i]);
726 } 728 }
727 return getters.find(name) != getters.end(); 729 return getters.find(name) != getters.end();
728 } 730 }
729 731
730 } // namespace blink 732 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698