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 #ifndef PPAPI_C_PPB_CORE_H_ | 5 #ifndef PPAPI_C_PPB_CORE_H_ |
6 #define PPAPI_C_PPB_CORE_H_ | 6 #define PPAPI_C_PPB_CORE_H_ |
7 | 7 |
8 #include "ppapi/c/pp_bool.h" | 8 #include "ppapi/c/pp_bool.h" |
9 #include "ppapi/c/pp_resource.h" | 9 #include "ppapi/c/pp_resource.h" |
10 #include "ppapi/c/pp_stdint.h" | 10 #include "ppapi/c/pp_stdint.h" |
11 #include "ppapi/c/pp_time.h" | 11 #include "ppapi/c/pp_time.h" |
12 | 12 |
13 struct PP_CompletionCallback; | 13 struct PP_CompletionCallback; |
14 | 14 |
15 #define PPB_CORE_INTERFACE_0_5 "PPB_Core;0.5" | 15 #define PPB_CORE_INTERFACE_0_5 "PPB_Core;0.5" |
16 #define PPB_CORE_INTERFACE_0_6 "PPB_Core;0.6" | |
17 #ifdef PPAPI_INSTANCE_REMOVE_MEMALLOC | |
dmichael (off chromium)
2011/07/12 19:10:27
With Brett's change, we don't need the conditional
Matt Ball
2011/07/12 23:15:26
Done.
| |
18 #define PPB_CORE_INTERFACE PPB_CORE_INTERFACE_0_6 | |
19 #else | |
16 #define PPB_CORE_INTERFACE PPB_CORE_INTERFACE_0_5 | 20 #define PPB_CORE_INTERFACE PPB_CORE_INTERFACE_0_5 |
21 #endif | |
22 | |
17 | 23 |
18 /** | 24 /** |
19 * @file | 25 * @file |
20 * This file defines the <code>PPB_Core</code> interface defined by the browser | 26 * 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 | 27 * and containing pointers to functions related to memory management, time, and |
22 * threads. | 28 * threads. |
23 */ | 29 */ |
24 | 30 |
25 /** | 31 /** |
26 * @addtogroup Interfaces | 32 * @addtogroup Interfaces |
27 * @{ | 33 * @{ |
28 */ | 34 */ |
29 | 35 |
30 /** | 36 /** |
31 * The <code>PPB_Core</code> interface contains pointers to functions related | 37 * The <code>PPB_Core</code> interface contains pointers to functions related |
32 * to memory management, time, and threads on the browser. | 38 * to memory management, time, and threads on the browser. |
33 * | 39 * |
34 */ | 40 */ |
41 | |
42 #ifdef PPAPI_INSTANCE_REMOVE_MEMALLOC | |
35 struct PPB_Core { | 43 struct PPB_Core { |
44 #else | |
45 struct PPB_Core_0_6 { | |
46 #endif | |
36 /** | 47 /** |
37 * | 48 * |
38 * AddRefResource() adds a reference to a resource. | 49 * AddRefResource() adds a reference to a resource. |
39 * | 50 * |
40 * @param[in] config A <code>PP_Resource</code> containing the resource. | 51 * @param[in] config A <code>PP_Resource</code> containing the resource. |
41 */ | 52 */ |
42 void (*AddRefResource)(PP_Resource resource); | 53 void (*AddRefResource)(PP_Resource resource); |
43 | 54 |
44 /** | 55 /** |
45 * ReleaseResource() removes a reference from a resource. | 56 * ReleaseResource() removes a reference from a resource. |
(...skipping 11 matching lines...) Expand all Loading... | |
57 * allocation fails. | 68 * allocation fails. |
58 */ | 69 */ |
59 void* (*MemAlloc)(uint32_t num_bytes); | 70 void* (*MemAlloc)(uint32_t num_bytes); |
60 | 71 |
61 /** | 72 /** |
62 * <code>MemFree()</code> deallocates memory. | 73 * <code>MemFree()</code> deallocates memory. |
63 * | 74 * |
64 * @param[in] ptr A pointer to the memory to deallocate. It is safe to | 75 * @param[in] ptr A pointer to the memory to deallocate. It is safe to |
65 * pass <code>NULL</code> to this function. | 76 * pass <code>NULL</code> to this function. |
66 */ | 77 */ |
67 void (*MemFree)(void* ptr); | 78 void (*MemFree)(void* ptr); |
dmichael (off chromium)
2011/07/12 19:10:27
Of course you'll want to remove these here.
Matt Ball
2011/07/12 23:15:26
Done.
| |
68 | 79 |
69 /** | 80 /** |
70 * GetTime() returns the "wall clock time" according to the | 81 * GetTime() returns the "wall clock time" according to the |
71 * browser. | 82 * browser. |
72 * | 83 * |
73 * @return A <code>PP_Time</code> containing the "wall clock time" according | 84 * @return A <code>PP_Time</code> containing the "wall clock time" according |
74 * to the browser. | 85 * to the browser. |
75 */ | 86 */ |
76 PP_Time (*GetTime)(); | 87 PP_Time (*GetTime)(); |
77 | 88 |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
124 * thread. | 135 * thread. |
125 * | 136 * |
126 * This function is useful for implementing sanity checks, and deciding if | 137 * This function is useful for implementing sanity checks, and deciding if |
127 * dispatching using CallOnMainThread() is required. | 138 * dispatching using CallOnMainThread() is required. |
128 * | 139 * |
129 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the | 140 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the |
130 * current thread is the main pepper thread, otherwise <code>PP_FALSE</code>. | 141 * current thread is the main pepper thread, otherwise <code>PP_FALSE</code>. |
131 */ | 142 */ |
132 PP_Bool (*IsMainThread)(); | 143 PP_Bool (*IsMainThread)(); |
133 }; | 144 }; |
145 | |
146 #ifdef PPAPI_INSTANCE_REMOVE_MEMALLOC | |
147 struct PPB_Core_0_5 { | |
148 #else | |
149 struct PPB_Core { | |
150 #endif | |
151 void (*AddRefResource)(PP_Resource resource); | |
152 void (*ReleaseResource)(PP_Resource resource); | |
153 void* (*MemAlloc)(uint32_t num_bytes); | |
154 void (*MemFree)(void* ptr); | |
155 PP_Time (*GetTime)(); | |
156 PP_TimeTicks (*GetTimeTicks)(); | |
157 void (*CallOnMainThread)(int32_t delay_in_milliseconds, | |
158 struct PP_CompletionCallback callback, | |
159 int32_t result); | |
160 PP_Bool (*IsMainThread)(); | |
161 }; | |
162 | |
163 #ifdef PPAPI_INSTANCE_REMOVE_MEMALLOC | |
164 typedef struct PPB_Core PPB_Core_0_6; | |
165 #else | |
166 typedef struct PPB_Core PPB_Core_0_5; | |
167 #endif | |
168 | |
169 | |
134 /** | 170 /** |
135 * @} | 171 * @} |
136 */ | 172 */ |
137 | 173 |
138 | 174 |
139 #endif /* PPAPI_C_PPB_CORE_H_ */ | 175 #endif /* PPAPI_C_PPB_CORE_H_ */ |
OLD | NEW |