| OLD | NEW |
| 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/V8Debugger.h" | 5 #include "platform/v8_inspector/V8Debugger.h" |
| 6 | 6 |
| 7 #include "platform/v8_inspector/DebuggerScript.h" | 7 #include "platform/v8_inspector/DebuggerScript.h" |
| 8 #include "platform/v8_inspector/ScriptBreakpoint.h" | 8 #include "platform/v8_inspector/ScriptBreakpoint.h" |
| 9 #include "platform/v8_inspector/V8Compat.h" | 9 #include "platform/v8_inspector/V8Compat.h" |
| 10 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" | 10 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 } | 648 } |
| 649 | 649 |
| 650 v8::Local<v8::Value> V8Debugger::collectionEntries(v8::Local<v8::Context> contex
t, v8::Local<v8::Object> object) | 650 v8::Local<v8::Value> V8Debugger::collectionEntries(v8::Local<v8::Context> contex
t, v8::Local<v8::Object> object) |
| 651 { | 651 { |
| 652 if (!enabled()) { | 652 if (!enabled()) { |
| 653 NOTREACHED(); | 653 NOTREACHED(); |
| 654 return v8::Undefined(m_isolate); | 654 return v8::Undefined(m_isolate); |
| 655 } | 655 } |
| 656 v8::Local<v8::Value> argv[] = { object }; | 656 v8::Local<v8::Value> argv[] = { object }; |
| 657 v8::Local<v8::Value> entriesValue = callDebuggerMethod("getCollectionEntries
", 1, argv).ToLocalChecked(); | 657 v8::Local<v8::Value> entriesValue = callDebuggerMethod("getCollectionEntries
", 1, argv).ToLocalChecked(); |
| 658 v8::Local<v8::Value> copied; | 658 if (!entriesValue->IsArray()) |
| 659 if (!copyValueFromDebuggerContext(m_isolate, debuggerContext(), context, ent
riesValue).ToLocal(&copied) || !copied->IsArray()) | |
| 660 return v8::Undefined(m_isolate); | 659 return v8::Undefined(m_isolate); |
| 661 if (!markArrayEntriesAsInternal(context, v8::Local<v8::Array>::Cast(copied),
V8InternalValueType::kEntry)) | 660 v8::Local<v8::Array> entries = entriesValue.As<v8::Array>(); |
| 661 v8::Local<v8::Array> copiedArray = v8::Array::New(m_isolate, entries->Length
()); |
| 662 if (!copiedArray->SetPrototype(context, v8::Null(m_isolate)).FromMaybe(false
)) |
| 662 return v8::Undefined(m_isolate); | 663 return v8::Undefined(m_isolate); |
| 663 return copied; | 664 for (uint32_t i = 0; i < entries->Length(); ++i) { |
| 665 v8::Local<v8::Value> item; |
| 666 if (!entries->Get(debuggerContext(), i).ToLocal(&item)) |
| 667 return v8::Undefined(m_isolate); |
| 668 v8::Local<v8::Value> copied; |
| 669 if (!copyValueFromDebuggerContext(m_isolate, debuggerContext(), context,
item).ToLocal(&copied)) |
| 670 return v8::Undefined(m_isolate); |
| 671 if (!createDataProperty(context, copiedArray, i, copied).FromMaybe(false
)) |
| 672 return v8::Undefined(m_isolate); |
| 673 } |
| 674 if (!markArrayEntriesAsInternal(context, v8::Local<v8::Array>::Cast(copiedAr
ray), V8InternalValueType::kEntry)) |
| 675 return v8::Undefined(m_isolate); |
| 676 return copiedArray; |
| 664 } | 677 } |
| 665 | 678 |
| 666 v8::Local<v8::Value> V8Debugger::generatorObjectLocation(v8::Local<v8::Context>
context, v8::Local<v8::Object> object) | 679 v8::Local<v8::Value> V8Debugger::generatorObjectLocation(v8::Local<v8::Context>
context, v8::Local<v8::Object> object) |
| 667 { | 680 { |
| 668 if (!enabled()) { | 681 if (!enabled()) { |
| 669 NOTREACHED(); | 682 NOTREACHED(); |
| 670 return v8::Null(m_isolate); | 683 return v8::Null(m_isolate); |
| 671 } | 684 } |
| 672 v8::Local<v8::Value> argv[] = { object }; | 685 v8::Local<v8::Value> argv[] = { object }; |
| 673 v8::Local<v8::Value> location = callDebuggerMethod("getGeneratorObjectLocati
on", 1, argv).ToLocalChecked(); | 686 v8::Local<v8::Value> location = callDebuggerMethod("getGeneratorObjectLocati
on", 1, argv).ToLocalChecked(); |
| (...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 830 return nullptr; | 843 return nullptr; |
| 831 | 844 |
| 832 size_t stackSize = fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture :
1; | 845 size_t stackSize = fullStack ? V8StackTraceImpl::maxCallStackSizeToCapture :
1; |
| 833 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) | 846 if (m_inspector->enabledRuntimeAgentForGroup(contextGroupId)) |
| 834 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; | 847 stackSize = V8StackTraceImpl::maxCallStackSizeToCapture; |
| 835 | 848 |
| 836 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); | 849 return V8StackTraceImpl::capture(this, contextGroupId, stackSize); |
| 837 } | 850 } |
| 838 | 851 |
| 839 } // namespace v8_inspector | 852 } // namespace v8_inspector |
| OLD | NEW |