From e000e53207d45a3fbef6b0e1aa7e5a03241a2285 Mon Sep 17 00:00:00 2001 From: Adam Barth Date: Wed, 29 Oct 2014 15:55:19 -0700 Subject: [PATCH] Remove Platform::cryptographicallyRandomValues We can just call the base API directly. R=esprehn@chromium.org Review URL: https://codereview.chromium.org/691483005 --- engine/core/animation/CompositorAnimationsTestHelper.h | 2 -- engine/core/fetch/CachingCorrectnessTest.cpp | 1 - engine/platform/TestingPlatformSupport.cpp | 4 ---- engine/platform/TestingPlatformSupport.h | 1 - engine/platform/fonts/FontCacheTest.cpp | 1 - engine/public/platform/Platform.h | 3 --- engine/testing/platform/platform_impl.cc | 5 ----- engine/testing/platform/platform_impl.h | 2 -- engine/web/Sky.cpp | 3 ++- viewer/platform/platform_impl.cc | 5 ----- viewer/platform/platform_impl.h | 2 -- 11 files changed, 2 insertions(+), 27 deletions(-) diff --git a/engine/core/animation/CompositorAnimationsTestHelper.h b/engine/core/animation/CompositorAnimationsTestHelper.h index 9cb7eb352..46955fbdf 100644 --- a/engine/core/animation/CompositorAnimationsTestHelper.h +++ b/engine/core/animation/CompositorAnimationsTestHelper.h @@ -127,8 +127,6 @@ private: class PlatformProxy : public Platform { public: PlatformProxy(WebCompositorSupportMock** compositor) : m_compositor(compositor) { } - - virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t length) { ASSERT_NOT_REACHED(); } private: WebCompositorSupportMock** m_compositor; virtual WebCompositorSupport* compositorSupport() override { return *m_compositor; } diff --git a/engine/core/fetch/CachingCorrectnessTest.cpp b/engine/core/fetch/CachingCorrectnessTest.cpp index 557876947..9d2438628 100644 --- a/engine/core/fetch/CachingCorrectnessTest.cpp +++ b/engine/core/fetch/CachingCorrectnessTest.cpp @@ -117,7 +117,6 @@ private: } // These blink::Platform methods must be overriden to make a usable object. - virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t length) { ASSERT_NOT_REACHED(); } virtual const unsigned char* getTraceCategoryEnabledFlag(const char* categoryName) { return &kAConstUnsignedCharZero; diff --git a/engine/platform/TestingPlatformSupport.cpp b/engine/platform/TestingPlatformSupport.cpp index 3000c38c1..0dccd6138 100644 --- a/engine/platform/TestingPlatformSupport.cpp +++ b/engine/platform/TestingPlatformSupport.cpp @@ -80,10 +80,6 @@ blink::WebDiscardableMemory* TestingPlatformSupport::allocateAndLockDiscardableM return !m_config.hasDiscardableMemorySupport ? 0 : new TestingDiscardableMemory(bytes); } -void TestingPlatformSupport::cryptographicallyRandomValues(unsigned char* buffer, size_t length) -{ -} - const unsigned char* TestingPlatformSupport::getTraceCategoryEnabledFlag(const char* categoryName) { static const unsigned char tracingIsDisabled = 0; diff --git a/engine/platform/TestingPlatformSupport.h b/engine/platform/TestingPlatformSupport.h index 51d178413..ecfca7dfe 100644 --- a/engine/platform/TestingPlatformSupport.h +++ b/engine/platform/TestingPlatformSupport.h @@ -66,7 +66,6 @@ public: // Platform: virtual WebDiscardableMemory* allocateAndLockDiscardableMemory(size_t bytes) override; - virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t length) override; virtual const unsigned char* getTraceCategoryEnabledFlag(const char* categoryName) override; private: diff --git a/engine/platform/fonts/FontCacheTest.cpp b/engine/platform/fonts/FontCacheTest.cpp index c982fd6fc..d4eec4404 100644 --- a/engine/platform/fonts/FontCacheTest.cpp +++ b/engine/platform/fonts/FontCacheTest.cpp @@ -16,7 +16,6 @@ class EmptyPlatform : public Platform { public: EmptyPlatform() { } virtual ~EmptyPlatform() { } - virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t length) override { } }; TEST(FontCache, getLastResortFallbackFont) diff --git a/engine/public/platform/Platform.h b/engine/public/platform/Platform.h index 9351aaa53..cf2f0c979 100644 --- a/engine/public/platform/Platform.h +++ b/engine/public/platform/Platform.h @@ -249,9 +249,6 @@ public: // it is recommended that the fixed point be no further in the past than the epoch. virtual double monotonicallyIncreasingTime() { return 0; } - // WebKit clients must implement this funcion if they use cryptographic randomness. - virtual void cryptographicallyRandomValues(unsigned char* buffer, size_t length) = 0; - // Delayed work is driven by a shared timer. typedef void (*SharedTimerFunction)(); virtual void setSharedTimerFiredFunction(SharedTimerFunction timerFunction) { } diff --git a/engine/testing/platform/platform_impl.cc b/engine/testing/platform/platform_impl.cc index 6deb6089a..683f86450 100644 --- a/engine/testing/platform/platform_impl.cc +++ b/engine/testing/platform/platform_impl.cc @@ -48,11 +48,6 @@ double PlatformImpl::monotonicallyIncreasingTime() { static_cast(base::Time::kMicrosecondsPerSecond); } -void PlatformImpl::cryptographicallyRandomValues(unsigned char* buffer, - size_t length) { - base::RandBytes(buffer, length); -} - void PlatformImpl::setSharedTimerFiredFunction(void (*func)()) { shared_timer_func_ = func; } diff --git a/engine/testing/platform/platform_impl.h b/engine/testing/platform/platform_impl.h index e957ebea7..73a363a88 100644 --- a/engine/testing/platform/platform_impl.h +++ b/engine/testing/platform/platform_impl.h @@ -29,8 +29,6 @@ class PlatformImpl : public blink::Platform { virtual blink::WebString defaultLocale(); virtual double currentTime(); virtual double monotonicallyIncreasingTime(); - virtual void cryptographicallyRandomValues( - unsigned char* buffer, size_t length); virtual void setSharedTimerFiredFunction(void (*func)()); virtual void setSharedTimerFireInterval(double interval_seconds); virtual void stopSharedTimer(); diff --git a/engine/web/Sky.cpp b/engine/web/Sky.cpp index 7b2eb1fc9..5441aed79 100644 --- a/engine/web/Sky.cpp +++ b/engine/web/Sky.cpp @@ -32,6 +32,7 @@ #include "public/web/Sky.h" #include "base/message_loop/message_loop.h" +#include "base/rand_util.h" #include "bindings/core/v8/V8Binding.h" #include "bindings/core/v8/V8GCController.h" #include "bindings/core/v8/V8Initializer.h" @@ -145,7 +146,7 @@ static double monotonicallyIncreasingTimeFunction() static void cryptographicallyRandomValues(unsigned char* buffer, size_t length) { - Platform::current()->cryptographicallyRandomValues(buffer, length); + base::RandBytes(buffer, length); } static void callOnMainThreadFunction(WTF::MainThreadFunction function, void* context) diff --git a/viewer/platform/platform_impl.cc b/viewer/platform/platform_impl.cc index d4b47d884..269a74c2c 100644 --- a/viewer/platform/platform_impl.cc +++ b/viewer/platform/platform_impl.cc @@ -76,11 +76,6 @@ double PlatformImpl::monotonicallyIncreasingTime() { static_cast(base::Time::kMicrosecondsPerSecond); } -void PlatformImpl::cryptographicallyRandomValues(unsigned char* buffer, - size_t length) { - base::RandBytes(buffer, length); -} - void PlatformImpl::setSharedTimerFiredFunction(void (*func)()) { shared_timer_func_ = func; } diff --git a/viewer/platform/platform_impl.h b/viewer/platform/platform_impl.h index a7b65e719..dc652813a 100644 --- a/viewer/platform/platform_impl.h +++ b/viewer/platform/platform_impl.h @@ -33,8 +33,6 @@ class PlatformImpl : public blink::Platform { virtual blink::WebString defaultLocale(); virtual double currentTime(); virtual double monotonicallyIncreasingTime(); - virtual void cryptographicallyRandomValues( - unsigned char* buffer, size_t length); virtual void setSharedTimerFiredFunction(void (*func)()); virtual void setSharedTimerFireInterval(double interval_seconds); virtual void stopSharedTimer(); -- GitLab