Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(73)

Side by Side Diff: ppapi/c/ppb_core.h

Issue 7282015: Misc. changes. Mostly formatting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 #include "ppapi/c/pp_var.h" 12 #include "ppapi/c/pp_var.h"
13 13
14 struct PP_CompletionCallback; 14 struct PP_CompletionCallback;
15 15
16 #define PPB_CORE_INTERFACE_0_5 "PPB_Core;0.5" 16 #define PPB_CORE_INTERFACE_0_5 "PPB_Core;0.5"
17 #define PPB_CORE_INTERFACE PPB_CORE_INTERFACE_0_5 17 #define PPB_CORE_INTERFACE PPB_CORE_INTERFACE_0_5
18 18
19 /** 19 /**
20 * @file 20 * @file
21 * This file defines the PPB_Core interface defined by the browser and 21 * This file defines the <code>PPB_Core</code> interface defined by the browser
22 * and containing pointers to functions related to memory management, 22 * and containing pointers to functions related to memory management, time, and
23 * time, and threads. 23 * threads.
24 */ 24 */
25 25
26 /** 26 /**
27 * @addtogroup Interfaces 27 * @addtogroup Interfaces
28 * @{ 28 * @{
29 */ 29 */
30 30
31 /** 31 /**
32 * The PPB_Core interface contains pointers to functions related to memory 32 * The <code>PPB_Core</code> interface contains pointers to functions related
33 * management, time, and threads on the browser. 33 * to memory management, time, and threads on the browser.
34 * 34 *
35 */ 35 */
36 struct PPB_Core { 36 struct PPB_Core {
37 /** 37 /**
38 * Same as AddRefVar for Resources.
39 * AddRefResource is a pointer to a function that adds a reference to
40 * a resource.
41 * 38 *
42 * @param[in] config A PP_Resource containing the resource. 39 * AddRefResource() adds a reference to a resource.
40 *
41 * @param[in] config A <code>PP_Resource</code> containing the resource.
43 */ 42 */
44 void (*AddRefResource)(PP_Resource resource); 43 void (*AddRefResource)(PP_Resource resource);
45 44
46 /** 45 /**
47 * ReleaseResource is a pointer to a function that removes a reference 46 * ReleaseResource() removes a reference from a resource. This
48 * from a resource. 47 * function is similar to <code>ReleaseVar</code> for Resources.
dmichael (off chromium) 2011/07/05 15:58:19 Please remove the second sentence here, too.
jond 2011/07/05 17:09:23 Done.
49 * 48 *
50 * @param[in] config A PP_Resource containing the resource. 49 * @param[in] config A <code>PP_Resource</code> containing the resource.
51 */ 50 */
52 /*Same as ReleaseVar for Resources. */
53 void (*ReleaseResource)(PP_Resource resource); 51 void (*ReleaseResource)(PP_Resource resource);
54 52
55 /** 53 /**
56 * MemAlloc is a pointer to a function that allocate memory. 54 * MemAlloc() allocates memory.
57 * 55 *
58 * @param[in] num_bytes A number of bytes to allocate. 56 * @param[in] num_bytes A number of bytes to allocate.
59 * @return A pointer to the memory if successful, NULL If the 57 *
58 * @return A pointer to the memory if successful, <code>NULL</code> If the
60 * allocation fails. 59 * allocation fails.
61 */ 60 */
62 void* (*MemAlloc)(uint32_t num_bytes); 61 void* (*MemAlloc)(uint32_t num_bytes);
63 62
64 /** 63 /**
65 * MemFree is a pointer to a function that deallocates memory. 64 * <code>MemFree()</code> deallocates memory.
66 * 65 *
67 * @param[in] ptr A pointer to the memory to deallocate. It is safe to 66 * @param[in] ptr A pointer to the memory to deallocate. It is safe to
68 * pass NULL to this function. 67 * pass <code>NULL</code> to this function.
69 */ 68 */
70 void (*MemFree)(void* ptr); 69 void (*MemFree)(void* ptr);
71 70
72 /** 71 /**
73 * GetTime is a pointer to a function that returns the "wall clock 72 * GetTime() returns the "wall clock time" according to the
74 * time" according to the browser. 73 * browser.
75 * 74 *
76 * @return A PP_Time containing the "wall clock time" according to the 75 * @return A <code>PP_Time</code> containing the "wall clock time" according
77 * browser. 76 * to the browser.
78 */ 77 */
79 PP_Time (*GetTime)(); 78 PP_Time (*GetTime)();
80 79
81 /** 80 /**
82 * GetTimeTicks is a pointer to a function that returns the "tick time" 81 * GetTimeTicks() returns the "tick time" according to the browser.
83 * according to the browser. This clock is used by the browser when passing 82 * This clock is used by the browser when passing some event times to the
84 * some event times to the plugin (e.g., via the 83 * module (e.g. using the <code>PP_InputEvent::time_stamp_seconds</code>
85 * PP_InputEvent::time_stamp_seconds field). It is not correlated to any 84 * field). It is not correlated to any actual wall clock time
86 * actual wall clock time (like GetTime()). Because of this, it will not run 85 * (like GetTime()). Because of this, it will not run change if the user
87 * change if the user changes their computer clock. 86 * changes their computer clock.
88 * 87 *
89 * @return A PP_TimeTicks containing the "tick time" according to the 88 * @return A <code>PP_TimeTicks</code> containing the "tick time" according
90 * browser. 89 * to the browser.
91 */ 90 */
92 91
93 // TODO(brettw) http://code.google.com/p/chromium/issues/detail?id=57448 92 // TODO(brettw) http://code.google.com/p/chromium/issues/detail?id=57448
94 // This currently does change with wall clock time, but will be fixed in 93 // This currently does change with wall clock time, but will be fixed in
95 // a future release. 94 // a future release.
96 PP_TimeTicks (*GetTimeTicks)(); 95 PP_TimeTicks (*GetTimeTicks)();
97 96
98 /** 97 /**
99 * CallOnMainThread is a pointer to a function that schedules work to be 98 * CallOnMainThread() schedules work to be executed on the main module thread
100 * executed on the main module thread after the specified delay. The delay 99 * after the specified delay. The delay may be 0 to specify a call back as
101 * may be 0 to specify a call back as soon as possible. 100 * soon as possible.
102 * 101 *
103 * The |result| parameter will just be passed as the second argument to the 102 * The <code>result</code> parameter will just be passed as the second
104 * callback. Many applications won't need this, but it allows a plugin to 103 * argument to the callback. Many applications won't need this, but it allows
105 * emulate calls of some callbacks which do use this value. 104 * a module to emulate calls of some callbacks which do use this value.
106 * 105 *
107 * NOTE: CallOnMainThread, even when used from the main thread with a delay 106 * <strong>Note:</strong> CallOnMainThread, even when used from the main
108 * of 0 milliseconds, will never directly invoke the callback. Even in this 107 * thread with a delay of 0 milliseconds, will never directly invoke the
109 * case, the callback will be scheduled asynchronously. 108 * callback. Even in this case, the callback will be scheduled
109 * asynchronously.
110 * 110 *
111 * NOTE: If the browser is shutting down or if the plugin has no instances, 111 * <strong>Note:</strong> If the browser is shutting down or if the module
112 * then the callback function may not be called. 112 * has no instances, then the callback function may not be called.
113 * 113 *
114 * @param[in] delay_in_milliseconds An int32_t delay in milliseconds. 114 * @param[in] delay_in_milliseconds An int32_t delay in milliseconds.
115 * @param[in] callback A PP_CompletionCallback callback function that the 115 * @param[in] callback A <code>PP_CompletionCallback</code> callback function
116 * browser will call after the specified delay. 116 * that the browser will call after the specified delay.
117 * @param[in] result An int32_t that the browser will pass to the given 117 * @param[in] result An int32_t that the browser will pass to the given
118 * PP_CompletionCallback. 118 * <code>PP_CompletionCallback</code>.
119 */ 119 */
120 void (*CallOnMainThread)(int32_t delay_in_milliseconds, 120 void (*CallOnMainThread)(int32_t delay_in_milliseconds,
121 struct PP_CompletionCallback callback, 121 struct PP_CompletionCallback callback,
122 int32_t result); 122 int32_t result);
123 123
124 /** 124 /**
125 * IsMainThread is a pointer to a function that returns true if the 125 * IsMainThread() returns true if the current thread is the main pepper
126 * current thread is the main pepper thread. 126 * thread.
127 * 127 *
128 * This function is useful for implementing sanity checks, and deciding if 128 * This function is useful for implementing sanity checks, and deciding if
129 * dispatching using CallOnMainThread() is required. 129 * dispatching using CallOnMainThread() is required.
130 * 130 *
131 * @return A PP_BOOL containing PP_TRUE if the current thread is the main 131 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the
132 * pepper thread, otherwise PP_FALSE. 132 * current thread is the main pepper thread, otherwise <code>PP_FALSE</code>.
133 */ 133 */
134 PP_Bool (*IsMainThread)(); 134 PP_Bool (*IsMainThread)();
135 }; 135 };
136 /** 136 /**
137 * @} 137 * @}
138 */ 138 */
139 139
140 140
141 #endif /* PPAPI_C_DEV_PPB_CORE_DEV_H_ */ 141 #endif /* PPAPI_C_DEV_PPB_CORE_DEV_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698