| 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 612 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 623 char phase, | 623 char phase, |
| 624 const unsigned char* category_group_enabled, | 624 const unsigned char* category_group_enabled, |
| 625 const char* name, | 625 const char* name, |
| 626 unsigned long long id, | 626 unsigned long long id, |
| 627 double timestamp, | 627 double timestamp, |
| 628 int num_args, | 628 int num_args, |
| 629 const char** arg_names, | 629 const char** arg_names, |
| 630 const unsigned char* arg_types, | 630 const unsigned char* arg_types, |
| 631 const unsigned long long* arg_values, | 631 const unsigned long long* arg_values, |
| 632 unsigned char flags) { | 632 unsigned char flags) { |
| 633 base::TimeTicks timestamp_tt = base::TimeTicks::FromInternalValue( | 633 base::TraceTicks timestamp_tt = |
| 634 static_cast<int64>(timestamp * base::Time::kMicrosecondsPerSecond)); | 634 base::TraceTicks() + base::TimeDelta::FromSecondsD(timestamp); |
| 635 base::trace_event::TraceEventHandle handle = | 635 base::trace_event::TraceEventHandle handle = |
| 636 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 636 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
| 637 phase, category_group_enabled, name, id, | 637 phase, category_group_enabled, name, id, |
| 638 base::PlatformThread::CurrentId(), | 638 base::PlatformThread::CurrentId(), |
| 639 timestamp_tt, | 639 timestamp_tt, |
| 640 num_args, arg_names, arg_types, arg_values, NULL, flags); | 640 num_args, arg_names, arg_types, arg_values, NULL, flags); |
| 641 blink::Platform::TraceEventHandle result; | 641 blink::Platform::TraceEventHandle result; |
| 642 memcpy(&result, &handle, sizeof(result)); | 642 memcpy(&result, &handle, sizeof(result)); |
| 643 return result; | 643 return result; |
| 644 } | 644 } |
| (...skipping 15 matching lines...) Expand all Loading... |
| 660 if (convertable_values) { | 660 if (convertable_values) { |
| 661 size_t size = std::min(static_cast<size_t>(num_args), | 661 size_t size = std::min(static_cast<size_t>(num_args), |
| 662 arraysize(convertable_wrappers)); | 662 arraysize(convertable_wrappers)); |
| 663 for (size_t i = 0; i < size; ++i) { | 663 for (size_t i = 0; i < size; ++i) { |
| 664 if (arg_types[i] == TRACE_VALUE_TYPE_CONVERTABLE) { | 664 if (arg_types[i] == TRACE_VALUE_TYPE_CONVERTABLE) { |
| 665 convertable_wrappers[i] = | 665 convertable_wrappers[i] = |
| 666 new ConvertableToTraceFormatWrapper(convertable_values[i]); | 666 new ConvertableToTraceFormatWrapper(convertable_values[i]); |
| 667 } | 667 } |
| 668 } | 668 } |
| 669 } | 669 } |
| 670 base::TimeTicks timestamp_tt = base::TimeTicks::FromInternalValue( | 670 base::TraceTicks timestamp_tt = |
| 671 static_cast<int64>(timestamp * base::Time::kMicrosecondsPerSecond)); | 671 base::TraceTicks() + base::TimeDelta::FromSecondsD(timestamp); |
| 672 base::trace_event::TraceEventHandle handle = | 672 base::trace_event::TraceEventHandle handle = |
| 673 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP(phase, | 673 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP(phase, |
| 674 category_group_enabled, | 674 category_group_enabled, |
| 675 name, | 675 name, |
| 676 id, | 676 id, |
| 677 base::PlatformThread::CurrentId(), | 677 base::PlatformThread::CurrentId(), |
| 678 timestamp_tt, | 678 timestamp_tt, |
| 679 num_args, | 679 num_args, |
| 680 arg_names, | 680 arg_names, |
| 681 arg_types, | 681 arg_types, |
| (...skipping 392 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1074 double BlinkPlatformImpl::currentTime() { | 1074 double BlinkPlatformImpl::currentTime() { |
| 1075 return base::Time::Now().ToDoubleT(); | 1075 return base::Time::Now().ToDoubleT(); |
| 1076 } | 1076 } |
| 1077 | 1077 |
| 1078 double BlinkPlatformImpl::monotonicallyIncreasingTime() { | 1078 double BlinkPlatformImpl::monotonicallyIncreasingTime() { |
| 1079 return base::TimeTicks::Now().ToInternalValue() / | 1079 return base::TimeTicks::Now().ToInternalValue() / |
| 1080 static_cast<double>(base::Time::kMicrosecondsPerSecond); | 1080 static_cast<double>(base::Time::kMicrosecondsPerSecond); |
| 1081 } | 1081 } |
| 1082 | 1082 |
| 1083 double BlinkPlatformImpl::systemTraceTime() { | 1083 double BlinkPlatformImpl::systemTraceTime() { |
| 1084 return base::TimeTicks::NowFromSystemTraceTime().ToInternalValue() / | 1084 return (base::TraceTicks::Now() - base::TraceTicks()).InSecondsF(); |
| 1085 static_cast<double>(base::Time::kMicrosecondsPerSecond); | |
| 1086 } | 1085 } |
| 1087 | 1086 |
| 1088 void BlinkPlatformImpl::cryptographicallyRandomValues( | 1087 void BlinkPlatformImpl::cryptographicallyRandomValues( |
| 1089 unsigned char* buffer, size_t length) { | 1088 unsigned char* buffer, size_t length) { |
| 1090 base::RandBytes(buffer, length); | 1089 base::RandBytes(buffer, length); |
| 1091 } | 1090 } |
| 1092 | 1091 |
| 1093 void BlinkPlatformImpl::setSharedTimerFiredFunction(void (*func)()) { | 1092 void BlinkPlatformImpl::setSharedTimerFiredFunction(void (*func)()) { |
| 1094 shared_timer_func_ = func; | 1093 shared_timer_func_ = func; |
| 1095 } | 1094 } |
| (...skipping 270 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1366 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString( | 1365 return WebString::fromUTF8(ui::KeycodeConverter::DomCodeToCodeString( |
| 1367 static_cast<ui::DomCode>(dom_code))); | 1366 static_cast<ui::DomCode>(dom_code))); |
| 1368 } | 1367 } |
| 1369 | 1368 |
| 1370 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) { | 1369 int BlinkPlatformImpl::domEnumFromCodeString(const WebString& code) { |
| 1371 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode( | 1370 return static_cast<int>(ui::KeycodeConverter::CodeStringToDomCode( |
| 1372 code.utf8().data())); | 1371 code.utf8().data())); |
| 1373 } | 1372 } |
| 1374 | 1373 |
| 1375 } // namespace content | 1374 } // namespace content |
| OLD | NEW |