| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/V8InjectedScriptHost.h" | 5 #include "platform/v8_inspector/V8InjectedScriptHost.h" |
| 6 | 6 |
| 7 #include "platform/inspector_protocol/String16.h" | 7 #include "platform/inspector_protocol/String16.h" |
| 8 #include "platform/inspector_protocol/Values.h" | 8 #include "platform/inspector_protocol/Values.h" |
| 9 #include "platform/v8_inspector/InjectedScript.h" | 9 #include "platform/v8_inspector/InjectedScript.h" |
| 10 #include "platform/v8_inspector/InjectedScriptHost.h" | 10 #include "platform/v8_inspector/InjectedScriptHost.h" |
| (...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 541 { | 541 { |
| 542 return v8::Symbol::ForApi(isolate, toV8StringInternalized(isolate, "commandL
ineAPI")); | 542 return v8::Symbol::ForApi(isolate, toV8StringInternalized(isolate, "commandL
ineAPI")); |
| 543 } | 543 } |
| 544 | 544 |
| 545 bool V8Debugger::isCommandLineAPIMethod(const String16& name) | 545 bool V8Debugger::isCommandLineAPIMethod(const String16& name) |
| 546 { | 546 { |
| 547 DEFINE_STATIC_LOCAL(protocol::HashSet<String16>, methods, ()); | 547 DEFINE_STATIC_LOCAL(protocol::HashSet<String16>, methods, ()); |
| 548 if (methods.size() == 0) { | 548 if (methods.size() == 0) { |
| 549 const char* members[] = { "$", "$$", "$x", "dir", "dirxml", "keys", "val
ues", "profile", "profileEnd", | 549 const char* members[] = { "$", "$$", "$x", "dir", "dirxml", "keys", "val
ues", "profile", "profileEnd", |
| 550 "monitorEvents", "unmonitorEvents", "inspect", "copy", "clear", "get
EventListeners", | 550 "monitorEvents", "unmonitorEvents", "inspect", "copy", "clear", "get
EventListeners", |
| 551 "debug", "undebug", "monitor", "unmonitor", "table", "$_", "$0", "$1
", "$2", "$3", "$4" }; | 551 "debug", "undebug", "monitor", "unmonitor", "table", "$_" }; |
| 552 for (size_t i = 0; i < sizeof(members) / sizeof(const char*); ++i) | 552 for (size_t i = 0; i < sizeof(members) / sizeof(const char*); ++i) |
| 553 methods.add(members[i]); | 553 methods.add(members[i]); |
| 554 } | 554 } |
| 555 return methods.find(name) != methods.end(); | 555 return methods.find(name) != methods.end(); |
| 556 } | 556 } |
| 557 | 557 |
| 558 bool V8Debugger::isCommandLineAPIGetter(const String16& name) |
| 559 { |
| 560 DEFINE_STATIC_LOCAL(protocol::HashSet<String16>, getters, ()); |
| 561 if (getters.size() == 0) { |
| 562 const char* members[] = { "$0", "$1", "$2", "$3", "$4" }; |
| 563 for (size_t i = 0; i < sizeof(members) / sizeof(const char*); ++i) |
| 564 getters.add(members[i]); |
| 565 } |
| 566 return getters.find(name) != getters.end(); |
| 567 } |
| 568 |
| 558 namespace { | 569 namespace { |
| 559 | 570 |
| 560 char hiddenPropertyName[] = "v8inspector::InjectedScriptHost"; | 571 char hiddenPropertyName[] = "v8inspector::InjectedScriptHost"; |
| 561 char className[] = "V8InjectedScriptHost"; | 572 char className[] = "V8InjectedScriptHost"; |
| 562 using InjectedScriptHostWrapper = InspectorWrapper<InjectedScriptHost, hiddenPro
pertyName, className>; | 573 using InjectedScriptHostWrapper = InspectorWrapper<InjectedScriptHost, hiddenPro
pertyName, className>; |
| 563 | 574 |
| 564 const InjectedScriptHostWrapper::V8MethodConfiguration V8InjectedScriptHostMetho
ds[] = { | 575 const InjectedScriptHostWrapper::V8MethodConfiguration V8InjectedScriptHostMetho
ds[] = { |
| 565 {"clearConsoleMessages", V8InjectedScriptHost::clearConsoleMessagesCallback}
, | 576 {"clearConsoleMessages", V8InjectedScriptHost::clearConsoleMessagesCallback}
, |
| 566 {"inspect", V8InjectedScriptHost::inspectCallback}, | 577 {"inspect", V8InjectedScriptHost::inspectCallback}, |
| 567 {"inspectedObject", V8InjectedScriptHost::inspectedObjectCallback}, | 578 {"inspectedObject", V8InjectedScriptHost::inspectedObjectCallback}, |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 603 { | 614 { |
| 604 return InjectedScriptHostWrapper::wrap(client, constructorTemplate, context,
host); | 615 return InjectedScriptHostWrapper::wrap(client, constructorTemplate, context,
host); |
| 605 } | 616 } |
| 606 | 617 |
| 607 InjectedScriptHost* V8InjectedScriptHost::unwrap(v8::Local<v8::Context> context,
v8::Local<v8::Object> object) | 618 InjectedScriptHost* V8InjectedScriptHost::unwrap(v8::Local<v8::Context> context,
v8::Local<v8::Object> object) |
| 608 { | 619 { |
| 609 return InjectedScriptHostWrapper::unwrap(context, object); | 620 return InjectedScriptHostWrapper::unwrap(context, object); |
| 610 } | 621 } |
| 611 | 622 |
| 612 } // namespace blink | 623 } // namespace blink |
| OLD | NEW |