| 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 "sky/viewer/platform/platform_impl.h" | 5 #include "sky/viewer/platform/platform_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/debug/trace_event.h" | 9 #include "base/debug/trace_event.h" |
| 10 #include "base/rand_util.h" | 10 #include "base/rand_util.h" |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 69 | 69 |
| 70 double PlatformImpl::currentTime() { | 70 double PlatformImpl::currentTime() { |
| 71 return base::Time::Now().ToDoubleT(); | 71 return base::Time::Now().ToDoubleT(); |
| 72 } | 72 } |
| 73 | 73 |
| 74 double PlatformImpl::monotonicallyIncreasingTime() { | 74 double PlatformImpl::monotonicallyIncreasingTime() { |
| 75 return base::TimeTicks::Now().ToInternalValue() / | 75 return base::TimeTicks::Now().ToInternalValue() / |
| 76 static_cast<double>(base::Time::kMicrosecondsPerSecond); | 76 static_cast<double>(base::Time::kMicrosecondsPerSecond); |
| 77 } | 77 } |
| 78 | 78 |
| 79 void PlatformImpl::cryptographicallyRandomValues(unsigned char* buffer, | |
| 80 size_t length) { | |
| 81 base::RandBytes(buffer, length); | |
| 82 } | |
| 83 | |
| 84 void PlatformImpl::setSharedTimerFiredFunction(void (*func)()) { | 79 void PlatformImpl::setSharedTimerFiredFunction(void (*func)()) { |
| 85 shared_timer_func_ = func; | 80 shared_timer_func_ = func; |
| 86 } | 81 } |
| 87 | 82 |
| 88 void PlatformImpl::setSharedTimerFireInterval( | 83 void PlatformImpl::setSharedTimerFireInterval( |
| 89 double interval_seconds) { | 84 double interval_seconds) { |
| 90 shared_timer_fire_time_ = interval_seconds + monotonicallyIncreasingTime(); | 85 shared_timer_fire_time_ = interval_seconds + monotonicallyIncreasingTime(); |
| 91 if (shared_timer_suspended_) { | 86 if (shared_timer_suspended_) { |
| 92 shared_timer_fire_time_was_set_while_suspended_ = true; | 87 shared_timer_fire_time_was_set_while_suspended_ = true; |
| 93 return; | 88 return; |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 const unsigned char* category_group_enabled, | 253 const unsigned char* category_group_enabled, |
| 259 const char* name, | 254 const char* name, |
| 260 TraceEventHandle handle) { | 255 TraceEventHandle handle) { |
| 261 base::debug::TraceEventHandle traceEventHandle; | 256 base::debug::TraceEventHandle traceEventHandle; |
| 262 memcpy(&traceEventHandle, &handle, sizeof(handle)); | 257 memcpy(&traceEventHandle, &handle, sizeof(handle)); |
| 263 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( | 258 TRACE_EVENT_API_UPDATE_TRACE_EVENT_DURATION( |
| 264 category_group_enabled, name, traceEventHandle); | 259 category_group_enabled, name, traceEventHandle); |
| 265 } | 260 } |
| 266 | 261 |
| 267 } // namespace sky | 262 } // namespace sky |
| OLD | NEW |