OLD | NEW |
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 608 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
619 char phase, | 619 char phase, |
620 const unsigned char* category_group_enabled, | 620 const unsigned char* category_group_enabled, |
621 const char* name, | 621 const char* name, |
622 unsigned long long id, | 622 unsigned long long id, |
623 double timestamp, | 623 double timestamp, |
624 int num_args, | 624 int num_args, |
625 const char** arg_names, | 625 const char** arg_names, |
626 const unsigned char* arg_types, | 626 const unsigned char* arg_types, |
627 const unsigned long long* arg_values, | 627 const unsigned long long* arg_values, |
628 unsigned char flags) { | 628 unsigned char flags) { |
629 base::TimeTicks timestamp_tt = base::TimeTicks::FromInternalValue( | 629 base::TraceTicks timestamp_tt = |
630 static_cast<int64>(timestamp * base::Time::kMicrosecondsPerSecond)); | 630 base::TraceTicks() + base::TimeDelta::FromSecondsD(timestamp); |
631 base::trace_event::TraceEventHandle handle = | 631 base::trace_event::TraceEventHandle handle = |
632 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 632 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
633 phase, category_group_enabled, name, id, | 633 phase, category_group_enabled, name, id, |
634 base::PlatformThread::CurrentId(), | 634 base::PlatformThread::CurrentId(), |
635 timestamp_tt, | 635 timestamp_tt, |
636 num_args, arg_names, arg_types, arg_values, NULL, flags); | 636 num_args, arg_names, arg_types, arg_values, NULL, flags); |
637 blink::Platform::TraceEventHandle result; | 637 blink::Platform::TraceEventHandle result; |
638 memcpy(&result, &handle, sizeof(result)); | 638 memcpy(&result, &handle, sizeof(result)); |
639 return result; | 639 return result; |
640 } | 640 } |
(...skipping 20 matching lines...) Expand all Loading... |
661 if (convertable_values) { | 661 if (convertable_values) { |
662 size_t size = std::min(static_cast<size_t>(num_args), | 662 size_t size = std::min(static_cast<size_t>(num_args), |
663 arraysize(convertable_wrappers)); | 663 arraysize(convertable_wrappers)); |
664 for (size_t i = 0; i < size; ++i) { | 664 for (size_t i = 0; i < size; ++i) { |
665 if (arg_types[i] == TRACE_VALUE_TYPE_CONVERTABLE) { | 665 if (arg_types[i] == TRACE_VALUE_TYPE_CONVERTABLE) { |
666 convertable_wrappers[i] = | 666 convertable_wrappers[i] = |
667 new ConvertableToTraceFormatWrapper(convertable_values[i]); | 667 new ConvertableToTraceFormatWrapper(convertable_values[i]); |
668 } | 668 } |
669 } | 669 } |
670 } | 670 } |
671 base::TimeTicks timestamp_tt = base::TimeTicks::FromInternalValue( | 671 base::TraceTicks timestamp_tt = |
672 static_cast<int64>(timestamp * base::Time::kMicrosecondsPerSecond)); | 672 base::TraceTicks() + base::TimeDelta::FromSecondsD(timestamp); |
673 base::trace_event::TraceEventHandle handle = | 673 base::trace_event::TraceEventHandle handle = |
674 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP(phase, | 674 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP(phase, |
675 category_group_enabled, | 675 category_group_enabled, |
676 name, | 676 name, |
677 id, | 677 id, |
678 base::PlatformThread::CurrentId(), | 678 base::PlatformThread::CurrentId(), |
679 timestamp_tt, | 679 timestamp_tt, |
680 num_args, | 680 num_args, |
681 arg_names, | 681 arg_names, |
682 arg_types, | 682 arg_types, |
(...skipping 368 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1051 double BlinkPlatformImpl::currentTime() { | 1051 double BlinkPlatformImpl::currentTime() { |
1052 return base::Time::Now().ToDoubleT(); | 1052 return base::Time::Now().ToDoubleT(); |
1053 } | 1053 } |
1054 | 1054 |
1055 double BlinkPlatformImpl::monotonicallyIncreasingTime() { | 1055 double BlinkPlatformImpl::monotonicallyIncreasingTime() { |
1056 return base::TimeTicks::Now().ToInternalValue() / | 1056 return base::TimeTicks::Now().ToInternalValue() / |
1057 static_cast<double>(base::Time::kMicrosecondsPerSecond); | 1057 static_cast<double>(base::Time::kMicrosecondsPerSecond); |
1058 } | 1058 } |
1059 | 1059 |
1060 double BlinkPlatformImpl::systemTraceTime() { | 1060 double BlinkPlatformImpl::systemTraceTime() { |
1061 return base::TimeTicks::NowFromSystemTraceTime().ToInternalValue() / | 1061 return (base::TraceTicks::Now() - base::TraceTicks()).InSecondsF(); |
1062 static_cast<double>(base::Time::kMicrosecondsPerSecond); | |
1063 } | 1062 } |
1064 | 1063 |
1065 void BlinkPlatformImpl::cryptographicallyRandomValues( | 1064 void BlinkPlatformImpl::cryptographicallyRandomValues( |
1066 unsigned char* buffer, size_t length) { | 1065 unsigned char* buffer, size_t length) { |
1067 base::RandBytes(buffer, length); | 1066 base::RandBytes(buffer, length); |
1068 } | 1067 } |
1069 | 1068 |
1070 void BlinkPlatformImpl::setSharedTimerFiredFunction(void (*func)()) { | 1069 void BlinkPlatformImpl::setSharedTimerFiredFunction(void (*func)()) { |
1071 shared_timer_func_ = func; | 1070 shared_timer_func_ = func; |
1072 } | 1071 } |
(...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1343 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString( | 1342 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString( |
1344 static_cast<ui::DomCode>(dom_code))); | 1343 static_cast<ui::DomCode>(dom_code))); |
1345 } | 1344 } |
1346 | 1345 |
1347 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) { | 1346 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) { |
1348 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode( | 1347 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode( |
1349 code.utf8().data())); | 1348 code.utf8().data())); |
1350 } | 1349 } |
1351 | 1350 |
1352 } // namespace content | 1351 } // namespace content |
OLD | NEW |