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

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

Issue 2260233002: [DevTools] Migrate v8_inspector/public from String16 to String{View,Buffer}. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: styling Created 4 years, 3 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/V8InspectorImpl.h" 9 #include "platform/v8_inspector/V8InspectorImpl.h"
10 #include "platform/v8_inspector/V8InspectorSessionImpl.h" 10 #include "platform/v8_inspector/V8InspectorSessionImpl.h"
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 ConsoleAPIType V8ConsoleMessage::type() const 324 ConsoleAPIType V8ConsoleMessage::type() const
325 { 325 {
326 return m_type; 326 return m_type;
327 } 327 }
328 328
329 // static 329 // static
330 std::unique_ptr<V8ConsoleMessage> V8ConsoleMessage::createForConsoleAPI(double t imestamp, ConsoleAPIType type, const std::vector<v8::Local<v8::Value>>& argument s, std::unique_ptr<V8StackTraceImpl> stackTrace, InspectedContext* context) 330 std::unique_ptr<V8ConsoleMessage> V8ConsoleMessage::createForConsoleAPI(double t imestamp, ConsoleAPIType type, const std::vector<v8::Local<v8::Value>>& argument s, std::unique_ptr<V8StackTraceImpl> stackTrace, InspectedContext* context)
331 { 331 {
332 std::unique_ptr<V8ConsoleMessage> message = wrapUnique(new V8ConsoleMessage( V8MessageOrigin::kConsole, timestamp, String16())); 332 std::unique_ptr<V8ConsoleMessage> message = wrapUnique(new V8ConsoleMessage( V8MessageOrigin::kConsole, timestamp, String16()));
333 if (stackTrace && !stackTrace->isEmpty()) { 333 if (stackTrace && !stackTrace->isEmpty()) {
334 message->m_url = stackTrace->topSourceURL(); 334 message->m_url = toString16(stackTrace->topSourceURL());
335 message->m_lineNumber = stackTrace->topLineNumber(); 335 message->m_lineNumber = stackTrace->topLineNumber();
336 message->m_columnNumber = stackTrace->topColumnNumber(); 336 message->m_columnNumber = stackTrace->topColumnNumber();
337 } 337 }
338 message->m_stackTrace = std::move(stackTrace); 338 message->m_stackTrace = std::move(stackTrace);
339 message->m_type = type; 339 message->m_type = type;
340 message->m_contextId = context->contextId(); 340 message->m_contextId = context->contextId();
341 for (size_t i = 0; i < arguments.size(); ++i) 341 for (size_t i = 0; i < arguments.size(); ++i)
342 message->m_arguments.push_back(wrapUnique(new v8::Global<v8::Value>(cont ext->isolate(), arguments.at(i)))); 342 message->m_arguments.push_back(wrapUnique(new v8::Global<v8::Value>(cont ext->isolate(), arguments.at(i))));
343 if (arguments.size()) 343 if (arguments.size())
344 message->m_message = V8ValueStringBuilder::toString(arguments[0], contex t->isolate()); 344 message->m_message = V8ValueStringBuilder::toString(arguments[0], contex t->isolate());
345 345
346 V8ConsoleAPIType clientType = V8ConsoleAPIType::kLog; 346 V8ConsoleAPIType clientType = V8ConsoleAPIType::kLog;
347 if (type == ConsoleAPIType::kDebug || type == ConsoleAPIType::kCount || type == ConsoleAPIType::kTimeEnd) 347 if (type == ConsoleAPIType::kDebug || type == ConsoleAPIType::kCount || type == ConsoleAPIType::kTimeEnd)
348 clientType = V8ConsoleAPIType::kDebug; 348 clientType = V8ConsoleAPIType::kDebug;
349 else if (type == ConsoleAPIType::kError || type == ConsoleAPIType::kAssert) 349 else if (type == ConsoleAPIType::kError || type == ConsoleAPIType::kAssert)
350 clientType = V8ConsoleAPIType::kError; 350 clientType = V8ConsoleAPIType::kError;
351 else if (type == ConsoleAPIType::kWarning) 351 else if (type == ConsoleAPIType::kWarning)
352 clientType = V8ConsoleAPIType::kWarning; 352 clientType = V8ConsoleAPIType::kWarning;
353 else if (type == ConsoleAPIType::kInfo) 353 else if (type == ConsoleAPIType::kInfo)
354 clientType = V8ConsoleAPIType::kInfo; 354 clientType = V8ConsoleAPIType::kInfo;
355 else if (type == ConsoleAPIType::kClear) 355 else if (type == ConsoleAPIType::kClear)
356 clientType = V8ConsoleAPIType::kClear; 356 clientType = V8ConsoleAPIType::kClear;
357 context->inspector()->client()->consoleAPIMessage(context->contextGroupId(), clientType, message->m_message, message->m_url, message->m_lineNumber, message- >m_columnNumber, message->m_stackTrace.get()); 357 context->inspector()->client()->consoleAPIMessage(context->contextGroupId(), clientType, toStringView(message->m_message), toStringView(message->m_url), mes sage->m_lineNumber, message->m_columnNumber, message->m_stackTrace.get());
358 358
359 return message; 359 return message;
360 } 360 }
361 361
362 // static 362 // static
363 std::unique_ptr<V8ConsoleMessage> V8ConsoleMessage::createForException(double ti mestamp, const String16& detailedMessage, const String16& url, unsigned lineNumb er, unsigned columnNumber, std::unique_ptr<V8StackTraceImpl> stackTrace, int scr iptId, v8::Isolate* isolate, const String16& message, int contextId, v8::Local<v 8::Value> exception, unsigned exceptionId) 363 std::unique_ptr<V8ConsoleMessage> V8ConsoleMessage::createForException(double ti mestamp, const String16& detailedMessage, const String16& url, unsigned lineNumb er, unsigned columnNumber, std::unique_ptr<V8StackTraceImpl> stackTrace, int scr iptId, v8::Isolate* isolate, const String16& message, int contextId, v8::Local<v 8::Value> exception, unsigned exceptionId)
364 { 364 {
365 std::unique_ptr<V8ConsoleMessage> consoleMessage = wrapUnique(new V8ConsoleM essage(V8MessageOrigin::kException, timestamp, message)); 365 std::unique_ptr<V8ConsoleMessage> consoleMessage = wrapUnique(new V8ConsoleM essage(V8MessageOrigin::kException, timestamp, message));
366 consoleMessage->setLocation(url, lineNumber, columnNumber, std::move(stackTr ace), scriptId); 366 consoleMessage->setLocation(url, lineNumber, columnNumber, std::move(stackTr ace), scriptId);
367 consoleMessage->m_exceptionId = exceptionId; 367 consoleMessage->m_exceptionId = exceptionId;
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
434 session->releaseObjectGroup("console"); 434 session->releaseObjectGroup("console");
435 } 435 }
436 436
437 void V8ConsoleMessageStorage::contextDestroyed(int contextId) 437 void V8ConsoleMessageStorage::contextDestroyed(int contextId)
438 { 438 {
439 for (size_t i = 0; i < m_messages.size(); ++i) 439 for (size_t i = 0; i < m_messages.size(); ++i)
440 m_messages[i]->contextDestroyed(contextId); 440 m_messages[i]->contextDestroyed(contextId);
441 } 441 }
442 442
443 } // namespace v8_inspector 443 } // namespace v8_inspector
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698