flutter_flutter/mojo/edk/embedder/platform_support.h
James Robinson 5bb2480bcd Update to Mojo 4e4d51ce28a8edcb32b9c7f555e38e2ae84a825e, update deps
This updates to mojo 4e4d51ce28a and mojo sdk 711a0bcfb141b4 and updates the sky
package's pubspec.yaml dependency to '>=0.1.0 <0.2.0' to be compatible with
the current mojo package. This includes an update to the Mojo Dart generator to
produce real classes for enums and the corresponding updates for users of the
KeyboardType enum in Sky as well as one scoped_ptr->std::unique_ptr in shell
corresponding to a change in the Mojo EDK.

When a new version of the sky and sky_services package are pushed this will fix
domokit/mojo#440.
2015-09-23 17:26:46 -07:00

61 lines
2.1 KiB
C++

// 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_PLATFORM_SUPPORT_H_
#define MOJO_EDK_EMBEDDER_PLATFORM_SUPPORT_H_
#include <stddef.h>
#include "mojo/edk/embedder/scoped_platform_handle.h"
#include "mojo/public/c/system/types.h"
#include "mojo/public/cpp/system/macros.h"
namespace mojo {
namespace embedder {
class PlatformSharedBuffer;
// This class is provided by the embedder to implement (typically
// platform-dependent) things needed by the Mojo system implementation.
// Implementations must be thread-safe.
class PlatformSupport {
public:
virtual ~PlatformSupport() {}
// Gets a "time-ticks" value:
// - The value should be nondecreasing with respect to time/causality.
// - The value should be in microseconds (i.e., if a caller runs
// continuously, getting the value twice, their difference should be
// approximately the real time elapsed between the samples, in
// microseconds).
// - The value should be nonnegative.
// - The behaviour of the value if execution is suspended (i.e., the
// computer "sleeps") is undefined (i.e., this is not a real-time clock),
// except that it must remain monotonic.
// - As observable, monotonicity should hold across threads.
// If multiple |PlatformSupport| implementations/instances are used in a
// single system, all implementations must agree (i.e., respect the above as
// if there were only a single |PlatformSupport|).
virtual MojoTimeTicks GetTimeTicksNow() = 0;
// Gets cryptographically-secure (pseudo)random bytes.
virtual void GetCryptoRandomBytes(void* bytes, size_t num_bytes) = 0;
virtual PlatformSharedBuffer* CreateSharedBuffer(size_t num_bytes) = 0;
virtual PlatformSharedBuffer* CreateSharedBufferFromHandle(
size_t num_bytes,
ScopedPlatformHandle platform_handle) = 0;
protected:
PlatformSupport() {}
private:
MOJO_DISALLOW_COPY_AND_ASSIGN(PlatformSupport);
};
} // namespace embedder
} // namespace mojo
#endif // MOJO_EDK_EMBEDDER_PLATFORM_SUPPORT_H_