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 #ifndef MOJO_EDK_EMBEDDER_SIMPLE_PLATFORM_SUPPORT_H_ | 5 #ifndef MOJO_EDK_EMBEDDER_SIMPLE_PLATFORM_SUPPORT_H_ |
6 #define MOJO_EDK_EMBEDDER_SIMPLE_PLATFORM_SUPPORT_H_ | 6 #define MOJO_EDK_EMBEDDER_SIMPLE_PLATFORM_SUPPORT_H_ |
7 | 7 |
8 #include "mojo/edk/embedder/platform_support.h" | 8 #include "mojo/edk/embedder/platform_support.h" |
9 #include "mojo/edk/system/system_impl_export.h" | |
10 #include "mojo/public/cpp/system/macros.h" | 9 #include "mojo/public/cpp/system/macros.h" |
11 | 10 |
12 namespace mojo { | 11 namespace mojo { |
13 namespace embedder { | 12 namespace embedder { |
14 | 13 |
15 // A simple implementation of |PlatformSupport|, when sandboxing and | 14 // A simple implementation of |PlatformSupport|, when sandboxing and |
16 // multiprocess support are not issues (e.g., in most tests). Note: This class | 15 // multiprocess support are not issues (e.g., in most tests). Note: This class |
17 // has no state, and different instances of |SimplePlatformSupport| are mutually | 16 // has no state, and different instances of |SimplePlatformSupport| are mutually |
18 // compatible (i.e., you don't need to use a single instance of it everywhere -- | 17 // compatible (i.e., you don't need to use a single instance of it everywhere -- |
19 // you may simply create one whenever/wherever you need it). | 18 // you may simply create one whenever/wherever you need it). |
20 class MOJO_SYSTEM_IMPL_EXPORT SimplePlatformSupport final | 19 class SimplePlatformSupport final : public PlatformSupport { |
21 : public PlatformSupport { | |
22 public: | 20 public: |
23 SimplePlatformSupport() {} | 21 SimplePlatformSupport() {} |
24 ~SimplePlatformSupport() override {} | 22 ~SimplePlatformSupport() override {} |
25 | 23 |
26 MojoTimeTicks GetTimeTicksNow() override; | 24 MojoTimeTicks GetTimeTicksNow() override; |
27 void GetCryptoRandomBytes(void* bytes, size_t num_bytes) override; | 25 void GetCryptoRandomBytes(void* bytes, size_t num_bytes) override; |
28 PlatformSharedBuffer* CreateSharedBuffer(size_t num_bytes) override; | 26 PlatformSharedBuffer* CreateSharedBuffer(size_t num_bytes) override; |
29 PlatformSharedBuffer* CreateSharedBufferFromHandle( | 27 PlatformSharedBuffer* CreateSharedBufferFromHandle( |
30 size_t num_bytes, | 28 size_t num_bytes, |
31 ScopedPlatformHandle platform_handle) override; | 29 ScopedPlatformHandle platform_handle) override; |
32 | 30 |
33 private: | 31 private: |
34 MOJO_DISALLOW_COPY_AND_ASSIGN(SimplePlatformSupport); | 32 MOJO_DISALLOW_COPY_AND_ASSIGN(SimplePlatformSupport); |
35 }; | 33 }; |
36 | 34 |
37 } // namespace embedder | 35 } // namespace embedder |
38 } // namespace mojo | 36 } // namespace mojo |
39 | 37 |
40 #endif // MOJO_EDK_EMBEDDER_SIMPLE_PLATFORM_SUPPORT_H_ | 38 #endif // MOJO_EDK_EMBEDDER_SIMPLE_PLATFORM_SUPPORT_H_ |
OLD | NEW |