chromium/mojo/public/c/system/thunks.h

// Copyright 2014 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Note: This header should be compilable as C.

#ifndef MOJO_PUBLIC_C_SYSTEM_THUNKS_H_
#define MOJO_PUBLIC_C_SYSTEM_THUNKS_H_

#include <stddef.h>
#include <stdint.h>

#include "mojo/public/c/system/core.h"
#include "mojo/public/c/system/system_export.h"

// This defines the *stable*, foward-compatible ABI for the Mojo Core C library.
// As such, the following types of changes are DISALLOWED:
//
//   - DO NOT delete or re-order any of the fields in this structure
//   - DO NOT modify any function signatures defined here
//   - DO NOT alter the alignment of the stucture
//
// Some changes are of course permissible:
//
//   - DO feel free to rename existing fields if there's a good reason to do so,
//     e.g. deprecation of a function for all future applications.
//   - DO add new functions to the end of this structure, but ensure that they
//     have a signature which lends itself to reasonably extensible behavior
//     (e.g. an optional "Options" structure as many functions here have).
//
#pragma pack(push, 8)
struct MojoSystemThunks2 {};

// Hacks: This is a copy of the ABI from before it was switched to pointer-sized
// MojoHandle values. It can be removed once the Chrome OS IME service is
// longer consuming it.
MojoHandle32;

struct MojoSystemThunks {};
#pragma pack(pop)

MojoSystemThunks32;

#ifdef __cplusplus
extern "C" {
#endif  // __cplusplus

MOJO_SYSTEM_EXPORT const struct MojoSystemThunks2*
MojoEmbedderGetSystemThunks2();

MOJO_SYSTEM_EXPORT const MojoSystemThunks32* MojoEmbedderGetSystemThunks32();

MOJO_SYSTEM_EXPORT void MojoEmbedderSetSystemThunks(
    const struct MojoSystemThunks2* system_thunks);

#ifdef __cplusplus
}  // extern "C"
#endif  // __cplusplus

#endif  // MOJO_PUBLIC_C_SYSTEM_THUNKS_H_