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

Side by Side Diff: content/child/blink_platform_impl.cc

Issue 1122153002: Fixit: Fork base::TimeTicks --> TimeTicks + ThreadTicks + TraceTicks (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@FIXIT_timeclasses_1of2
Patch Set: Comment tweak, plus dcheng's int64_t nit. [+REBASE] Created 5 years, 7 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "content/child/blink_platform_impl.h" 5 #include "content/child/blink_platform_impl.h"
6 6
7 #include <math.h> 7 #include <math.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 616 matching lines...) Expand 10 before | Expand all | Expand 10 after
627 char phase, 627 char phase,
628 const unsigned char* category_group_enabled, 628 const unsigned char* category_group_enabled,
629 const char* name, 629 const char* name,
630 unsigned long long id, 630 unsigned long long id,
631 double timestamp, 631 double timestamp,
632 int num_args, 632 int num_args,
633 const char** arg_names, 633 const char** arg_names,
634 const unsigned char* arg_types, 634 const unsigned char* arg_types,
635 const unsigned long long* arg_values, 635 const unsigned long long* arg_values,
636 unsigned char flags) { 636 unsigned char flags) {
637 base::TimeTicks timestamp_tt = base::TimeTicks::FromInternalValue( 637 base::TraceTicks timestamp_tt =
638 static_cast<int64>(timestamp * base::Time::kMicrosecondsPerSecond)); 638 base::TraceTicks() + base::TimeDelta::FromSecondsD(timestamp);
639 base::trace_event::TraceEventHandle handle = 639 base::trace_event::TraceEventHandle handle =
640 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( 640 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP(
641 phase, category_group_enabled, name, id, 641 phase, category_group_enabled, name, id,
642 base::PlatformThread::CurrentId(), 642 base::PlatformThread::CurrentId(),
643 timestamp_tt, 643 timestamp_tt,
644 num_args, arg_names, arg_types, arg_values, NULL, flags); 644 num_args, arg_names, arg_types, arg_values, NULL, flags);
645 blink::Platform::TraceEventHandle result; 645 blink::Platform::TraceEventHandle result;
646 memcpy(&result, &handle, sizeof(result)); 646 memcpy(&result, &handle, sizeof(result));
647 return result; 647 return result;
648 } 648 }
(...skipping 15 matching lines...) Expand all
664 if (convertable_values) { 664 if (convertable_values) {
665 size_t size = std::min(static_cast<size_t>(num_args), 665 size_t size = std::min(static_cast<size_t>(num_args),
666 arraysize(convertable_wrappers)); 666 arraysize(convertable_wrappers));
667 for (size_t i = 0; i < size; ++i) { 667 for (size_t i = 0; i < size; ++i) {
668 if (arg_types[i] == TRACE_VALUE_TYPE_CONVERTABLE) { 668 if (arg_types[i] == TRACE_VALUE_TYPE_CONVERTABLE) {
669 convertable_wrappers[i] = 669 convertable_wrappers[i] =
670 new ConvertableToTraceFormatWrapper(convertable_values[i]); 670 new ConvertableToTraceFormatWrapper(convertable_values[i]);
671 } 671 }
672 } 672 }
673 } 673 }
674 base::TimeTicks timestamp_tt = base::TimeTicks::FromInternalValue( 674 base::TraceTicks timestamp_tt =
675 static_cast<int64>(timestamp * base::Time::kMicrosecondsPerSecond)); 675 base::TraceTicks() + base::TimeDelta::FromSecondsD(timestamp);
676 base::trace_event::TraceEventHandle handle = 676 base::trace_event::TraceEventHandle handle =
677 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP(phase, 677 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP(phase,
678 category_group_enabled, 678 category_group_enabled,
679 name, 679 name,
680 id, 680 id,
681 base::PlatformThread::CurrentId(), 681 base::PlatformThread::CurrentId(),
682 timestamp_tt, 682 timestamp_tt,
683 num_args, 683 num_args,
684 arg_names, 684 arg_names,
685 arg_types, 685 arg_types,
(...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after
1078 double BlinkPlatformImpl::currentTime() { 1078 double BlinkPlatformImpl::currentTime() {
1079 return base::Time::Now().ToDoubleT(); 1079 return base::Time::Now().ToDoubleT();
1080 } 1080 }
1081 1081
1082 double BlinkPlatformImpl::monotonicallyIncreasingTime() { 1082 double BlinkPlatformImpl::monotonicallyIncreasingTime() {
1083 return base::TimeTicks::Now().ToInternalValue() / 1083 return base::TimeTicks::Now().ToInternalValue() /
1084 static_cast<double>(base::Time::kMicrosecondsPerSecond); 1084 static_cast<double>(base::Time::kMicrosecondsPerSecond);
1085 } 1085 }
1086 1086
1087 double BlinkPlatformImpl::systemTraceTime() { 1087 double BlinkPlatformImpl::systemTraceTime() {
1088 return base::TimeTicks::NowFromSystemTraceTime().ToInternalValue() / 1088 return (base::TraceTicks::Now() - base::TraceTicks()).InSecondsF();
1089 static_cast<double>(base::Time::kMicrosecondsPerSecond);
1090 } 1089 }
1091 1090
1092 void BlinkPlatformImpl::cryptographicallyRandomValues( 1091 void BlinkPlatformImpl::cryptographicallyRandomValues(
1093 unsigned char* buffer, size_t length) { 1092 unsigned char* buffer, size_t length) {
1094 base::RandBytes(buffer, length); 1093 base::RandBytes(buffer, length);
1095 } 1094 }
1096 1095
1097 void BlinkPlatformImpl::setSharedTimerFiredFunction(void (*func)()) { 1096 void BlinkPlatformImpl::setSharedTimerFiredFunction(void (*func)()) {
1098 shared_timer_func_ = func; 1097 shared_timer_func_ = func;
1099 } 1098 }
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
1381 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString( 1380 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString(
1382 static_cast<ui::DomCode>(dom_code))); 1381 static_cast<ui::DomCode>(dom_code)));
1383 } 1382 }
1384 1383
1385 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) { 1384 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) {
1386 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode( 1385 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode(
1387 code.utf8().data())); 1386 code.utf8().data()));
1388 } 1387 }
1389 1388
1390 } // namespace content 1389 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698