1/* Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 * Use of this source code is governed by a BSD-style license that can be 3 * found in the LICENSE file. */ 4 5#ifndef PPAPI_SIMPLE_PS_H_ 6#define PPAPI_SIMPLE_PS_H_ 7 8#include "ppapi/c/pp_instance.h" 9#include "sdk_util/macros.h" 10 11EXTERN_C_BEGIN 12 13/** 14 * The ppapi_simple library simplifies the use of the Pepper interfaces by 15 * providing a more traditional 'C' or 'C++' style framework. The library 16 * creates an PSInstance derived object based on the ppapi_cpp library and 17 * initializes the nacl_io library to provide a POSIX friendly I/O environment. 18 * 19 * In order to provide a standard blocking environment, the library will hide 20 * the actual "Pepper Thread" which is the thread that standard events 21 * such as window resize, mouse keyboard, or other inputs arrive. To prevent 22 * blocking, instead we enqueue these events onto a thread safe linked list 23 * and expect them to be processed on a new thread. In addition, the library 24 * will automatically start a new thread on which can be used effectively 25 * as a "main" entry point. 26 * 27 * For C style development, the PPAPI_SIMPLE_REGISTER_MAIN(XX) macros provide a 28 * mechanism to register the entry an point for "main". All events are pushed 29 * onto an event queue which can then be pulled from this new thread. 30 * NOTE: The link will still need libstdc++ and libppapi_cpp since the library 31 * is still creating a C++ object which does the initialization work and 32 * forwards the events. 33 * 34 * For C++ style development, use the ppapi_simple_instance.h, 35 * ppapi_simple_instance_2d.h, and ppapi_simple_instance_3d.h headers as 36 * a base class, and overload the appropriate virtual functions such as 37 * Main, ChangeContext, or Render. 38 */ 39 40/** 41 * PSGetInstanceId 42 * 43 * Return the PP_Instance id of this instance of the module. This is required 44 * by most of the Pepper resource creation routines. 45 */ 46PP_Instance PSGetInstanceId(void); 47 48/** 49 * PSGetInterface 50 * 51 * Return the Pepper instance referred to by 'name'. Will return a pointer 52 * to the interface, or NULL if not found or not available. 53 */ 54const void* PSGetInterface(const char *name); 55 56/** 57 * PSUserCreateInstance 58 * 59 * Prototype for the user provided function which creates and configures 60 * the instance object. This function is defined by one of the macros below, 61 * or by the equivalent macro in one of the other headers. For 'C' 62 * development, one of the basic instances which support C callback are used. 63 * For C++, this function should instantiate the user defined instance. See 64 * the two macros below. 65 */ 66extern void* PSUserCreateInstance(PP_Instance inst); 67 68EXTERN_C_END 69 70#endif /* PPAPI_SIMPLE_PS_H_ */ 71