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/public/cpp/system/macros.h" | 9 #include "mojo/public/cpp/system/macros.h" |
10 | 10 |
11 namespace mojo { | 11 namespace mojo { |
12 namespace embedder { | 12 namespace embedder { |
13 | 13 |
14 // A simple implementation of |PlatformSupport|, when sandboxing and | 14 // A simple implementation of |PlatformSupport|, when sandboxing and |
15 // 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 |
16 // has no state, and different instances of |SimplePlatformSupport| are mutually | 16 // has no state, and different instances of |SimplePlatformSupport| are mutually |
17 // 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 -- |
18 // you may simply create one whenever/wherever you need it). | 18 // you may simply create one whenever/wherever you need it). |
19 class SimplePlatformSupport final : public PlatformSupport { | 19 class SimplePlatformSupport final : public PlatformSupport { |
20 public: | 20 public: |
21 SimplePlatformSupport() {} | 21 SimplePlatformSupport() {} |
22 ~SimplePlatformSupport() override {} | 22 ~SimplePlatformSupport() override {} |
23 | 23 |
24 MojoTimeTicks GetTimeTicksNow() override; | 24 MojoTimeTicks GetTimeTicksNow() override; |
25 void GetCryptoRandomBytes(void* bytes, size_t num_bytes) override; | 25 void GetCryptoRandomBytes(void* bytes, size_t num_bytes) override; |
26 util::RefPtr<PlatformSharedBuffer> CreateSharedBuffer( | 26 util::RefPtr<PlatformSharedBuffer> CreateSharedBuffer( |
27 size_t num_bytes) override; | 27 size_t num_bytes) override; |
28 util::RefPtr<PlatformSharedBuffer> CreateSharedBufferFromHandle( | 28 util::RefPtr<PlatformSharedBuffer> CreateSharedBufferFromHandle( |
29 size_t num_bytes, | 29 size_t num_bytes, |
30 ScopedPlatformHandle platform_handle) override; | 30 platform::ScopedPlatformHandle platform_handle) override; |
31 | 31 |
32 private: | 32 private: |
33 MOJO_DISALLOW_COPY_AND_ASSIGN(SimplePlatformSupport); | 33 MOJO_DISALLOW_COPY_AND_ASSIGN(SimplePlatformSupport); |
34 }; | 34 }; |
35 | 35 |
36 } // namespace embedder | 36 } // namespace embedder |
37 } // namespace mojo | 37 } // namespace mojo |
38 | 38 |
39 #endif // MOJO_EDK_EMBEDDER_SIMPLE_PLATFORM_SUPPORT_H_ | 39 #endif // MOJO_EDK_EMBEDDER_SIMPLE_PLATFORM_SUPPORT_H_ |
OLD | NEW |