| OLD | NEW |
| 1 /* Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2011 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 |
| 6 /* From ppb_core.idl modified Mon Jul 18 12:14:19 2011. */ |
| 7 |
| 5 #ifndef PPAPI_C_PPB_CORE_H_ | 8 #ifndef PPAPI_C_PPB_CORE_H_ |
| 6 #define PPAPI_C_PPB_CORE_H_ | 9 #define PPAPI_C_PPB_CORE_H_ |
| 7 | 10 |
| 8 #include "ppapi/c/pp_bool.h" | 11 #include "ppapi/c/pp_bool.h" |
| 12 #include "ppapi/c/pp_completion_callback.h" |
| 13 #include "ppapi/c/pp_macros.h" |
| 9 #include "ppapi/c/pp_resource.h" | 14 #include "ppapi/c/pp_resource.h" |
| 10 #include "ppapi/c/pp_stdint.h" | 15 #include "ppapi/c/pp_stdint.h" |
| 11 #include "ppapi/c/pp_time.h" | 16 #include "ppapi/c/pp_time.h" |
| 12 | 17 |
| 13 struct PP_CompletionCallback; | |
| 14 | |
| 15 #define PPB_CORE_INTERFACE_1_0 "PPB_Core;1.0" | |
| 16 #define PPB_CORE_INTERFACE PPB_CORE_INTERFACE_1_0 | |
| 17 | |
| 18 /** | 18 /** |
| 19 * @file | 19 * @file |
| 20 * This file defines the <code>PPB_Core</code> interface defined by the browser | 20 * This file defines the <code>PPB_Core</code> interface defined by the browser |
| 21 * and containing pointers to functions related to memory management, time, and | 21 * and containing pointers to functions related to memory management, time, and |
| 22 * threads. | 22 * threads. |
| 23 */ | 23 */ |
| 24 | 24 |
| 25 |
| 25 /** | 26 /** |
| 26 * @addtogroup Interfaces | 27 * @addtogroup Interfaces |
| 27 * @{ | 28 * @{ |
| 28 */ | 29 */ |
| 29 | |
| 30 /** | 30 /** |
| 31 * The <code>PPB_Core</code> interface contains pointers to functions related | 31 * The <code>PPB_Core</code> interface contains pointers to functions related |
| 32 * to memory management, time, and threads on the browser. | 32 * to memory management, time, and threads on the browser. |
| 33 * | 33 * |
| 34 */ | 34 */ |
| 35 #define PPB_CORE_INTERFACE_1_0 "PPB_Core;1.0" |
| 36 #define PPB_CORE_INTERFACE PPB_CORE_INTERFACE_1_0 |
| 37 |
| 35 struct PPB_Core { | 38 struct PPB_Core { |
| 36 /** | 39 /** |
| 37 * | 40 * |
| 38 * AddRefResource() adds a reference to a resource. | 41 * AddRefResource() adds a reference to a resource. |
| 39 * | 42 * |
| 40 * @param[in] config A <code>PP_Resource</code> containing the resource. | 43 * @param[in] config A <code>PP_Resource</code> containing the resource. |
| 41 */ | 44 */ |
| 42 void (*AddRefResource)(PP_Resource resource); | 45 void (*AddRefResource)(PP_Resource resource); |
| 43 | |
| 44 /** | 46 /** |
| 45 * ReleaseResource() removes a reference from a resource. | 47 * ReleaseResource() removes a reference from a resource. |
| 46 * | 48 * |
| 47 * @param[in] config A <code>PP_Resource</code> containing the resource. | 49 * @param[in] config A <code>PP_Resource</code> containing the resource. |
| 48 */ | 50 */ |
| 49 void (*ReleaseResource)(PP_Resource resource); | 51 void (*ReleaseResource)(PP_Resource resource); |
| 50 | |
| 51 /** | 52 /** |
| 52 * GetTime() returns the "wall clock time" according to the | 53 * GetTime() returns the "wall clock time" according to the |
| 53 * browser. | 54 * browser. |
| 54 * | 55 * |
| 55 * @return A <code>PP_Time</code> containing the "wall clock time" according | 56 * @return A <code>PP_Time</code> containing the "wall clock time" according |
| 56 * to the browser. | 57 * to the browser. |
| 57 */ | 58 */ |
| 58 PP_Time (*GetTime)(); | 59 PP_Time (*GetTime)(); |
| 59 | |
| 60 /** | 60 /** |
| 61 * GetTimeTicks() returns the "tick time" according to the browser. | 61 * GetTimeTicks() returns the "tick time" according to the browser. |
| 62 * This clock is used by the browser when passing some event times to the | 62 * This clock is used by the browser when passing some event times to the |
| 63 * module (e.g. using the <code>PP_InputEvent::time_stamp_seconds</code> | 63 * module (e.g. using the <code>PP_InputEvent::time_stamp_seconds</code> |
| 64 * field). It is not correlated to any actual wall clock time | 64 * field). It is not correlated to any actual wall clock time |
| 65 * (like GetTime()). Because of this, it will not run change if the user | 65 * (like GetTime()). Because of this, it will not run change if the user |
| 66 * changes their computer clock. | 66 * changes their computer clock. |
| 67 * | 67 * |
| 68 * @return A <code>PP_TimeTicks</code> containing the "tick time" according | 68 * @return A <code>PP_TimeTicks</code> containing the "tick time" according |
| 69 * to the browser. | 69 * to the browser. |
| 70 */ | 70 */ |
| 71 | 71 /* TODO(brettw) http://code.google.com/p/chromium/issues/detail?id=57448 |
| 72 // TODO(brettw) http://code.google.com/p/chromium/issues/detail?id=57448 | 72 * This currently does change with wall clock time, but will be fixed in |
| 73 // This currently does change with wall clock time, but will be fixed in | 73 * a future release. */ |
| 74 // a future release. | |
| 75 PP_TimeTicks (*GetTimeTicks)(); | 74 PP_TimeTicks (*GetTimeTicks)(); |
| 76 | |
| 77 /** | 75 /** |
| 78 * CallOnMainThread() schedules work to be executed on the main module thread | 76 * CallOnMainThread() schedules work to be executed on the main module thread |
| 79 * after the specified delay. The delay may be 0 to specify a call back as | 77 * after the specified delay. The delay may be 0 to specify a call back as |
| 80 * soon as possible. | 78 * soon as possible. |
| 81 * | 79 * |
| 82 * The <code>result</code> parameter will just be passed as the second | 80 * The <code>result</code> parameter will just be passed as the second |
| 83 * argument to the callback. Many applications won't need this, but it allows | 81 * argument to the callback. Many applications won't need this, but it allows |
| 84 * a module to emulate calls of some callbacks which do use this value. | 82 * a module to emulate calls of some callbacks which do use this value. |
| 85 * | 83 * |
| 86 * <strong>Note:</strong> CallOnMainThread, even when used from the main | 84 * <strong>Note:</strong> CallOnMainThread, even when used from the main |
| 87 * thread with a delay of 0 milliseconds, will never directly invoke the | 85 * thread with a delay of 0 milliseconds, will never directly invoke the |
| 88 * callback. Even in this case, the callback will be scheduled | 86 * callback. Even in this case, the callback will be scheduled |
| 89 * asynchronously. | 87 * asynchronously. |
| 90 * | 88 * |
| 91 * <strong>Note:</strong> If the browser is shutting down or if the module | 89 * <strong>Note:</strong> If the browser is shutting down or if the module |
| 92 * has no instances, then the callback function may not be called. | 90 * has no instances, then the callback function may not be called. |
| 93 * | 91 * |
| 94 * @param[in] delay_in_milliseconds An int32_t delay in milliseconds. | 92 * @param[in] delay_in_milliseconds An int32_t delay in milliseconds. |
| 95 * @param[in] callback A <code>PP_CompletionCallback</code> callback function | 93 * @param[in] callback A <code>PP_CompletionCallback</code> callback function |
| 96 * that the browser will call after the specified delay. | 94 * that the browser will call after the specified delay. |
| 97 * @param[in] result An int32_t that the browser will pass to the given | 95 * @param[in] result An int32_t that the browser will pass to the given |
| 98 * <code>PP_CompletionCallback</code>. | 96 * <code>PP_CompletionCallback</code>. |
| 99 */ | 97 */ |
| 100 void (*CallOnMainThread)(int32_t delay_in_milliseconds, | 98 void (*CallOnMainThread)(int32_t delay_in_milliseconds, |
| 101 struct PP_CompletionCallback callback, | 99 struct PP_CompletionCallback callback, |
| 102 int32_t result); | 100 int32_t result); |
| 103 | |
| 104 /** | 101 /** |
| 105 * IsMainThread() returns true if the current thread is the main pepper | 102 * IsMainThread() returns true if the current thread is the main pepper |
| 106 * thread. | 103 * thread. |
| 107 * | 104 * |
| 108 * This function is useful for implementing sanity checks, and deciding if | 105 * This function is useful for implementing sanity checks, and deciding if |
| 109 * dispatching using CallOnMainThread() is required. | 106 * dispatching using CallOnMainThread() is required. |
| 110 * | 107 * |
| 111 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the | 108 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the |
| 112 * current thread is the main pepper thread, otherwise <code>PP_FALSE</code>. | 109 * current thread is the main pepper thread, otherwise <code>PP_FALSE</code>. |
| 113 */ | 110 */ |
| 114 PP_Bool (*IsMainThread)(); | 111 PP_Bool (*IsMainThread)(); |
| 115 }; | 112 }; |
| 116 /** | 113 /** |
| 117 * @} | 114 * @} |
| 118 */ | 115 */ |
| 119 | 116 |
| 117 #endif /* PPAPI_C_PPB_CORE_H_ */ |
| 120 | 118 |
| 121 #endif /* PPAPI_C_PPB_CORE_H_ */ | |
| OLD | NEW |