summaryrefslogtreecommitdiffstats
path: root/mojo/edk/embedder/simple_platform_support.h
blob: ef97d91dd4983aeb5421c638e6424c4c1fac362b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef MOJO_EDK_EMBEDDER_SIMPLE_PLATFORM_SUPPORT_H_
#define MOJO_EDK_EMBEDDER_SIMPLE_PLATFORM_SUPPORT_H_

#include "mojo/edk/embedder/platform_support.h"
#include "mojo/edk/system/system_impl_export.h"
#include "mojo/public/cpp/system/macros.h"

namespace mojo {
namespace edk {

// A simple implementation of |PlatformSupport|, when sandboxing and
// multiprocess support are not issues (e.g., in most tests). Note: This class
// has no state, and different instances of |SimplePlatformSupport| are mutually
// compatible (i.e., you don't need to use a single instance of it everywhere --
// you may simply create one whenever/wherever you need it).
class MOJO_SYSTEM_IMPL_EXPORT SimplePlatformSupport final
    : public PlatformSupport {
 public:
  SimplePlatformSupport() {}
  ~SimplePlatformSupport() override {}

  void GetCryptoRandomBytes(void* bytes, size_t num_bytes) override;
  PlatformSharedBuffer* CreateSharedBuffer(size_t num_bytes) override;
  PlatformSharedBuffer* CreateSharedBufferFromHandle(
      size_t num_bytes,
      ScopedPlatformHandle platform_handle) override;

 private:
  MOJO_DISALLOW_COPY_AND_ASSIGN(SimplePlatformSupport);
};

}  // namespace edk
}  // namespace mojo

#endif  // MOJO_EDK_EMBEDDER_SIMPLE_PLATFORM_SUPPORT_H_