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/V8Console.h" | 5 #include "platform/v8_inspector/V8Console.h" |
6 | 6 |
7 #include "platform/inspector_protocol/String16.h" | 7 #include "platform/inspector_protocol/String16.h" |
8 #include "platform/v8_inspector/InjectedScript.h" | 8 #include "platform/v8_inspector/InjectedScript.h" |
9 #include "platform/v8_inspector/InspectedContext.h" | 9 #include "platform/v8_inspector/InspectedContext.h" |
10 #include "platform/v8_inspector/V8Compat.h" | 10 #include "platform/v8_inspector/V8Compat.h" |
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 void setDoubleOnMap(v8::Local<v8::Map> map, const String16& key, double valu
e) | 184 void setDoubleOnMap(v8::Local<v8::Map> map, const String16& key, double valu
e) |
185 { | 185 { |
186 v8::Local<v8::String> v8Key = toV8String(m_isolate, key); | 186 v8::Local<v8::String> v8Key = toV8String(m_isolate, key); |
187 if (!map->Set(m_context, v8Key, v8::Number::New(m_isolate, value)).ToLoc
al(&map)) | 187 if (!map->Set(m_context, v8Key, v8::Number::New(m_isolate, value)).ToLoc
al(&map)) |
188 return; | 188 return; |
189 } | 189 } |
190 | 190 |
191 V8ProfilerAgentImpl* profilerAgent() | 191 V8ProfilerAgentImpl* profilerAgent() |
192 { | 192 { |
193 if (V8InspectorSessionImpl* session = currentSession()) { | 193 if (V8InspectorSessionImpl* session = currentSession()) { |
194 if (session && session->profilerAgentImpl()->enabled()) | 194 if (session && session->profilerAgent()->enabled()) |
195 return session->profilerAgentImpl(); | 195 return session->profilerAgent(); |
196 } | 196 } |
197 return nullptr; | 197 return nullptr; |
198 } | 198 } |
199 | 199 |
200 V8DebuggerAgentImpl* debuggerAgent() | 200 V8DebuggerAgentImpl* debuggerAgent() |
201 { | 201 { |
202 if (V8InspectorSessionImpl* session = currentSession()) { | 202 if (V8InspectorSessionImpl* session = currentSession()) { |
203 if (session && session->debuggerAgentImpl()->enabled()) | 203 if (session && session->debuggerAgent()->enabled()) |
204 return session->debuggerAgentImpl(); | 204 return session->debuggerAgent(); |
205 } | 205 } |
206 return nullptr; | 206 return nullptr; |
207 } | 207 } |
208 | 208 |
209 V8InspectorSessionImpl* currentSession() | 209 V8InspectorSessionImpl* currentSession() |
210 { | 210 { |
211 InspectedContext* inspectedContext = ensureInspectedContext(); | 211 InspectedContext* inspectedContext = ensureInspectedContext(); |
212 if (!inspectedContext) | 212 if (!inspectedContext) |
213 return nullptr; | 213 return nullptr; |
214 return inspectedContext->debugger()->sessionForContextGroup(inspectedCon
text->contextGroupId()); | 214 return inspectedContext->debugger()->sessionForContextGroup(inspectedCon
text->contextGroupId()); |
(...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
590 return; | 590 return; |
591 ErrorString errorString; | 591 ErrorString errorString; |
592 OwnPtr<protocol::Runtime::RemoteObject> wrappedObject = injectedScript->wrap
Object(&errorString, info[0], "", false /** forceValueType */, false /** generat
ePreview */); | 592 OwnPtr<protocol::Runtime::RemoteObject> wrappedObject = injectedScript->wrap
Object(&errorString, info[0], "", false /** forceValueType */, false /** generat
ePreview */); |
593 if (!wrappedObject || !errorString.isEmpty()) | 593 if (!wrappedObject || !errorString.isEmpty()) |
594 return; | 594 return; |
595 | 595 |
596 OwnPtr<protocol::DictionaryValue> hints = protocol::DictionaryValue::create(
); | 596 OwnPtr<protocol::DictionaryValue> hints = protocol::DictionaryValue::create(
); |
597 if (copyToClipboard) | 597 if (copyToClipboard) |
598 hints->setBoolean("copyToClipboard", true); | 598 hints->setBoolean("copyToClipboard", true); |
599 if (V8InspectorSessionImpl* session = helper.currentSession()) | 599 if (V8InspectorSessionImpl* session = helper.currentSession()) |
600 session->runtimeAgentImpl()->inspect(std::move(wrappedObject), std::move
(hints)); | 600 session->runtimeAgent()->inspect(std::move(wrappedObject), std::move(hin
ts)); |
601 } | 601 } |
602 | 602 |
603 void V8Console::inspectCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | 603 void V8Console::inspectCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
604 { | 604 { |
605 inspectImpl(info, false); | 605 inspectImpl(info, false); |
606 } | 606 } |
607 | 607 |
608 void V8Console::copyCallback(const v8::FunctionCallbackInfo<v8::Value>& info) | 608 void V8Console::copyCallback(const v8::FunctionCallbackInfo<v8::Value>& info) |
609 { | 609 { |
610 inspectImpl(info, true); | 610 inspectImpl(info, true); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
725 DEFINE_STATIC_LOCAL(protocol::HashSet<String16>, getters, ()); | 725 DEFINE_STATIC_LOCAL(protocol::HashSet<String16>, getters, ()); |
726 if (getters.size() == 0) { | 726 if (getters.size() == 0) { |
727 const char* members[] = { "$0", "$1", "$2", "$3", "$4", "$_" }; | 727 const char* members[] = { "$0", "$1", "$2", "$3", "$4", "$_" }; |
728 for (size_t i = 0; i < WTF_ARRAY_LENGTH(members); ++i) | 728 for (size_t i = 0; i < WTF_ARRAY_LENGTH(members); ++i) |
729 getters.add(members[i]); | 729 getters.add(members[i]); |
730 } | 730 } |
731 return getters.find(name) != getters.end(); | 731 return getters.find(name) != getters.end(); |
732 } | 732 } |
733 | 733 |
734 } // namespace blink | 734 } // namespace blink |
OLD | NEW |