OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2010-2011 Google Inc. All rights reserved. | 2 * Copyright (c) 2010-2011 Google Inc. All rights reserved. |
3 * | 3 * |
4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
6 * met: | 6 * met: |
7 * | 7 * |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 #include "platform/v8_inspector/V8DebuggerImpl.h" | 31 #include "platform/v8_inspector/V8DebuggerImpl.h" |
32 | 32 |
33 #include "platform/inspector_protocol/Values.h" | 33 #include "platform/inspector_protocol/Values.h" |
34 #include "platform/v8_inspector/Atomics.h" | 34 #include "platform/v8_inspector/Atomics.h" |
35 #include "platform/v8_inspector/DebuggerScript.h" | 35 #include "platform/v8_inspector/DebuggerScript.h" |
36 #include "platform/v8_inspector/InspectedContext.h" | 36 #include "platform/v8_inspector/InspectedContext.h" |
37 #include "platform/v8_inspector/ScriptBreakpoint.h" | 37 #include "platform/v8_inspector/ScriptBreakpoint.h" |
38 #include "platform/v8_inspector/V8Compat.h" | 38 #include "platform/v8_inspector/V8Compat.h" |
39 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" | 39 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" |
| 40 #include "platform/v8_inspector/V8InjectedScriptHost.h" |
40 #include "platform/v8_inspector/V8InspectorSessionImpl.h" | 41 #include "platform/v8_inspector/V8InspectorSessionImpl.h" |
41 #include "platform/v8_inspector/V8RuntimeAgentImpl.h" | 42 #include "platform/v8_inspector/V8RuntimeAgentImpl.h" |
42 #include "platform/v8_inspector/V8StackTraceImpl.h" | 43 #include "platform/v8_inspector/V8StackTraceImpl.h" |
43 #include "platform/v8_inspector/V8StringUtil.h" | 44 #include "platform/v8_inspector/V8StringUtil.h" |
44 #include "platform/v8_inspector/public/V8DebuggerClient.h" | 45 #include "platform/v8_inspector/public/V8DebuggerClient.h" |
45 #include <v8-profiler.h> | 46 #include <v8-profiler.h> |
46 | 47 |
47 namespace blink { | 48 namespace blink { |
48 | 49 |
49 namespace { | 50 namespace { |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
662 v8::MaybeLocal<v8::Value> V8DebuggerImpl::functionScopes(v8::Local<v8::Function>
function) | 663 v8::MaybeLocal<v8::Value> V8DebuggerImpl::functionScopes(v8::Local<v8::Function>
function) |
663 { | 664 { |
664 if (!enabled()) { | 665 if (!enabled()) { |
665 NOTREACHED(); | 666 NOTREACHED(); |
666 return v8::Local<v8::Value>::New(m_isolate, v8::Undefined(m_isolate)); | 667 return v8::Local<v8::Value>::New(m_isolate, v8::Undefined(m_isolate)); |
667 } | 668 } |
668 v8::Local<v8::Value> argv[] = { function }; | 669 v8::Local<v8::Value> argv[] = { function }; |
669 return callDebuggerMethod("getFunctionScopes", 1, argv); | 670 return callDebuggerMethod("getFunctionScopes", 1, argv); |
670 } | 671 } |
671 | 672 |
| 673 v8::MaybeLocal<v8::Array> V8DebuggerImpl::internalProperties(v8::Local<v8::Conte
xt> context, v8::Local<v8::Value> value) |
| 674 { |
| 675 v8::Local<v8::Array> properties; |
| 676 if (!v8::Debug::GetInternalProperties(m_isolate, value).ToLocal(&properties)
) |
| 677 return v8::MaybeLocal<v8::Array>(); |
| 678 if (!enabled()) |
| 679 return properties; |
| 680 if (value->IsMap() || value->IsWeakMap() || value->IsSet() || value->IsWeakS
et() || value->IsSetIterator() || value->IsMapIterator()) { |
| 681 v8::Local<v8::Value> entries = collectionEntries(context, v8::Local<v8::
Object>::Cast(value)); |
| 682 if (entries->IsArray()) { |
| 683 properties->Set(properties->Length(), v8InternalizedString("[[Entrie
s]]")); |
| 684 properties->Set(properties->Length(), entries); |
| 685 } |
| 686 } |
| 687 return properties; |
| 688 } |
| 689 |
672 v8::Local<v8::Value> V8DebuggerImpl::generatorObjectDetails(v8::Local<v8::Object
>& object) | 690 v8::Local<v8::Value> V8DebuggerImpl::generatorObjectDetails(v8::Local<v8::Object
>& object) |
673 { | 691 { |
674 if (!enabled()) { | 692 if (!enabled()) { |
675 NOTREACHED(); | 693 NOTREACHED(); |
676 return v8::Local<v8::Value>::New(m_isolate, v8::Undefined(m_isolate)); | 694 return v8::Local<v8::Value>::New(m_isolate, v8::Undefined(m_isolate)); |
677 } | 695 } |
678 v8::Local<v8::Value> argv[] = { object }; | 696 v8::Local<v8::Value> argv[] = { object }; |
679 return callDebuggerMethod("getGeneratorObjectDetails", 1, argv).ToLocalCheck
ed(); | 697 return callDebuggerMethod("getGeneratorObjectDetails", 1, argv).ToLocalCheck
ed(); |
680 } | 698 } |
681 | 699 |
682 v8::Local<v8::Value> V8DebuggerImpl::collectionEntries(v8::Local<v8::Object>& ob
ject) | 700 v8::Local<v8::Value> V8DebuggerImpl::collectionEntries(v8::Local<v8::Context> co
ntext, v8::Local<v8::Object> object) |
683 { | 701 { |
684 if (!enabled()) { | 702 if (!enabled()) { |
685 NOTREACHED(); | 703 NOTREACHED(); |
686 return v8::Local<v8::Value>::New(m_isolate, v8::Undefined(m_isolate)); | 704 return v8::Undefined(m_isolate); |
687 } | 705 } |
688 v8::Local<v8::Value> argv[] = { object }; | 706 v8::Local<v8::Value> argv[] = { object }; |
689 return callDebuggerMethod("getCollectionEntries", 1, argv).ToLocalChecked(); | 707 v8::Local<v8::Value> entriesValue = callDebuggerMethod("getCollectionEntries
", 1, argv).ToLocalChecked(); |
| 708 if (!entriesValue->IsArray()) |
| 709 return v8::Undefined(m_isolate); |
| 710 v8::Local<v8::Array> entries = entriesValue.As<v8::Array>(); |
| 711 for (size_t i = 0; i < entries->Length(); ++i) { |
| 712 v8::Local<v8::Value> entry; |
| 713 if (!entries->Get(context, i).ToLocal(&entry) || !entry->IsObject()) |
| 714 continue; |
| 715 if (!entry.As<v8::Object>()->SetPrivate(context, V8InjectedScriptHost::i
nternalEntryPrivate(m_isolate), v8::True(m_isolate)).FromMaybe(false)) |
| 716 continue; |
| 717 } |
| 718 if (!entries->SetPrototype(context, v8::Null(m_isolate)).FromMaybe(false)) |
| 719 return v8::Undefined(m_isolate); |
| 720 return entries; |
690 } | 721 } |
691 | 722 |
692 bool V8DebuggerImpl::isPaused() | 723 bool V8DebuggerImpl::isPaused() |
693 { | 724 { |
694 return !m_pausedContext.IsEmpty(); | 725 return !m_pausedContext.IsEmpty(); |
695 } | 726 } |
696 | 727 |
697 v8::MaybeLocal<v8::Value> V8DebuggerImpl::runCompiledScript(v8::Local<v8::Contex
t> context, v8::Local<v8::Script> script) | 728 v8::MaybeLocal<v8::Value> V8DebuggerImpl::runCompiledScript(v8::Local<v8::Contex
t> context, v8::Local<v8::Script> script) |
698 { | 729 { |
699 // TODO(dgozman): get rid of this check. | 730 // TODO(dgozman): get rid of this check. |
(...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
982 | 1013 |
983 V8InspectorSessionImpl* V8DebuggerImpl::sessionForContextGroup(int contextGroupI
d) | 1014 V8InspectorSessionImpl* V8DebuggerImpl::sessionForContextGroup(int contextGroupI
d) |
984 { | 1015 { |
985 if (!contextGroupId) | 1016 if (!contextGroupId) |
986 return nullptr; | 1017 return nullptr; |
987 SessionMap::iterator iter = m_sessions.find(contextGroupId); | 1018 SessionMap::iterator iter = m_sessions.find(contextGroupId); |
988 return iter == m_sessions.end() ? nullptr : iter->second; | 1019 return iter == m_sessions.end() ? nullptr : iter->second; |
989 } | 1020 } |
990 | 1021 |
991 } // namespace blink | 1022 } // namespace blink |
OLD | NEW |