| 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/engine/testing/platform/platform_impl.h" | 5 #include "sky/engine/testing/platform/platform_impl.h" |
| 6 | 6 |
| 7 #include <cmath> | 7 #include <cmath> |
| 8 | 8 |
| 9 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
| 10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 double PlatformImpl::currentTime() { | 42 double PlatformImpl::currentTime() { |
| 43 return base::Time::Now().ToDoubleT(); | 43 return base::Time::Now().ToDoubleT(); |
| 44 } | 44 } |
| 45 | 45 |
| 46 double PlatformImpl::monotonicallyIncreasingTime() { | 46 double PlatformImpl::monotonicallyIncreasingTime() { |
| 47 return base::TimeTicks::Now().ToInternalValue() / | 47 return base::TimeTicks::Now().ToInternalValue() / |
| 48 static_cast<double>(base::Time::kMicrosecondsPerSecond); | 48 static_cast<double>(base::Time::kMicrosecondsPerSecond); |
| 49 } | 49 } |
| 50 | 50 |
| 51 void PlatformImpl::cryptographicallyRandomValues(unsigned char* buffer, | |
| 52 size_t length) { | |
| 53 base::RandBytes(buffer, length); | |
| 54 } | |
| 55 | |
| 56 void PlatformImpl::setSharedTimerFiredFunction(void (*func)()) { | 51 void PlatformImpl::setSharedTimerFiredFunction(void (*func)()) { |
| 57 shared_timer_func_ = func; | 52 shared_timer_func_ = func; |
| 58 } | 53 } |
| 59 | 54 |
| 60 void PlatformImpl::setSharedTimerFireInterval( | 55 void PlatformImpl::setSharedTimerFireInterval( |
| 61 double interval_seconds) { | 56 double interval_seconds) { |
| 62 shared_timer_fire_time_ = interval_seconds + monotonicallyIncreasingTime(); | 57 shared_timer_fire_time_ = interval_seconds + monotonicallyIncreasingTime(); |
| 63 if (shared_timer_suspended_) { | 58 if (shared_timer_suspended_) { |
| 64 shared_timer_fire_time_was_set_while_suspended_ = true; | 59 shared_timer_fire_time_was_set_while_suspended_ = true; |
| 65 return; | 60 return; |
| (...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 if (net::DataURL::Parse(url, &mimetype, &charset, &data) | 113 if (net::DataURL::Parse(url, &mimetype, &charset, &data) |
| 119 && net::IsSupportedMimeType(mimetype)) { | 114 && net::IsSupportedMimeType(mimetype)) { |
| 120 mimetype_out = blink::WebString::fromUTF8(mimetype); | 115 mimetype_out = blink::WebString::fromUTF8(mimetype); |
| 121 charset_out = blink::WebString::fromUTF8(charset); | 116 charset_out = blink::WebString::fromUTF8(charset); |
| 122 return data; | 117 return data; |
| 123 } | 118 } |
| 124 return blink::WebData(); | 119 return blink::WebData(); |
| 125 } | 120 } |
| 126 | 121 |
| 127 } // namespace sky | 122 } // namespace sky |
| OLD | NEW |