| 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/V8InspectorImpl.h" | 9 #include "platform/v8_inspector/V8InspectorImpl.h" |
| 10 #include "platform/v8_inspector/V8InspectorSessionImpl.h" | 10 #include "platform/v8_inspector/V8InspectorSessionImpl.h" |
| (...skipping 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 255 args->addItem(std::move(wrapped)); | 255 args->addItem(std::move(wrapped)); |
| 256 } | 256 } |
| 257 } | 257 } |
| 258 return args; | 258 return args; |
| 259 } | 259 } |
| 260 | 260 |
| 261 void V8ConsoleMessage::reportToFrontend(protocol::Runtime::Frontend* frontend, V
8InspectorSessionImpl* session, bool generatePreview) const | 261 void V8ConsoleMessage::reportToFrontend(protocol::Runtime::Frontend* frontend, V
8InspectorSessionImpl* session, bool generatePreview) const |
| 262 { | 262 { |
| 263 if (m_origin == V8MessageOrigin::kException) { | 263 if (m_origin == V8MessageOrigin::kException) { |
| 264 std::unique_ptr<protocol::Runtime::RemoteObject> exception = wrapExcepti
on(session, generatePreview); | 264 std::unique_ptr<protocol::Runtime::RemoteObject> exception = wrapExcepti
on(session, generatePreview); |
| 265 // TODO(dgozman): unify with InjectedScript::createExceptionDetails. | 265 std::unique_ptr<protocol::Runtime::ExceptionDetails> exceptionDetails =
protocol::Runtime::ExceptionDetails::create() |
| 266 std::unique_ptr<protocol::Runtime::ExceptionDetails> details = protocol:
:Runtime::ExceptionDetails::create() | 266 .setExceptionId(m_exceptionId) |
| 267 .setText(exception ? m_message : m_detailedMessage) | 267 .setText(exception ? m_message : m_detailedMessage) |
| 268 .setLineNumber(m_lineNumber ? m_lineNumber - 1 : 0) | 268 .setLineNumber(m_lineNumber ? m_lineNumber - 1 : 0) |
| 269 .setColumnNumber(m_columnNumber ? m_columnNumber - 1 : 0) | 269 .setColumnNumber(m_columnNumber ? m_columnNumber - 1 : 0) |
| 270 .setScriptId(m_scriptId ? String16::fromInteger(m_scriptId) : String
16()) | |
| 271 .build(); | 270 .build(); |
| 271 if (m_scriptId) |
| 272 exceptionDetails->setScriptId(String16::fromInteger(m_scriptId)); |
| 272 if (!m_url.isEmpty()) | 273 if (!m_url.isEmpty()) |
| 273 details->setUrl(m_url); | 274 exceptionDetails->setUrl(m_url); |
| 274 if (m_stackTrace) | 275 if (m_stackTrace) |
| 275 details->setStackTrace(m_stackTrace->buildInspectorObjectImpl()); | 276 exceptionDetails->setStackTrace(m_stackTrace->buildInspectorObjectIm
pl()); |
| 276 | 277 if (m_contextId) |
| 278 exceptionDetails->setExecutionContextId(m_contextId); |
| 277 if (exception) | 279 if (exception) |
| 278 frontend->exceptionThrown(m_exceptionId, m_timestamp, std::move(deta
ils), std::move(exception), m_contextId); | 280 exceptionDetails->setException(std::move(exception)); |
| 279 else | 281 frontend->exceptionThrown(m_timestamp, std::move(exceptionDetails)); |
| 280 frontend->exceptionThrown(m_exceptionId, m_timestamp, std::move(deta
ils)); | |
| 281 return; | 282 return; |
| 282 } | 283 } |
| 283 if (m_origin == V8MessageOrigin::kRevokedException) { | 284 if (m_origin == V8MessageOrigin::kRevokedException) { |
| 284 frontend->exceptionRevoked(m_message, m_revokedExceptionId); | 285 frontend->exceptionRevoked(m_message, m_revokedExceptionId); |
| 285 return; | 286 return; |
| 286 } | 287 } |
| 287 if (m_origin == V8MessageOrigin::kConsole) { | 288 if (m_origin == V8MessageOrigin::kConsole) { |
| 288 std::unique_ptr<protocol::Array<protocol::Runtime::RemoteObject>> argume
nts = wrapArguments(session, generatePreview); | 289 std::unique_ptr<protocol::Array<protocol::Runtime::RemoteObject>> argume
nts = wrapArguments(session, generatePreview); |
| 289 if (!arguments) { | 290 if (!arguments) { |
| 290 arguments = protocol::Array<protocol::Runtime::RemoteObject>::create
(); | 291 arguments = protocol::Array<protocol::Runtime::RemoteObject>::create
(); |
| (...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 433 session->releaseObjectGroup("console"); | 434 session->releaseObjectGroup("console"); |
| 434 } | 435 } |
| 435 | 436 |
| 436 void V8ConsoleMessageStorage::contextDestroyed(int contextId) | 437 void V8ConsoleMessageStorage::contextDestroyed(int contextId) |
| 437 { | 438 { |
| 438 for (size_t i = 0; i < m_messages.size(); ++i) | 439 for (size_t i = 0; i < m_messages.size(); ++i) |
| 439 m_messages[i]->contextDestroyed(contextId); | 440 m_messages[i]->contextDestroyed(contextId); |
| 440 } | 441 } |
| 441 | 442 |
| 442 } // namespace v8_inspector | 443 } // namespace v8_inspector |
| OLD | NEW |