OLD | NEW |
| (Empty) |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | |
2 // Use of this source code is governed by a BSD-style license that can be | |
3 // found in the LICENSE file. | |
4 | |
5 #include "cc/test/test_webkit_platform.h" | |
6 | |
7 namespace cc { | |
8 | |
9 TestWebKitPlatform::TestWebKitPlatform() { | |
10 } | |
11 | |
12 TestWebKitPlatform::~TestWebKitPlatform() { | |
13 } | |
14 | |
15 WebKit::WebCompositorSupport* TestWebKitPlatform::compositorSupport() { | |
16 return &compositor_support_; | |
17 } | |
18 | |
19 void TestWebKitPlatform::cryptographicallyRandomValues( | |
20 unsigned char* buffer, size_t length) { | |
21 base::RandBytes(buffer, length); | |
22 } | |
23 | |
24 WebKit::WebThread* TestWebKitPlatform::createThread(const char* name) { | |
25 return new webkit_glue::WebThreadImpl(name); | |
26 } | |
27 | |
28 WebKit::WebThread* TestWebKitPlatform::currentThread() { | |
29 webkit_glue::WebThreadImplForMessageLoop* thread = | |
30 static_cast<WebThreadImplForMessageLoop*>(current_thread_slot_.Get()); | |
31 if (thread) | |
32 return (thread); | |
33 | |
34 scoped_refptr<base::MessageLoopProxy> message_loop = | |
35 base::MessageLoopProxy::current(); | |
36 if (!message_loop) | |
37 return NULL; | |
38 | |
39 thread = new WebThreadImplForMessageLoop(message_loop); | |
40 current_thread_slot_.Set(thread); | |
41 return thread; | |
42 } | |
43 | |
44 double TestWebKitPlatform::currentTime() { | |
45 return base::Time::Now().ToDoubleT(); | |
46 } | |
47 | |
48 double TestWebKitPlatform::monotonicallyIncreasingTime() { | |
49 return base::TimeTicks::Now().ToInternalValue() / | |
50 static_cast<double>(base::Time::kMicrosecondsPerSecond); | |
51 } | |
52 | |
53 } | |
OLD | NEW |