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/V8ConsoleMessage.h" | 5 #include "src/inspector/V8ConsoleMessage.h" |
6 | 6 |
7 #include "src/inspector/InspectedContext.h" | 7 #include "src/inspector/InspectedContext.h" |
8 #include "src/inspector/StringUtil.h" | 8 #include "src/inspector/StringUtil.h" |
9 #include "src/inspector/V8ConsoleAgentImpl.h" | 9 #include "src/inspector/V8ConsoleAgentImpl.h" |
10 #include "src/inspector/V8InspectorImpl.h" | 10 #include "src/inspector/V8InspectorImpl.h" |
11 #include "src/inspector/V8InspectorSessionImpl.h" | 11 #include "src/inspector/V8InspectorSessionImpl.h" |
12 #include "src/inspector/V8RuntimeAgentImpl.h" | 12 #include "src/inspector/V8RuntimeAgentImpl.h" |
13 #include "src/inspector/V8StackTraceImpl.h" | 13 #include "src/inspector/V8StackTraceImpl.h" |
14 #include "src/inspector/protocol/Protocol.h" | 14 #include "src/inspector/protocol/Protocol.h" |
15 #include "src/inspector/public/V8InspectorClient.h" | 15 |
| 16 #include "include/v8-inspector.h" |
16 | 17 |
17 namespace v8_inspector { | 18 namespace v8_inspector { |
18 | 19 |
19 namespace { | 20 namespace { |
20 | 21 |
21 String16 consoleAPITypeValue(ConsoleAPIType type) { | 22 String16 consoleAPITypeValue(ConsoleAPIType type) { |
22 switch (type) { | 23 switch (type) { |
23 case ConsoleAPIType::kLog: | 24 case ConsoleAPIType::kLog: |
24 return protocol::Runtime::ConsoleAPICalled::TypeEnum::Log; | 25 return protocol::Runtime::ConsoleAPICalled::TypeEnum::Log; |
25 case ConsoleAPIType::kDebug: | 26 case ConsoleAPIType::kDebug: |
(...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
300 messageArg->setValue(protocol::StringValue::create(m_message)); | 301 messageArg->setValue(protocol::StringValue::create(m_message)); |
301 arguments->addItem(std::move(messageArg)); | 302 arguments->addItem(std::move(messageArg)); |
302 } | 303 } |
303 } | 304 } |
304 frontend->consoleAPICalled( | 305 frontend->consoleAPICalled( |
305 consoleAPITypeValue(m_type), std::move(arguments), m_contextId, | 306 consoleAPITypeValue(m_type), std::move(arguments), m_contextId, |
306 m_timestamp, | 307 m_timestamp, |
307 m_stackTrace ? m_stackTrace->buildInspectorObjectImpl() : nullptr); | 308 m_stackTrace ? m_stackTrace->buildInspectorObjectImpl() : nullptr); |
308 return; | 309 return; |
309 } | 310 } |
310 NOTREACHED(); | 311 UNREACHABLE(); |
311 } | 312 } |
312 | 313 |
313 std::unique_ptr<protocol::Runtime::RemoteObject> | 314 std::unique_ptr<protocol::Runtime::RemoteObject> |
314 V8ConsoleMessage::wrapException(V8InspectorSessionImpl* session, | 315 V8ConsoleMessage::wrapException(V8InspectorSessionImpl* session, |
315 bool generatePreview) const { | 316 bool generatePreview) const { |
316 if (!m_arguments.size() || !m_contextId) return nullptr; | 317 if (!m_arguments.size() || !m_contextId) return nullptr; |
317 DCHECK_EQ(1u, m_arguments.size()); | 318 DCHECK_EQ(1u, m_arguments.size()); |
318 InspectedContext* inspectedContext = | 319 InspectedContext* inspectedContext = |
319 session->inspector()->getContext(session->contextGroupId(), m_contextId); | 320 session->inspector()->getContext(session->contextGroupId(), m_contextId); |
320 if (!inspectedContext) return nullptr; | 321 if (!inspectedContext) return nullptr; |
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
449 m_inspector->sessionForContextGroup(m_contextGroupId)) | 450 m_inspector->sessionForContextGroup(m_contextGroupId)) |
450 session->releaseObjectGroup("console"); | 451 session->releaseObjectGroup("console"); |
451 } | 452 } |
452 | 453 |
453 void V8ConsoleMessageStorage::contextDestroyed(int contextId) { | 454 void V8ConsoleMessageStorage::contextDestroyed(int contextId) { |
454 for (size_t i = 0; i < m_messages.size(); ++i) | 455 for (size_t i = 0; i < m_messages.size(); ++i) |
455 m_messages[i]->contextDestroyed(contextId); | 456 m_messages[i]->contextDestroyed(contextId); |
456 } | 457 } |
457 | 458 |
458 } // namespace v8_inspector | 459 } // namespace v8_inspector |
OLD | NEW |