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

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()) {
dgozman 2016/06/28 18:58:09 Let's move if body into collectionEntries.
kozy 2016/06/28 20:55:46 Done.
676 v8::Local<v8::Value> entriesArray = collectionEntries(v8::Local<v8::Obje ct>::Cast(value));
677 if (entriesArray->IsArray()) {
678 v8::Local<v8::Array> entries = entriesArray.As<v8::Array>();
679 properties->Set(properties->Length(), v8InternalizedString("[[Entrie s]]"));
680 properties->Set(properties->Length(), entries);
681 for (size_t i = 0; i < entries->Length(); ++i) {
682 v8::Local<v8::Value> entry;
683 if (!entries->Get(context, i).ToLocal(&entry) || !entry->IsObjec t())
684 continue;
685 if (!entry.As<v8::Object>()->SetPrivate(context, V8InjectedScrip tHost::internalEntryPrivate(m_isolate), v8::Boolean::New(m_isolate, true)).FromM aybe(false))
686 continue;
687 }
688 }
689 }
690 return properties;
691 }
692
667 v8::Local<v8::Value> V8DebuggerImpl::generatorObjectDetails(v8::Local<v8::Object >& object) 693 v8::Local<v8::Value> V8DebuggerImpl::generatorObjectDetails(v8::Local<v8::Object >& object)
668 { 694 {
669 if (!enabled()) { 695 if (!enabled()) {
670 NOTREACHED(); 696 NOTREACHED();
671 return v8::Local<v8::Value>::New(m_isolate, v8::Undefined(m_isolate)); 697 return v8::Local<v8::Value>::New(m_isolate, v8::Undefined(m_isolate));
672 } 698 }
673 v8::Local<v8::Value> argv[] = { object }; 699 v8::Local<v8::Value> argv[] = { object };
674 return callDebuggerMethod("getGeneratorObjectDetails", 1, argv).ToLocalCheck ed(); 700 return callDebuggerMethod("getGeneratorObjectDetails", 1, argv).ToLocalCheck ed();
675 } 701 }
676 702
677 v8::Local<v8::Value> V8DebuggerImpl::collectionEntries(v8::Local<v8::Object>& ob ject) 703 v8::Local<v8::Value> V8DebuggerImpl::collectionEntries(v8::Local<v8::Object> obj ect)
678 { 704 {
679 if (!enabled()) { 705 if (!enabled()) {
680 NOTREACHED(); 706 NOTREACHED();
681 return v8::Local<v8::Value>::New(m_isolate, v8::Undefined(m_isolate)); 707 return v8::Local<v8::Value>::New(m_isolate, v8::Undefined(m_isolate));
682 } 708 }
683 v8::Local<v8::Value> argv[] = { object }; 709 v8::Local<v8::Value> argv[] = { object };
684 return callDebuggerMethod("getCollectionEntries", 1, argv).ToLocalChecked(); 710 return callDebuggerMethod("getCollectionEntries", 1, argv).ToLocalChecked();
685 } 711 }
686 712
687 bool V8DebuggerImpl::isPaused() 713 bool V8DebuggerImpl::isPaused()
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
957 return nullptr; 983 return nullptr;
958 return m_contexts.get(contextGroupId); 984 return m_contexts.get(contextGroupId);
959 } 985 }
960 986
961 V8InspectorSessionImpl* V8DebuggerImpl::sessionForContextGroup(int contextGroupI d) 987 V8InspectorSessionImpl* V8DebuggerImpl::sessionForContextGroup(int contextGroupI d)
962 { 988 {
963 return contextGroupId ? m_sessions.get(contextGroupId) : nullptr; 989 return contextGroupId ? m_sessions.get(contextGroupId) : nullptr;
964 } 990 }
965 991
966 } // namespace blink 992 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698