OLD | NEW |
1 // Copyright 2016 the V8 project authors. All rights reserved. | 1 // Copyright 2016 the V8 project 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 "src/inspector/v8-console.h" | 5 #include "src/inspector/v8-console.h" |
6 | 6 |
7 #include "src/base/macros.h" | 7 #include "src/base/macros.h" |
8 #include "src/inspector/injected-script.h" | 8 #include "src/inspector/injected-script.h" |
9 #include "src/inspector/inspected-context.h" | 9 #include "src/inspector/inspected-context.h" |
10 #include "src/inspector/string-util.h" | 10 #include "src/inspector/string-util.h" |
(...skipping 600 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
611 static void inspectImpl(const v8::FunctionCallbackInfo<v8::Value>& info, | 611 static void inspectImpl(const v8::FunctionCallbackInfo<v8::Value>& info, |
612 bool copyToClipboard) { | 612 bool copyToClipboard) { |
613 if (info.Length() < 1) return; | 613 if (info.Length() < 1) return; |
614 if (!copyToClipboard) info.GetReturnValue().Set(info[0]); | 614 if (!copyToClipboard) info.GetReturnValue().Set(info[0]); |
615 | 615 |
616 ConsoleHelper helper(info); | 616 ConsoleHelper helper(info); |
617 InspectedContext* context = helper.ensureInspectedContext(); | 617 InspectedContext* context = helper.ensureInspectedContext(); |
618 if (!context) return; | 618 if (!context) return; |
619 InjectedScript* injectedScript = context->getInjectedScript(); | 619 InjectedScript* injectedScript = context->getInjectedScript(); |
620 if (!injectedScript) return; | 620 if (!injectedScript) return; |
621 ErrorString errorString; | 621 std::unique_ptr<protocol::Runtime::RemoteObject> wrappedObject; |
622 std::unique_ptr<protocol::Runtime::RemoteObject> wrappedObject = | 622 protocol::Response response = |
623 injectedScript->wrapObject(&errorString, info[0], "", | 623 injectedScript->wrapObject(info[0], "", false /** forceValueType */, |
624 false /** forceValueType */, | 624 false /** generatePreview */, &wrappedObject); |
625 false /** generatePreview */); | 625 if (!response.isSuccess()) return; |
626 if (!wrappedObject || !errorString.isEmpty()) return; | |
627 | 626 |
628 std::unique_ptr<protocol::DictionaryValue> hints = | 627 std::unique_ptr<protocol::DictionaryValue> hints = |
629 protocol::DictionaryValue::create(); | 628 protocol::DictionaryValue::create(); |
630 if (copyToClipboard) hints->setBoolean("copyToClipboard", true); | 629 if (copyToClipboard) hints->setBoolean("copyToClipboard", true); |
631 if (V8InspectorSessionImpl* session = helper.currentSession()) | 630 if (V8InspectorSessionImpl* session = helper.currentSession()) |
632 session->runtimeAgent()->inspect(std::move(wrappedObject), | 631 session->runtimeAgent()->inspect(std::move(wrappedObject), |
633 std::move(hints)); | 632 std::move(hints)); |
634 } | 633 } |
635 | 634 |
636 void V8Console::inspectCallback( | 635 void V8Console::inspectCallback( |
(...skipping 276 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 ->GetOwnPropertyDescriptor( | 912 ->GetOwnPropertyDescriptor( |
914 m_context, v8::Local<v8::String>::Cast(name)) | 913 m_context, v8::Local<v8::String>::Cast(name)) |
915 .ToLocal(&descriptor); | 914 .ToLocal(&descriptor); |
916 DCHECK(success); | 915 DCHECK(success); |
917 USE(success); | 916 USE(success); |
918 } | 917 } |
919 } | 918 } |
920 } | 919 } |
921 | 920 |
922 } // namespace v8_inspector | 921 } // namespace v8_inspector |
OLD | NEW |