OLD | NEW |
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.h" | 5 #include "src/inspector/v8-console.h" |
6 | 6 |
7 #include "src/base/macros.h" | 7 #include "src/base/macros.h" |
8 #include "src/inspector/injected-script.h" | 8 #include "src/inspector/injected-script.h" |
9 #include "src/inspector/inspected-context.h" | 9 #include "src/inspector/inspected-context.h" |
10 #include "src/inspector/string-util.h" | 10 #include "src/inspector/string-util.h" |
(...skipping 413 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
424 if (V8InspectorClient* client = helper.ensureDebuggerClient()) { | 424 if (V8InspectorClient* client = helper.ensureDebuggerClient()) { |
425 String16 protocolTitle = helper.firstArgToString("default"); | 425 String16 protocolTitle = helper.firstArgToString("default"); |
426 if (timelinePrefix) protocolTitle = "Timeline '" + protocolTitle + "'"; | 426 if (timelinePrefix) protocolTitle = "Timeline '" + protocolTitle + "'"; |
427 client->consoleTimeEnd(toStringView(protocolTitle)); | 427 client->consoleTimeEnd(toStringView(protocolTitle)); |
428 | 428 |
429 v8::Local<v8::Map> timeMap; | 429 v8::Local<v8::Map> timeMap; |
430 if (!helper.privateMap("V8Console#timeMap").ToLocal(&timeMap)) return; | 430 if (!helper.privateMap("V8Console#timeMap").ToLocal(&timeMap)) return; |
431 double elapsed = client->currentTimeMS() - | 431 double elapsed = client->currentTimeMS() - |
432 helper.getDoubleFromMap(timeMap, protocolTitle, 0.0); | 432 helper.getDoubleFromMap(timeMap, protocolTitle, 0.0); |
433 String16 message = | 433 String16 message = |
434 protocolTitle + ": " + String16::fromDoublePrecision3(elapsed) + "ms"; | 434 protocolTitle + ": " + String16::fromDouble(elapsed, 3) + "ms"; |
435 helper.reportCallWithArgument(ConsoleAPIType::kTimeEnd, message); | 435 helper.reportCallWithArgument(ConsoleAPIType::kTimeEnd, message); |
436 } | 436 } |
437 } | 437 } |
438 | 438 |
439 void V8Console::timelineCallback( | 439 void V8Console::timelineCallback( |
440 const v8::FunctionCallbackInfo<v8::Value>& info) { | 440 const v8::FunctionCallbackInfo<v8::Value>& info) { |
441 ConsoleHelper(info).reportDeprecatedCall( | 441 ConsoleHelper(info).reportDeprecatedCall( |
442 "V8Console#timeline", | 442 "V8Console#timeline", |
443 "'console.timeline' is deprecated. Please use 'console.time' instead."); | 443 "'console.timeline' is deprecated. Please use 'console.time' instead."); |
444 timeFunction(info, true); | 444 timeFunction(info, true); |
(...skipping 468 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
913 ->GetOwnPropertyDescriptor( | 913 ->GetOwnPropertyDescriptor( |
914 m_context, v8::Local<v8::String>::Cast(name)) | 914 m_context, v8::Local<v8::String>::Cast(name)) |
915 .ToLocal(&descriptor); | 915 .ToLocal(&descriptor); |
916 DCHECK(success); | 916 DCHECK(success); |
917 USE(success); | 917 USE(success); |
918 } | 918 } |
919 } | 919 } |
920 } | 920 } |
921 | 921 |
922 } // namespace v8_inspector | 922 } // namespace v8_inspector |
OLD | NEW |