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/V8DebuggerAgentImpl.h" | 10 #include "platform/v8_inspector/V8DebuggerAgentImpl.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
73 return nullptr; | 73 return nullptr; |
74 m_debuggerClient = inspectedContext->debugger()->client(); | 74 m_debuggerClient = inspectedContext->debugger()->client(); |
75 return m_debuggerClient; | 75 return m_debuggerClient; |
76 } | 76 } |
77 | 77 |
78 void addMessage(MessageType type, MessageLevel level, bool allowEmptyArgumen
ts, int skipArgumentCount) | 78 void addMessage(MessageType type, MessageLevel level, bool allowEmptyArgumen
ts, int skipArgumentCount) |
79 { | 79 { |
80 if (!allowEmptyArguments && !m_info.Length()) | 80 if (!allowEmptyArguments && !m_info.Length()) |
81 return; | 81 return; |
82 if (V8DebuggerClient* debuggerClient = ensureDebuggerClient()) | 82 if (V8DebuggerClient* debuggerClient = ensureDebuggerClient()) |
83 debuggerClient->reportMessageToConsole(m_context, type, level, Strin
g16(), &m_info, skipArgumentCount, -1); | 83 debuggerClient->reportMessageToConsole(m_context, type, level, Strin
g16(), &m_info, skipArgumentCount); |
84 } | 84 } |
85 | 85 |
86 void addMessage(MessageType type, MessageLevel level, const String16& messag
e) | 86 void addMessage(MessageType type, MessageLevel level, const String16& messag
e) |
87 { | 87 { |
88 if (V8DebuggerClient* debuggerClient = ensureDebuggerClient()) | 88 if (V8DebuggerClient* debuggerClient = ensureDebuggerClient()) |
89 debuggerClient->reportMessageToConsole(m_context, type, level, messa
ge, nullptr, 0 /* skipArgumentsCount */, 1 /* maxStackSize */); | 89 debuggerClient->reportMessageToConsole(m_context, type, level, messa
ge, nullptr, 0 /* skipArgumentsCount */); |
90 } | 90 } |
91 | 91 |
92 void addDeprecationMessage(const char* id, const String16& message) | 92 void addDeprecationMessage(const char* id, const String16& message) |
93 { | 93 { |
94 if (checkAndSetPrivateFlagOnConsole(id, false)) | 94 if (checkAndSetPrivateFlagOnConsole(id, false)) |
95 return; | 95 return; |
96 if (V8DebuggerClient* debuggerClient = ensureDebuggerClient()) | 96 if (V8DebuggerClient* debuggerClient = ensureDebuggerClient()) |
97 debuggerClient->reportMessageToConsole(m_context, LogMessageType, Wa
rningMessageLevel, message, nullptr, 0 /* skipArgumentsCount */, 0 /* maxStackSi
ze */); | 97 debuggerClient->reportMessageToConsole(m_context, LogMessageType, Wa
rningMessageLevel, message, nullptr, 0 /* skipArgumentsCount */); |
98 } | 98 } |
99 | 99 |
100 bool firstArgToBoolean(bool defaultValue) | 100 bool firstArgToBoolean(bool defaultValue) |
101 { | 101 { |
102 if (m_info.Length() < 1) | 102 if (m_info.Length() < 1) |
103 return defaultValue; | 103 return defaultValue; |
104 if (m_info[0]->IsBoolean()) | 104 if (m_info[0]->IsBoolean()) |
105 return m_info[0].As<v8::Boolean>()->Value(); | 105 return m_info[0].As<v8::Boolean>()->Value(); |
106 return m_info[0]->BooleanValue(m_context).FromMaybe(defaultValue); | 106 return m_info[0]->BooleanValue(m_context).FromMaybe(defaultValue); |
107 } | 107 } |
(...skipping 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
720 DEFINE_STATIC_LOCAL(protocol::HashSet<String16>, getters, ()); | 720 DEFINE_STATIC_LOCAL(protocol::HashSet<String16>, getters, ()); |
721 if (getters.size() == 0) { | 721 if (getters.size() == 0) { |
722 const char* members[] = { "$0", "$1", "$2", "$3", "$4", "$_" }; | 722 const char* members[] = { "$0", "$1", "$2", "$3", "$4", "$_" }; |
723 for (size_t i = 0; i < WTF_ARRAY_LENGTH(members); ++i) | 723 for (size_t i = 0; i < WTF_ARRAY_LENGTH(members); ++i) |
724 getters.add(members[i]); | 724 getters.add(members[i]); |
725 } | 725 } |
726 return getters.find(name) != getters.end(); | 726 return getters.find(name) != getters.end(); |
727 } | 727 } |
728 | 728 |
729 } // namespace blink | 729 } // namespace blink |
OLD | NEW |