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

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.
48 * from a resource.
49 * 47 *
50 * @param[in] config A PP_Resource containing the resource. 48 * @param[in] config A <code>PP_Resource</code> containing the resource.
51 */ 49 */
52 /*Same as ReleaseVar for Resources. */
53 void (*ReleaseResource)(PP_Resource resource); 50 void (*ReleaseResource)(PP_Resource resource);
54 51
55 /** 52 /**
56 * MemAlloc is a pointer to a function that allocate memory. 53 * MemAlloc() allocates memory.
57 * 54 *
58 * @param[in] num_bytes A number of bytes to allocate. 55 * @param[in] num_bytes A number of bytes to allocate.
59 * @return A pointer to the memory if successful, NULL If the 56 *
57 * @return A pointer to the memory if successful, <code>NULL</code> If the
60 * allocation fails. 58 * allocation fails.
61 */ 59 */
62 void* (*MemAlloc)(uint32_t num_bytes); 60 void* (*MemAlloc)(uint32_t num_bytes);
63 61
64 /** 62 /**
65 * MemFree is a pointer to a function that deallocates memory. 63 * <code>MemFree()</code> deallocates memory.
66 * 64 *
67 * @param[in] ptr A pointer to the memory to deallocate. It is safe to 65 * @param[in] ptr A pointer to the memory to deallocate. It is safe to
68 * pass NULL to this function. 66 * pass <code>NULL</code> to this function.
69 */ 67 */
70 void (*MemFree)(void* ptr); 68 void (*MemFree)(void* ptr);
71 69
72 /** 70 /**
73 * GetTime is a pointer to a function that returns the "wall clock 71 * GetTime() returns the "wall clock time" according to the
74 * time" according to the browser. 72 * browser.
75 * 73 *
76 * @return A PP_Time containing the "wall clock time" according to the 74 * @return A <code>PP_Time</code> containing the "wall clock time" according
77 * browser. 75 * to the browser.
78 */ 76 */
79 PP_Time (*GetTime)(); 77 PP_Time (*GetTime)();
80 78
81 /** 79 /**
82 * GetTimeTicks is a pointer to a function that returns the "tick time" 80 * GetTimeTicks() returns the "tick time" according to the browser.
83 * according to the browser. This clock is used by the browser when passing 81 * 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 82 * 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 83 * 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 84 * (like GetTime()). Because of this, it will not run change if the user
87 * change if the user changes their computer clock. 85 * changes their computer clock.
88 * 86 *
89 * @return A PP_TimeTicks containing the "tick time" according to the 87 * @return A <code>PP_TimeTicks</code> containing the "tick time" according
90 * browser. 88 * to the browser.
91 */ 89 */
92 90
93 // TODO(brettw) http://code.google.com/p/chromium/issues/detail?id=57448 91 // 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 92 // This currently does change with wall clock time, but will be fixed in
95 // a future release. 93 // a future release.
96 PP_TimeTicks (*GetTimeTicks)(); 94 PP_TimeTicks (*GetTimeTicks)();
97 95
98 /** 96 /**
99 * CallOnMainThread is a pointer to a function that schedules work to be 97 * CallOnMainThread() schedules work to be executed on the main module thread
100 * executed on the main module thread after the specified delay. The delay 98 * 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. 99 * soon as possible.
102 * 100 *
103 * The |result| parameter will just be passed as the second argument to the 101 * 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 102 * argument to the callback. Many applications won't need this, but it allows
105 * emulate calls of some callbacks which do use this value. 103 * a module to emulate calls of some callbacks which do use this value.
106 * 104 *
107 * NOTE: CallOnMainThread, even when used from the main thread with a delay 105 * <strong>Note:</strong> CallOnMainThread, even when used from the main
108 * of 0 milliseconds, will never directly invoke the callback. Even in this 106 * thread with a delay of 0 milliseconds, will never directly invoke the
109 * case, the callback will be scheduled asynchronously. 107 * callback. Even in this case, the callback will be scheduled
108 * asynchronously.
110 * 109 *
111 * NOTE: If the browser is shutting down or if the plugin has no instances, 110 * <strong>Note:</strong> If the browser is shutting down or if the module
112 * then the callback function may not be called. 111 * has no instances, then the callback function may not be called.
113 * 112 *
114 * @param[in] delay_in_milliseconds An int32_t delay in milliseconds. 113 * @param[in] delay_in_milliseconds An int32_t delay in milliseconds.
115 * @param[in] callback A PP_CompletionCallback callback function that the 114 * @param[in] callback A <code>PP_CompletionCallback</code> callback function
116 * browser will call after the specified delay. 115 * that the browser will call after the specified delay.
117 * @param[in] result An int32_t that the browser will pass to the given 116 * @param[in] result An int32_t that the browser will pass to the given
118 * PP_CompletionCallback. 117 * <code>PP_CompletionCallback</code>.
119 */ 118 */
120 void (*CallOnMainThread)(int32_t delay_in_milliseconds, 119 void (*CallOnMainThread)(int32_t delay_in_milliseconds,
121 struct PP_CompletionCallback callback, 120 struct PP_CompletionCallback callback,
122 int32_t result); 121 int32_t result);
123 122
124 /** 123 /**
125 * IsMainThread is a pointer to a function that returns true if the 124 * IsMainThread() returns true if the current thread is the main pepper
126 * current thread is the main pepper thread. 125 * thread.
127 * 126 *
128 * This function is useful for implementing sanity checks, and deciding if 127 * This function is useful for implementing sanity checks, and deciding if
129 * dispatching using CallOnMainThread() is required. 128 * dispatching using CallOnMainThread() is required.
130 * 129 *
131 * @return A PP_BOOL containing PP_TRUE if the current thread is the main 130 * @return A <code>PP_Bool</code> containing <code>PP_TRUE</code> if the
132 * pepper thread, otherwise PP_FALSE. 131 * current thread is the main pepper thread, otherwise <code>PP_FALSE</code>.
133 */ 132 */
134 PP_Bool (*IsMainThread)(); 133 PP_Bool (*IsMainThread)();
135 }; 134 };
136 /** 135 /**
137 * @} 136 * @}
138 */ 137 */
139 138
140 139
141 #endif /* PPAPI_C_DEV_PPB_CORE_DEV_H_ */ 140 #endif /* PPAPI_C_DEV_PPB_CORE_DEV_H_ */
OLDNEW
« no previous file with comments | « ppapi/c/ppb_audio_config.h ('k') | ppapi/c/ppb_graphics_2d.h » ('j') | ppapi/c/ppb_graphics_2d.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698