Fix race condition in WebstoreInstallHelper.
[chromium-blink-merge.git] / ppapi / c / ppb_core.h
blob135f85787fda707cfc2c9f670c7a4b40dccae58e
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 */
6 /* From ppb_core.idl modified Mon Mar 19 12:02:10 2012. */
8 #ifndef PPAPI_C_PPB_CORE_H_
9 #define PPAPI_C_PPB_CORE_H_
11 #include "ppapi/c/pp_bool.h"
12 #include "ppapi/c/pp_completion_callback.h"
13 #include "ppapi/c/pp_macros.h"
14 #include "ppapi/c/pp_resource.h"
15 #include "ppapi/c/pp_stdint.h"
16 #include "ppapi/c/pp_time.h"
18 #define PPB_CORE_INTERFACE_1_0 "PPB_Core;1.0"
19 #define PPB_CORE_INTERFACE PPB_CORE_INTERFACE_1_0
21 /**
22 * @file
23 * This file defines the <code>PPB_Core</code> interface defined by the browser
24 * and containing pointers to functions related to memory management, time, and
25 * threads.
29 /**
30 * @addtogroup Interfaces
31 * @{
33 /**
34 * The <code>PPB_Core</code> interface contains pointers to functions related
35 * to memory management, time, and threads on the browser.
38 struct PPB_Core_1_0 {
39 /**
41 * AddRefResource() adds a reference to a resource.
43 * @param[in] config A <code>PP_Resource</code> corresponding to a
44 * resource.
46 void (*AddRefResource)(PP_Resource resource);
47 /**
48 * ReleaseResource() removes a reference from a resource.
50 * @param[in] config A <code>PP_Resource</code> corresponding to a
51 * resource.
53 void (*ReleaseResource)(PP_Resource resource);
54 /**
55 * GetTime() returns the "wall clock time" according to the
56 * browser.
58 * @return A <code>PP_Time</code> containing the "wall clock time" according
59 * to the browser.
61 PP_Time (*GetTime)(void);
62 /**
63 * GetTimeTicks() returns the "tick time" according to the browser.
64 * This clock is used by the browser when passing some event times to the
65 * module (e.g. using the <code>PP_InputEvent::time_stamp_seconds</code>
66 * field). It is not correlated to any actual wall clock time
67 * (like GetTime()). Because of this, it will not run change if the user
68 * changes their computer clock.
70 * @return A <code>PP_TimeTicks</code> containing the "tick time" according
71 * to the browser.
73 PP_TimeTicks (*GetTimeTicks)(void);
74 /**
75 * CallOnMainThread() schedules work to be executed on the main module thread
76 * after the specified delay. The delay may be 0 to specify a call back as
77 * soon as possible.
79 * The <code>result</code> parameter will just be passed as the second
80 * argument to the callback. Many applications won't need this, but it allows
81 * a module to emulate calls of some callbacks which do use this value.
83 * <strong>Note:</strong> CallOnMainThread, even when used from the main
84 * thread with a delay of 0 milliseconds, will never directly invoke the
85 * callback. Even in this case, the callback will be scheduled
86 * asynchronously.
88 * <strong>Note:</strong> If the browser is shutting down or if the module
89 * has no instances, then the callback function may not be called.
91 * @param[in] delay_in_milliseconds An int32_t delay in milliseconds.
92 * @param[in] callback A <code>PP_CompletionCallback</code> callback function
93 * that the browser will call after the specified delay.
94 * @param[in] result An int32_t that the browser will pass to the given
95 * <code>PP_CompletionCallback</code>.
97 void (*CallOnMainThread)(int32_t delay_in_milliseconds,
98 struct PP_CompletionCallback callback,
99 int32_t result);
101 * IsMainThread() returns true if the current thread is the main pepper
102 * thread.
104 * This function is useful for implementing sanity checks, and deciding if
105 * dispatching using CallOnMainThread() is required.
107 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the
108 * current thread is the main pepper thread, otherwise <code>PP_FALSE</code>.
110 PP_Bool (*IsMainThread)(void);
113 typedef struct PPB_Core_1_0 PPB_Core;
115 * @}
118 #endif /* PPAPI_C_PPB_CORE_H_ */