Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(210)

Side by Side Diff: third_party/WebKit/Source/platform/v8_inspector/V8ConsoleMessage.cpp

Issue 2154623002: [DevTools] Make most fields of ExceptionDetails non-optional. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 args->addItem(std::move(wrapped)); 290 args->addItem(std::move(wrapped));
291 } 291 }
292 } 292 }
293 return args; 293 return args;
294 } 294 }
295 295
296 void V8ConsoleMessage::reportToFrontend(protocol::Runtime::Frontend* frontend, V 8InspectorSessionImpl* session, bool generatePreview) const 296 void V8ConsoleMessage::reportToFrontend(protocol::Runtime::Frontend* frontend, V 8InspectorSessionImpl* session, bool generatePreview) const
297 { 297 {
298 if (m_origin == V8MessageOrigin::kException) { 298 if (m_origin == V8MessageOrigin::kException) {
299 // TODO(dgozman): unify with InjectedScript::createExceptionDetails. 299 // TODO(dgozman): unify with InjectedScript::createExceptionDetails.
300 std::unique_ptr<protocol::Runtime::ExceptionDetails> details = protocol: :Runtime::ExceptionDetails::create().setText(m_message).build(); 300 std::unique_ptr<protocol::Runtime::ExceptionDetails> details = protocol: :Runtime::ExceptionDetails::create()
301 details->setUrl(m_url); 301 .setText(m_message)
302 if (m_lineNumber) 302 .setLineNumber(m_lineNumber ? m_lineNumber - 1 : 0)
303 details->setLineNumber(static_cast<int>(m_lineNumber) - 1); 303 .setColumnNumber(m_columnNumber ? m_columnNumber - 1 : 0)
304 if (m_columnNumber) 304 .setScriptId(m_scriptId ? String16::fromInteger(m_scriptId) : String 16())
305 details->setColumnNumber(static_cast<int>(m_columnNumber) - 1); 305 .build();
306 if (m_scriptId) 306 if (!m_url.isEmpty())
307 details->setScriptId(String16::fromInteger(m_scriptId)); 307 details->setUrl(m_url);
308 if (m_stackTrace) 308 if (m_stackTrace)
309 details->setStack(m_stackTrace->buildInspectorObject()); 309 details->setStackTrace(m_stackTrace->buildInspectorObject());
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) {
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 } 475 }
476 } 476 }
477 477
478 void V8ConsoleMessageStorage::contextDestroyed(int contextId) 478 void V8ConsoleMessageStorage::contextDestroyed(int contextId)
479 { 479 {
480 for (size_t i = 0; i < m_messages.size(); ++i) 480 for (size_t i = 0; i < m_messages.size(); ++i)
481 m_messages[i]->contextDestroyed(contextId); 481 m_messages[i]->contextDestroyed(contextId);
482 } 482 }
483 483
484 } // namespace blink 484 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698