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 "mojo/edk/embedder/simple_platform_support.h" | 5 #include "mojo/edk/embedder/simple_platform_support.h" |
6 | 6 |
| 7 #include <utility> |
| 8 |
7 #include "base/rand_util.h" | 9 #include "base/rand_util.h" |
8 #include "base/time/time.h" | 10 #include "base/time/time.h" |
9 #include "mojo/edk/embedder/simple_platform_shared_buffer.h" | 11 #include "mojo/edk/embedder/simple_platform_shared_buffer.h" |
10 | 12 |
| 13 using mojo::platform::ScopedPlatformHandle; |
11 using mojo::util::RefPtr; | 14 using mojo::util::RefPtr; |
12 | 15 |
13 namespace mojo { | 16 namespace mojo { |
14 namespace embedder { | 17 namespace embedder { |
15 | 18 |
16 MojoTimeTicks SimplePlatformSupport::GetTimeTicksNow() { | 19 MojoTimeTicks SimplePlatformSupport::GetTimeTicksNow() { |
17 return base::TimeTicks::Now().ToInternalValue(); | 20 return base::TimeTicks::Now().ToInternalValue(); |
18 } | 21 } |
19 | 22 |
20 void SimplePlatformSupport::GetCryptoRandomBytes(void* bytes, | 23 void SimplePlatformSupport::GetCryptoRandomBytes(void* bytes, |
21 size_t num_bytes) { | 24 size_t num_bytes) { |
22 base::RandBytes(bytes, num_bytes); | 25 base::RandBytes(bytes, num_bytes); |
23 } | 26 } |
24 | 27 |
25 RefPtr<PlatformSharedBuffer> SimplePlatformSupport::CreateSharedBuffer( | 28 RefPtr<PlatformSharedBuffer> SimplePlatformSupport::CreateSharedBuffer( |
26 size_t num_bytes) { | 29 size_t num_bytes) { |
27 return SimplePlatformSharedBuffer::Create(num_bytes); | 30 return SimplePlatformSharedBuffer::Create(num_bytes); |
28 } | 31 } |
29 | 32 |
30 RefPtr<PlatformSharedBuffer> | 33 RefPtr<PlatformSharedBuffer> |
31 SimplePlatformSupport::CreateSharedBufferFromHandle( | 34 SimplePlatformSupport::CreateSharedBufferFromHandle( |
32 size_t num_bytes, | 35 size_t num_bytes, |
33 ScopedPlatformHandle platform_handle) { | 36 ScopedPlatformHandle platform_handle) { |
34 return SimplePlatformSharedBuffer::CreateFromPlatformHandle( | 37 return SimplePlatformSharedBuffer::CreateFromPlatformHandle( |
35 num_bytes, platform_handle.Pass()); | 38 num_bytes, std::move(platform_handle)); |
36 } | 39 } |
37 | 40 |
38 } // namespace embedder | 41 } // namespace embedder |
39 } // namespace mojo | 42 } // namespace mojo |
OLD | NEW |