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

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

Issue 2226863003: [DevTools] Reduce API surface of String16. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 4 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 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 return true; 77 return true;
78 if (value->IsString()) 78 if (value->IsString())
79 return append(v8::Local<v8::String>::Cast(value)); 79 return append(v8::Local<v8::String>::Cast(value));
80 if (value->IsStringObject()) 80 if (value->IsStringObject())
81 return append(v8::Local<v8::StringObject>::Cast(value)->ValueOf()); 81 return append(v8::Local<v8::StringObject>::Cast(value)->ValueOf());
82 if (value->IsSymbol()) 82 if (value->IsSymbol())
83 return append(v8::Local<v8::Symbol>::Cast(value)); 83 return append(v8::Local<v8::Symbol>::Cast(value));
84 if (value->IsSymbolObject()) 84 if (value->IsSymbolObject())
85 return append(v8::Local<v8::SymbolObject>::Cast(value)->ValueOf()); 85 return append(v8::Local<v8::SymbolObject>::Cast(value)->ValueOf());
86 if (value->IsNumberObject()) { 86 if (value->IsNumberObject()) {
87 m_builder.appendNumber(v8::Local<v8::NumberObject>::Cast(value)->Val ueOf()); 87 m_builder.append(protocol::string16FromDoublePrecision6(v8::Local<v8 ::NumberObject>::Cast(value)->ValueOf()));
88 return true; 88 return true;
89 } 89 }
90 if (value->IsBooleanObject()) { 90 if (value->IsBooleanObject()) {
91 m_builder.append(v8::Local<v8::BooleanObject>::Cast(value)->ValueOf( ) ? "true" : "false"); 91 m_builder.append(v8::Local<v8::BooleanObject>::Cast(value)->ValueOf( ) ? "true" : "false");
92 return true; 92 return true;
93 } 93 }
94 if (value->IsArray()) 94 if (value->IsArray())
95 return append(v8::Local<v8::Array>::Cast(value)); 95 return append(v8::Local<v8::Array>::Cast(value));
96 if (value->IsProxy()) { 96 if (value->IsProxy()) {
97 m_builder.append("[object Proxy]"); 97 m_builder.append("[object Proxy]");
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 251
252 void V8ConsoleMessage::reportToFrontend(protocol::Runtime::Frontend* frontend, V 8InspectorSessionImpl* session, bool generatePreview) const 252 void V8ConsoleMessage::reportToFrontend(protocol::Runtime::Frontend* frontend, V 8InspectorSessionImpl* session, bool generatePreview) const
253 { 253 {
254 if (m_origin == V8MessageOrigin::kException) { 254 if (m_origin == V8MessageOrigin::kException) {
255 std::unique_ptr<protocol::Runtime::RemoteObject> exception = wrapExcepti on(session, generatePreview); 255 std::unique_ptr<protocol::Runtime::RemoteObject> exception = wrapExcepti on(session, generatePreview);
256 // TODO(dgozman): unify with InjectedScript::createExceptionDetails. 256 // TODO(dgozman): unify with InjectedScript::createExceptionDetails.
257 std::unique_ptr<protocol::Runtime::ExceptionDetails> details = protocol: :Runtime::ExceptionDetails::create() 257 std::unique_ptr<protocol::Runtime::ExceptionDetails> details = protocol: :Runtime::ExceptionDetails::create()
258 .setText(exception ? m_message : m_detailedMessage) 258 .setText(exception ? m_message : m_detailedMessage)
259 .setLineNumber(m_lineNumber ? m_lineNumber - 1 : 0) 259 .setLineNumber(m_lineNumber ? m_lineNumber - 1 : 0)
260 .setColumnNumber(m_columnNumber ? m_columnNumber - 1 : 0) 260 .setColumnNumber(m_columnNumber ? m_columnNumber - 1 : 0)
261 .setScriptId(m_scriptId ? String16::fromInteger(m_scriptId) : String 16()) 261 .setScriptId(m_scriptId ? protocol::string16FromInteger(m_scriptId) : String16())
262 .build(); 262 .build();
263 if (!m_url.isEmpty()) 263 if (!m_url.isEmpty())
264 details->setUrl(m_url); 264 details->setUrl(m_url);
265 if (m_stackTrace) 265 if (m_stackTrace)
266 details->setStackTrace(m_stackTrace->buildInspectorObjectImpl()); 266 details->setStackTrace(m_stackTrace->buildInspectorObjectImpl());
267 267
268 if (exception) 268 if (exception)
269 frontend->exceptionThrown(m_exceptionId, m_timestamp, std::move(deta ils), std::move(exception), m_contextId); 269 frontend->exceptionThrown(m_exceptionId, m_timestamp, std::move(deta ils), std::move(exception), m_contextId);
270 else 270 else
271 frontend->exceptionThrown(m_exceptionId, m_timestamp, std::move(deta ils)); 271 frontend->exceptionThrown(m_exceptionId, m_timestamp, std::move(deta ils));
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after
424 session->releaseObjectGroup("console"); 424 session->releaseObjectGroup("console");
425 } 425 }
426 426
427 void V8ConsoleMessageStorage::contextDestroyed(int contextId) 427 void V8ConsoleMessageStorage::contextDestroyed(int contextId)
428 { 428 {
429 for (size_t i = 0; i < m_messages.size(); ++i) 429 for (size_t i = 0; i < m_messages.size(); ++i)
430 m_messages[i]->contextDestroyed(contextId); 430 m_messages[i]->contextDestroyed(contextId);
431 } 431 }
432 432
433 } // namespace blink 433 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698