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

Side by Side Diff: src/inspector/v8-console-message.cc

Issue 2523743003: Roll third_party/inspector_protocol to 73028acaa3646789fd2a3bfd0d79eb2d91b696b3 (Closed)
Patch Set: addressed comments Created 4 years, 1 month 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
« no previous file with comments | « src/inspector/string-util.cc ('k') | src/inspector/v8-debugger.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/v8-console-message.h" 5 #include "src/inspector/v8-console-message.h"
6 6
7 #include "src/inspector/inspected-context.h" 7 #include "src/inspector/inspected-context.h"
8 #include "src/inspector/protocol/Protocol.h" 8 #include "src/inspector/protocol/Protocol.h"
9 #include "src/inspector/string-util.h" 9 #include "src/inspector/string-util.h"
10 #include "src/inspector/v8-console-agent-impl.h" 10 #include "src/inspector/v8-console-agent-impl.h"
(...skipping 343 matching lines...) Expand 10 before | Expand all | Expand 10 after
354 double timestamp, ConsoleAPIType type, 354 double timestamp, ConsoleAPIType type,
355 const std::vector<v8::Local<v8::Value>>& arguments, 355 const std::vector<v8::Local<v8::Value>>& arguments,
356 std::unique_ptr<V8StackTraceImpl> stackTrace, 356 std::unique_ptr<V8StackTraceImpl> stackTrace,
357 InspectedContext* inspectedContext) { 357 InspectedContext* inspectedContext) {
358 v8::Isolate* isolate = inspectedContext->isolate(); 358 v8::Isolate* isolate = inspectedContext->isolate();
359 int contextId = inspectedContext->contextId(); 359 int contextId = inspectedContext->contextId();
360 int contextGroupId = inspectedContext->contextGroupId(); 360 int contextGroupId = inspectedContext->contextGroupId();
361 V8InspectorImpl* inspector = inspectedContext->inspector(); 361 V8InspectorImpl* inspector = inspectedContext->inspector();
362 v8::Local<v8::Context> context = inspectedContext->context(); 362 v8::Local<v8::Context> context = inspectedContext->context();
363 363
364 std::unique_ptr<V8ConsoleMessage> message = wrapUnique( 364 std::unique_ptr<V8ConsoleMessage> message(
365 new V8ConsoleMessage(V8MessageOrigin::kConsole, timestamp, String16())); 365 new V8ConsoleMessage(V8MessageOrigin::kConsole, timestamp, String16()));
366 if (stackTrace && !stackTrace->isEmpty()) { 366 if (stackTrace && !stackTrace->isEmpty()) {
367 message->m_url = toString16(stackTrace->topSourceURL()); 367 message->m_url = toString16(stackTrace->topSourceURL());
368 message->m_lineNumber = stackTrace->topLineNumber(); 368 message->m_lineNumber = stackTrace->topLineNumber();
369 message->m_columnNumber = stackTrace->topColumnNumber(); 369 message->m_columnNumber = stackTrace->topColumnNumber();
370 } 370 }
371 message->m_stackTrace = std::move(stackTrace); 371 message->m_stackTrace = std::move(stackTrace);
372 message->m_type = type; 372 message->m_type = type;
373 message->m_contextId = contextId; 373 message->m_contextId = contextId;
374 for (size_t i = 0; i < arguments.size(); ++i) 374 for (size_t i = 0; i < arguments.size(); ++i)
375 message->m_arguments.push_back( 375 message->m_arguments.push_back(std::unique_ptr<v8::Global<v8::Value>>(
376 wrapUnique(new v8::Global<v8::Value>(isolate, arguments.at(i)))); 376 new v8::Global<v8::Value>(isolate, arguments.at(i))));
377 if (arguments.size()) 377 if (arguments.size())
378 message->m_message = V8ValueStringBuilder::toString(arguments[0], context); 378 message->m_message = V8ValueStringBuilder::toString(arguments[0], context);
379 379
380 V8ConsoleAPIType clientType = V8ConsoleAPIType::kLog; 380 V8ConsoleAPIType clientType = V8ConsoleAPIType::kLog;
381 if (type == ConsoleAPIType::kDebug || type == ConsoleAPIType::kCount || 381 if (type == ConsoleAPIType::kDebug || type == ConsoleAPIType::kCount ||
382 type == ConsoleAPIType::kTimeEnd) 382 type == ConsoleAPIType::kTimeEnd)
383 clientType = V8ConsoleAPIType::kDebug; 383 clientType = V8ConsoleAPIType::kDebug;
384 else if (type == ConsoleAPIType::kError || type == ConsoleAPIType::kAssert) 384 else if (type == ConsoleAPIType::kError || type == ConsoleAPIType::kAssert)
385 clientType = V8ConsoleAPIType::kError; 385 clientType = V8ConsoleAPIType::kError;
386 else if (type == ConsoleAPIType::kWarning) 386 else if (type == ConsoleAPIType::kWarning)
(...skipping 10 matching lines...) Expand all
397 return message; 397 return message;
398 } 398 }
399 399
400 // static 400 // static
401 std::unique_ptr<V8ConsoleMessage> V8ConsoleMessage::createForException( 401 std::unique_ptr<V8ConsoleMessage> V8ConsoleMessage::createForException(
402 double timestamp, const String16& detailedMessage, const String16& url, 402 double timestamp, const String16& detailedMessage, const String16& url,
403 unsigned lineNumber, unsigned columnNumber, 403 unsigned lineNumber, unsigned columnNumber,
404 std::unique_ptr<V8StackTraceImpl> stackTrace, int scriptId, 404 std::unique_ptr<V8StackTraceImpl> stackTrace, int scriptId,
405 v8::Isolate* isolate, const String16& message, int contextId, 405 v8::Isolate* isolate, const String16& message, int contextId,
406 v8::Local<v8::Value> exception, unsigned exceptionId) { 406 v8::Local<v8::Value> exception, unsigned exceptionId) {
407 std::unique_ptr<V8ConsoleMessage> consoleMessage = wrapUnique( 407 std::unique_ptr<V8ConsoleMessage> consoleMessage(
408 new V8ConsoleMessage(V8MessageOrigin::kException, timestamp, message)); 408 new V8ConsoleMessage(V8MessageOrigin::kException, timestamp, message));
409 consoleMessage->setLocation(url, lineNumber, columnNumber, 409 consoleMessage->setLocation(url, lineNumber, columnNumber,
410 std::move(stackTrace), scriptId); 410 std::move(stackTrace), scriptId);
411 consoleMessage->m_exceptionId = exceptionId; 411 consoleMessage->m_exceptionId = exceptionId;
412 consoleMessage->m_detailedMessage = detailedMessage; 412 consoleMessage->m_detailedMessage = detailedMessage;
413 if (contextId && !exception.IsEmpty()) { 413 if (contextId && !exception.IsEmpty()) {
414 consoleMessage->m_contextId = contextId; 414 consoleMessage->m_contextId = contextId;
415 consoleMessage->m_arguments.push_back( 415 consoleMessage->m_arguments.push_back(
416 wrapUnique(new v8::Global<v8::Value>(isolate, exception))); 416 std::unique_ptr<v8::Global<v8::Value>>(
417 new v8::Global<v8::Value>(isolate, exception)));
417 } 418 }
418 return consoleMessage; 419 return consoleMessage;
419 } 420 }
420 421
421 // static 422 // static
422 std::unique_ptr<V8ConsoleMessage> V8ConsoleMessage::createForRevokedException( 423 std::unique_ptr<V8ConsoleMessage> V8ConsoleMessage::createForRevokedException(
423 double timestamp, const String16& messageText, 424 double timestamp, const String16& messageText,
424 unsigned revokedExceptionId) { 425 unsigned revokedExceptionId) {
425 std::unique_ptr<V8ConsoleMessage> message = wrapUnique(new V8ConsoleMessage( 426 std::unique_ptr<V8ConsoleMessage> message(new V8ConsoleMessage(
426 V8MessageOrigin::kRevokedException, timestamp, messageText)); 427 V8MessageOrigin::kRevokedException, timestamp, messageText));
427 message->m_revokedExceptionId = revokedExceptionId; 428 message->m_revokedExceptionId = revokedExceptionId;
428 return message; 429 return message;
429 } 430 }
430 431
431 void V8ConsoleMessage::contextDestroyed(int contextId) { 432 void V8ConsoleMessage::contextDestroyed(int contextId) {
432 if (contextId != m_contextId) return; 433 if (contextId != m_contextId) return;
433 m_contextId = 0; 434 m_contextId = 0;
434 if (m_message.isEmpty()) m_message = "<message collected>"; 435 if (m_message.isEmpty()) m_message = "<message collected>";
435 Arguments empty; 436 Arguments empty;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
476 m_inspector->sessionForContextGroup(m_contextGroupId)) 477 m_inspector->sessionForContextGroup(m_contextGroupId))
477 session->releaseObjectGroup("console"); 478 session->releaseObjectGroup("console");
478 } 479 }
479 480
480 void V8ConsoleMessageStorage::contextDestroyed(int contextId) { 481 void V8ConsoleMessageStorage::contextDestroyed(int contextId) {
481 for (size_t i = 0; i < m_messages.size(); ++i) 482 for (size_t i = 0; i < m_messages.size(); ++i)
482 m_messages[i]->contextDestroyed(contextId); 483 m_messages[i]->contextDestroyed(contextId);
483 } 484 }
484 485
485 } // namespace v8_inspector 486 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « src/inspector/string-util.cc ('k') | src/inspector/v8-debugger.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698