| 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 633 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 644 if (convertable_values) { | 644 if (convertable_values) { |
| 645 size_t size = std::min(static_cast<size_t>(num_args), | 645 size_t size = std::min(static_cast<size_t>(num_args), |
| 646 arraysize(convertable_wrappers)); | 646 arraysize(convertable_wrappers)); |
| 647 for (size_t i = 0; i < size; ++i) { | 647 for (size_t i = 0; i < size; ++i) { |
| 648 if (arg_types[i] == TRACE_VALUE_TYPE_CONVERTABLE) { | 648 if (arg_types[i] == TRACE_VALUE_TYPE_CONVERTABLE) { |
| 649 convertable_wrappers[i] = | 649 convertable_wrappers[i] = |
| 650 new ConvertableToTraceFormatWrapper(convertable_values[i]); | 650 new ConvertableToTraceFormatWrapper(convertable_values[i]); |
| 651 } | 651 } |
| 652 } | 652 } |
| 653 } | 653 } |
| 654 base::TraceTicks timestamp_tt = | 654 base::TimeTicks timestamp_tt = |
| 655 base::TraceTicks() + base::TimeDelta::FromSecondsD(timestamp); | 655 base::TimeTicks() + base::TimeDelta::FromSecondsD(timestamp); |
| 656 base::trace_event::TraceEventHandle handle = | 656 base::trace_event::TraceEventHandle handle = |
| 657 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 657 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
| 658 phase, category_group_enabled, name, id, trace_event_internal::kNoId, | 658 phase, category_group_enabled, name, id, trace_event_internal::kNoId, |
| 659 bind_id, base::PlatformThread::CurrentId(), timestamp_tt, num_args, | 659 bind_id, base::PlatformThread::CurrentId(), timestamp_tt, num_args, |
| 660 arg_names, arg_types, arg_values, convertable_wrappers, flags); | 660 arg_names, arg_types, arg_values, convertable_wrappers, flags); |
| 661 blink::Platform::TraceEventHandle result; | 661 blink::Platform::TraceEventHandle result; |
| 662 memcpy(&result, &handle, sizeof(result)); | 662 memcpy(&result, &handle, sizeof(result)); |
| 663 return result; | 663 return result; |
| 664 } | 664 } |
| 665 | 665 |
| (...skipping 14 matching lines...) Expand all Loading... |
| 680 if (convertable_values) { | 680 if (convertable_values) { |
| 681 size_t size = std::min(static_cast<size_t>(num_args), | 681 size_t size = std::min(static_cast<size_t>(num_args), |
| 682 arraysize(convertable_wrappers)); | 682 arraysize(convertable_wrappers)); |
| 683 for (size_t i = 0; i < size; ++i) { | 683 for (size_t i = 0; i < size; ++i) { |
| 684 if (arg_types[i] == TRACE_VALUE_TYPE_CONVERTABLE) { | 684 if (arg_types[i] == TRACE_VALUE_TYPE_CONVERTABLE) { |
| 685 convertable_wrappers[i] = | 685 convertable_wrappers[i] = |
| 686 new ConvertableToTraceFormatWrapper(convertable_values[i]); | 686 new ConvertableToTraceFormatWrapper(convertable_values[i]); |
| 687 } | 687 } |
| 688 } | 688 } |
| 689 } | 689 } |
| 690 base::TraceTicks timestamp_tt = | 690 base::TimeTicks timestamp_tt = |
| 691 base::TraceTicks() + base::TimeDelta::FromSecondsD(timestamp); | 691 base::TimeTicks() + base::TimeDelta::FromSecondsD(timestamp); |
| 692 base::trace_event::TraceEventHandle handle = | 692 base::trace_event::TraceEventHandle handle = |
| 693 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( | 693 TRACE_EVENT_API_ADD_TRACE_EVENT_WITH_THREAD_ID_AND_TIMESTAMP( |
| 694 phase, category_group_enabled, name, id, trace_event_internal::kNoId, | 694 phase, category_group_enabled, name, id, trace_event_internal::kNoId, |
| 695 base::PlatformThread::CurrentId(), timestamp_tt, num_args, arg_names, | 695 base::PlatformThread::CurrentId(), timestamp_tt, num_args, arg_names, |
| 696 arg_types, arg_values, convertable_wrappers, flags); | 696 arg_types, arg_values, convertable_wrappers, flags); |
| 697 blink::Platform::TraceEventHandle result; | 697 blink::Platform::TraceEventHandle result; |
| 698 memcpy(&result, &handle, sizeof(result)); | 698 memcpy(&result, &handle, sizeof(result)); |
| 699 return result; | 699 return result; |
| 700 } | 700 } |
| 701 | 701 |
| (...skipping 375 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1077 double BlinkPlatformImpl::currentTime() { | 1077 double BlinkPlatformImpl::currentTime() { |
| 1078 return base::Time::Now().ToDoubleT(); | 1078 return base::Time::Now().ToDoubleT(); |
| 1079 } | 1079 } |
| 1080 | 1080 |
| 1081 double BlinkPlatformImpl::monotonicallyIncreasingTime() { | 1081 double BlinkPlatformImpl::monotonicallyIncreasingTime() { |
| 1082 return base::TimeTicks::Now().ToInternalValue() / | 1082 return base::TimeTicks::Now().ToInternalValue() / |
| 1083 static_cast<double>(base::Time::kMicrosecondsPerSecond); | 1083 static_cast<double>(base::Time::kMicrosecondsPerSecond); |
| 1084 } | 1084 } |
| 1085 | 1085 |
| 1086 double BlinkPlatformImpl::systemTraceTime() { | 1086 double BlinkPlatformImpl::systemTraceTime() { |
| 1087 return (base::TraceTicks::Now() - base::TraceTicks()).InSecondsF(); | 1087 return (base::TimeTicks::Now() - base::TimeTicks()).InSecondsF(); |
| 1088 } | 1088 } |
| 1089 | 1089 |
| 1090 void BlinkPlatformImpl::cryptographicallyRandomValues( | 1090 void BlinkPlatformImpl::cryptographicallyRandomValues( |
| 1091 unsigned char* buffer, size_t length) { | 1091 unsigned char* buffer, size_t length) { |
| 1092 base::RandBytes(buffer, length); | 1092 base::RandBytes(buffer, length); |
| 1093 } | 1093 } |
| 1094 | 1094 |
| 1095 blink::WebGestureCurve* BlinkPlatformImpl::createFlingAnimationCurve( | 1095 blink::WebGestureCurve* BlinkPlatformImpl::createFlingAnimationCurve( |
| 1096 blink::WebGestureDevice device_source, | 1096 blink::WebGestureDevice device_source, |
| 1097 const blink::WebFloatPoint& velocity, | 1097 const blink::WebFloatPoint& velocity, |
| (...skipping 227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1325 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( | 1325 return WebString::fromUTF8(ui::KeycodeConverter::DomKeyToKeyString( |
| 1326 static_cast<ui::DomKey>(dom_key))); | 1326 static_cast<ui::DomKey>(dom_key))); |
| 1327 } | 1327 } |
| 1328 | 1328 |
| 1329 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { | 1329 int BlinkPlatformImpl::domKeyEnumFromString(const WebString& key_string) { |
| 1330 return static_cast<int>( | 1330 return static_cast<int>( |
| 1331 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); | 1331 ui::KeycodeConverter::KeyStringToDomKey(key_string.utf8())); |
| 1332 } | 1332 } |
| 1333 | 1333 |
| 1334 } // namespace content | 1334 } // namespace content |
| OLD | NEW |