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

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

Issue 2659913002: V8 Inspector: complete migration to the standard message level enum. (Closed)
Patch Set: Created 3 years, 10 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
« no previous file with comments | « include/v8-inspector.h ('k') | no next file » | 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 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
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(std::unique_ptr<v8::Global<v8::Value>>( 375 message->m_arguments.push_back(std::unique_ptr<v8::Global<v8::Value>>(
376 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;
381 v8::Isolate::MessageErrorLevel clientLevel = v8::Isolate::kMessageInfo; 380 v8::Isolate::MessageErrorLevel clientLevel = v8::Isolate::kMessageInfo;
382 if (type == ConsoleAPIType::kDebug || type == ConsoleAPIType::kCount || 381 if (type == ConsoleAPIType::kDebug || type == ConsoleAPIType::kCount ||
383 type == ConsoleAPIType::kTimeEnd) { 382 type == ConsoleAPIType::kTimeEnd) {
384 clientType = V8ConsoleAPIType::kDebug;
385 clientLevel = v8::Isolate::kMessageDebug; 383 clientLevel = v8::Isolate::kMessageDebug;
386 } else if (type == ConsoleAPIType::kError || 384 } else if (type == ConsoleAPIType::kError ||
387 type == ConsoleAPIType::kAssert) { 385 type == ConsoleAPIType::kAssert) {
388 clientType = V8ConsoleAPIType::kError;
389 clientLevel = v8::Isolate::kMessageError; 386 clientLevel = v8::Isolate::kMessageError;
390 } else if (type == ConsoleAPIType::kWarning) { 387 } else if (type == ConsoleAPIType::kWarning) {
391 clientType = V8ConsoleAPIType::kWarning;
392 clientLevel = v8::Isolate::kMessageWarning; 388 clientLevel = v8::Isolate::kMessageWarning;
393 } else if (type == ConsoleAPIType::kInfo || type == ConsoleAPIType::kLog) { 389 } else if (type == ConsoleAPIType::kInfo || type == ConsoleAPIType::kLog) {
394 clientType = V8ConsoleAPIType::kInfo;
395 clientLevel = v8::Isolate::kMessageInfo; 390 clientLevel = v8::Isolate::kMessageInfo;
396 } else if (type == ConsoleAPIType::kClear) {
397 clientType = V8ConsoleAPIType::kClear;
398 } 391 }
399 392
400 inspector->client()->consoleAPIMessage(
401 contextGroupId, clientType, toStringView(message->m_message),
402 toStringView(message->m_url), message->m_lineNumber,
403 message->m_columnNumber, message->m_stackTrace.get());
404
405 if (type != ConsoleAPIType::kClear) { 393 if (type != ConsoleAPIType::kClear) {
406 inspector->client()->consoleAPIMessage( 394 inspector->client()->consoleAPIMessage(
407 contextGroupId, clientLevel, toStringView(message->m_message), 395 contextGroupId, clientLevel, toStringView(message->m_message),
408 toStringView(message->m_url), message->m_lineNumber, 396 toStringView(message->m_url), message->m_lineNumber,
409 message->m_columnNumber, message->m_stackTrace.get()); 397 message->m_columnNumber, message->m_stackTrace.get());
410 } 398 }
411 399
412 return message; 400 return message;
413 } 401 }
414 402
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
492 m_inspector->sessionForContextGroup(m_contextGroupId)) 480 m_inspector->sessionForContextGroup(m_contextGroupId))
493 session->releaseObjectGroup("console"); 481 session->releaseObjectGroup("console");
494 } 482 }
495 483
496 void V8ConsoleMessageStorage::contextDestroyed(int contextId) { 484 void V8ConsoleMessageStorage::contextDestroyed(int contextId) {
497 for (size_t i = 0; i < m_messages.size(); ++i) 485 for (size_t i = 0; i < m_messages.size(); ++i)
498 m_messages[i]->contextDestroyed(contextId); 486 m_messages[i]->contextDestroyed(contextId);
499 } 487 }
500 488
501 } // namespace v8_inspector 489 } // namespace v8_inspector
OLDNEW
« no previous file with comments | « include/v8-inspector.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698