| 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/V8ConsoleMessage.h" | 5 #include "platform/v8_inspector/V8ConsoleMessage.h" |
| 6 | 6 |
| 7 #include "platform/v8_inspector/InspectedContext.h" | 7 #include "platform/v8_inspector/InspectedContext.h" |
| 8 #include "platform/v8_inspector/V8ConsoleAgentImpl.h" | 8 #include "platform/v8_inspector/V8ConsoleAgentImpl.h" |
| 9 #include "platform/v8_inspector/V8DebuggerImpl.h" | 9 #include "platform/v8_inspector/V8DebuggerImpl.h" |
| 10 #include "platform/v8_inspector/V8InspectorSessionImpl.h" | 10 #include "platform/v8_inspector/V8InspectorSessionImpl.h" |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 234 } | 234 } |
| 235 | 235 |
| 236 void V8ConsoleMessage::reportToFrontend(protocol::Console::Frontend* frontend, V
8InspectorSessionImpl* session, bool generatePreview) const | 236 void V8ConsoleMessage::reportToFrontend(protocol::Console::Frontend* frontend, V
8InspectorSessionImpl* session, bool generatePreview) const |
| 237 { | 237 { |
| 238 DCHECK(m_origin == V8MessageOrigin::kExternalConsole || m_origin == V8Messag
eOrigin::kConsole); | 238 DCHECK(m_origin == V8MessageOrigin::kExternalConsole || m_origin == V8Messag
eOrigin::kConsole); |
| 239 std::unique_ptr<protocol::Console::ConsoleMessage> result = | 239 std::unique_ptr<protocol::Console::ConsoleMessage> result = |
| 240 protocol::Console::ConsoleMessage::create() | 240 protocol::Console::ConsoleMessage::create() |
| 241 .setSource(messageSourceValue(m_source)) | 241 .setSource(messageSourceValue(m_source)) |
| 242 .setLevel(messageLevelValue(m_level)) | 242 .setLevel(messageLevelValue(m_level)) |
| 243 .setText(m_message) | 243 .setText(m_message) |
| 244 .setTimestamp(m_timestamp / 1000) // TODO(dgozman): migrate this to mill
iseconds. | 244 .setTimestamp(m_timestamp) |
| 245 .build(); | 245 .build(); |
| 246 result->setLine(static_cast<int>(m_lineNumber)); | 246 result->setLine(static_cast<int>(m_lineNumber)); |
| 247 result->setColumn(static_cast<int>(m_columnNumber)); | 247 result->setColumn(static_cast<int>(m_columnNumber)); |
| 248 if (m_scriptId) | 248 if (m_scriptId) |
| 249 result->setScriptId(String16::number(m_scriptId)); | 249 result->setScriptId(String16::number(m_scriptId)); |
| 250 result->setUrl(m_url); | 250 result->setUrl(m_url); |
| 251 if (m_source == NetworkMessageSource && !m_requestIdentifier.isEmpty()) | 251 if (m_source == NetworkMessageSource && !m_requestIdentifier.isEmpty()) |
| 252 result->setNetworkRequestId(m_requestIdentifier); | 252 result->setNetworkRequestId(m_requestIdentifier); |
| 253 if (m_contextId) | 253 if (m_contextId) |
| 254 result->setExecutionContextId(m_contextId); | 254 result->setExecutionContextId(m_contextId); |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 310 | 310 |
| 311 std::unique_ptr<protocol::Runtime::RemoteObject> exception = wrapExcepti
on(session, generatePreview); | 311 std::unique_ptr<protocol::Runtime::RemoteObject> exception = wrapExcepti
on(session, generatePreview); |
| 312 | 312 |
| 313 if (exception) | 313 if (exception) |
| 314 frontend->exceptionThrown(m_exceptionId, m_timestamp, std::move(deta
ils), std::move(exception), m_contextId); | 314 frontend->exceptionThrown(m_exceptionId, m_timestamp, std::move(deta
ils), std::move(exception), m_contextId); |
| 315 else | 315 else |
| 316 frontend->exceptionThrown(m_exceptionId, m_timestamp, std::move(deta
ils)); | 316 frontend->exceptionThrown(m_exceptionId, m_timestamp, std::move(deta
ils)); |
| 317 return; | 317 return; |
| 318 } | 318 } |
| 319 if (m_origin == V8MessageOrigin::kRevokedException) { | 319 if (m_origin == V8MessageOrigin::kRevokedException) { |
| 320 frontend->exceptionRevoked(m_timestamp, m_message, m_revokedExceptionId)
; | 320 frontend->exceptionRevoked(m_message, m_revokedExceptionId); |
| 321 return; | 321 return; |
| 322 } | 322 } |
| 323 if (m_origin == V8MessageOrigin::kConsole) { | 323 if (m_origin == V8MessageOrigin::kConsole) { |
| 324 std::unique_ptr<protocol::Array<protocol::Runtime::RemoteObject>> argume
nts = wrapArguments(session, generatePreview); | 324 std::unique_ptr<protocol::Array<protocol::Runtime::RemoteObject>> argume
nts = wrapArguments(session, generatePreview); |
| 325 if (!arguments) { | 325 if (!arguments) { |
| 326 arguments = protocol::Array<protocol::Runtime::RemoteObject>::create
(); | 326 arguments = protocol::Array<protocol::Runtime::RemoteObject>::create
(); |
| 327 if (!m_message.isEmpty()) { | 327 if (!m_message.isEmpty()) { |
| 328 std::unique_ptr<protocol::Runtime::RemoteObject> messageArg = pr
otocol::Runtime::RemoteObject::create().setType(protocol::Runtime::RemoteObject:
:TypeEnum::String).build(); | 328 std::unique_ptr<protocol::Runtime::RemoteObject> messageArg = pr
otocol::Runtime::RemoteObject::create().setType(protocol::Runtime::RemoteObject:
:TypeEnum::String).build(); |
| 329 messageArg->setValue(protocol::StringValue::create(m_message)); | 329 messageArg->setValue(protocol::StringValue::create(m_message)); |
| 330 arguments->addItem(std::move(messageArg)); | 330 arguments->addItem(std::move(messageArg)); |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 485 } | 485 } |
| 486 } | 486 } |
| 487 | 487 |
| 488 void V8ConsoleMessageStorage::contextDestroyed(int contextId) | 488 void V8ConsoleMessageStorage::contextDestroyed(int contextId) |
| 489 { | 489 { |
| 490 for (size_t i = 0; i < m_messages.size(); ++i) | 490 for (size_t i = 0; i < m_messages.size(); ++i) |
| 491 m_messages[i]->contextDestroyed(contextId); | 491 m_messages[i]->contextDestroyed(contextId); |
| 492 } | 492 } |
| 493 | 493 |
| 494 } // namespace blink | 494 } // namespace blink |
| OLD | NEW |