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

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

Issue 2102453003: [DevTools] Move collectionEntries to internalProperties in protocol (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 /* 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
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 607 matching lines...) Expand 10 before | Expand all | Expand 10 after
657 v8::MaybeLocal<v8::Value> V8DebuggerImpl::functionScopes(v8::Local<v8::Function> function) 658 v8::MaybeLocal<v8::Value> V8DebuggerImpl::functionScopes(v8::Local<v8::Function> function)
658 { 659 {
659 if (!enabled()) { 660 if (!enabled()) {
660 NOTREACHED(); 661 NOTREACHED();
661 return v8::Local<v8::Value>::New(m_isolate, v8::Undefined(m_isolate)); 662 return v8::Local<v8::Value>::New(m_isolate, v8::Undefined(m_isolate));
662 } 663 }
663 v8::Local<v8::Value> argv[] = { function }; 664 v8::Local<v8::Value> argv[] = { function };
664 return callDebuggerMethod("getFunctionScopes", 1, argv); 665 return callDebuggerMethod("getFunctionScopes", 1, argv);
665 } 666 }
666 667
668 v8::MaybeLocal<v8::Array> V8DebuggerImpl::internalProperties(v8::Local<v8::Conte xt> context, v8::Local<v8::Value> value)
669 {
670 v8::Local<v8::Array> properties;
671 if (!v8::Debug::GetInternalProperties(m_isolate, value).ToLocal(&properties) )
672 return v8::MaybeLocal<v8::Array>();
673 if (!enabled())
674 return properties;
675 if (value->IsMap() || value->IsWeakMap() || value->IsSet() || value->IsWeakS et() || value->IsSetIterator() || value->IsMapIterator()) {
676 v8::Local<v8::Value> entries = collectionEntries(context,v8::Local<v8::O bject>::Cast(value));
677 if (entries->IsArray()) {
678 properties->Set(properties->Length(), v8InternalizedString("[[Entrie s]]"));
679 properties->Set(properties->Length(), entries);
680 }
681 }
682 return properties;
683 }
684
667 v8::Local<v8::Value> V8DebuggerImpl::generatorObjectDetails(v8::Local<v8::Object >& object) 685 v8::Local<v8::Value> V8DebuggerImpl::generatorObjectDetails(v8::Local<v8::Object >& object)
668 { 686 {
669 if (!enabled()) { 687 if (!enabled()) {
670 NOTREACHED(); 688 NOTREACHED();
671 return v8::Local<v8::Value>::New(m_isolate, v8::Undefined(m_isolate)); 689 return v8::Local<v8::Value>::New(m_isolate, v8::Undefined(m_isolate));
672 } 690 }
673 v8::Local<v8::Value> argv[] = { object }; 691 v8::Local<v8::Value> argv[] = { object };
674 return callDebuggerMethod("getGeneratorObjectDetails", 1, argv).ToLocalCheck ed(); 692 return callDebuggerMethod("getGeneratorObjectDetails", 1, argv).ToLocalCheck ed();
675 } 693 }
676 694
677 v8::Local<v8::Value> V8DebuggerImpl::collectionEntries(v8::Local<v8::Object>& ob ject) 695 v8::Local<v8::Value> V8DebuggerImpl::collectionEntries(v8::Local<v8::Context> co ntext, v8::Local<v8::Object> object)
678 { 696 {
679 if (!enabled()) { 697 if (!enabled()) {
680 NOTREACHED(); 698 NOTREACHED();
681 return v8::Local<v8::Value>::New(m_isolate, v8::Undefined(m_isolate)); 699 return v8::Undefined(m_isolate);
682 } 700 }
683 v8::Local<v8::Value> argv[] = { object }; 701 v8::Local<v8::Value> argv[] = { object };
684 return callDebuggerMethod("getCollectionEntries", 1, argv).ToLocalChecked(); 702 v8::Local<v8::Value> entriesValue = callDebuggerMethod("getCollectionEntries ", 1, argv).ToLocalChecked();
703 if (!entriesValue->IsArray())
704 return v8::Undefined(m_isolate);
705 v8::Local<v8::Array> entries = entriesValue.As<v8::Array>();
706 for (size_t i = 0; i < entries->Length(); ++i) {
707 v8::Local<v8::Value> entry;
708 if (!entries->Get(context, i).ToLocal(&entry) || !entry->IsObject())
709 continue;
710 if (!entry.As<v8::Object>()->SetPrivate(context, V8InjectedScriptHost::i nternalEntryPrivate(m_isolate), v8::True(m_isolate)).FromMaybe(false))
711 continue;
712 }
713 return entries;
685 } 714 }
686 715
687 bool V8DebuggerImpl::isPaused() 716 bool V8DebuggerImpl::isPaused()
688 { 717 {
689 return !m_pausedContext.IsEmpty(); 718 return !m_pausedContext.IsEmpty();
690 } 719 }
691 720
692 v8::MaybeLocal<v8::Value> V8DebuggerImpl::runCompiledScript(v8::Local<v8::Contex t> context, v8::Local<v8::Script> script) 721 v8::MaybeLocal<v8::Value> V8DebuggerImpl::runCompiledScript(v8::Local<v8::Contex t> context, v8::Local<v8::Script> script)
693 { 722 {
694 // TODO(dgozman): get rid of this check. 723 // TODO(dgozman): get rid of this check.
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 return nullptr; 986 return nullptr;
958 return m_contexts.get(contextGroupId); 987 return m_contexts.get(contextGroupId);
959 } 988 }
960 989
961 V8InspectorSessionImpl* V8DebuggerImpl::sessionForContextGroup(int contextGroupI d) 990 V8InspectorSessionImpl* V8DebuggerImpl::sessionForContextGroup(int contextGroupI d)
962 { 991 {
963 return contextGroupId ? m_sessions.get(contextGroupId) : nullptr; 992 return contextGroupId ? m_sessions.get(contextGroupId) : nullptr;
964 } 993 }
965 994
966 } // namespace blink 995 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698