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

Side by Side Diff: c/ppb_device_context_2d.h

Issue 2853015: Switch FlushCallback to be a PP_CompletionCallback.... (Closed) Base URL: http://ppapi.googlecode.com/svn/trunk/
Patch Set: '' Created 10 years, 6 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
« no previous file with comments | « c/pp_errors.h ('k') | cpp/device_context_2d.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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_DEVICE_CONTEXT_2D_H_ 5 #ifndef PPAPI_C_PPB_DEVICE_CONTEXT_2D_H_
6 #define PPAPI_C_PPB_DEVICE_CONTEXT_2D_H_ 6 #define PPAPI_C_PPB_DEVICE_CONTEXT_2D_H_
7 7
8 #include "ppapi/c/pp_module.h" 8 #include "ppapi/c/pp_module.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 11
12 typedef struct _pp_CompletionCallback PP_CompletionCallback;
12 typedef struct _pp_Rect PP_Rect; 13 typedef struct _pp_Rect PP_Rect;
13 14
14 // Callback function type for PaintImageData.
15 typedef void (*PPB_DeviceContext2D_FlushCallback)(PP_Resource context,
16 void* data);
17
18 #define PPB_DEVICECONTEXT2D_INTERFACE "PPB_DeviceContext2D;1" 15 #define PPB_DEVICECONTEXT2D_INTERFACE "PPB_DeviceContext2D;1"
19 16
20 typedef struct _ppb_DeviceContext2D { 17 typedef struct _ppb_DeviceContext2D {
21 // The returned device context will not be bound to any plugin instance on 18 // The returned device context will not be bound to any plugin instance on
22 // creation (call BindGraphicsDeviceContext on the plugin instance to do 19 // creation (call BindGraphicsDeviceContext on the plugin instance to do
23 // that. The device context has a lifetime that can exceed that of the given 20 // that. The device context has a lifetime that can exceed that of the given
24 // plugin instance. 21 // plugin instance.
25 // 22 //
26 // Set the is_always_opaque flag if you know that you will be painting only 23 // Set the is_always_opaque flag if you know that you will be painting only
27 // opaque data to this device. This will disable blending when compositing 24 // opaque data to this device. This will disable blending when compositing
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 // there are internal references to the device that means it has not been 153 // there are internal references to the device that means it has not been
157 // internally destroyed (for example, if it is still bound to an instance) 154 // internally destroyed (for example, if it is still bound to an instance)
158 // or due to other implementation details. As a result, you should be 155 // or due to other implementation details. As a result, you should be
159 // careful to check that flush callbacks are for the device you expect and 156 // careful to check that flush callbacks are for the device you expect and
160 // that you're capable of handling callbacks for devices that you may have 157 // that you're capable of handling callbacks for devices that you may have
161 // released your reference to. 158 // released your reference to.
162 // 159 //
163 // Shutdown: If a plugin instance is removed when a Flush is pending, the 160 // Shutdown: If a plugin instance is removed when a Flush is pending, the
164 // callback will not be executed. 161 // callback will not be executed.
165 // 162 //
166 // Returns true on success or false on failure. Failure means the device 163 // TODO(darin): We should ensure that the completion callback always runs, so
167 // context is invalid, you are requesting a synchronous flush from the main 164 // that it is easier for consumers to manage memory referenced by a callback.
168 // thread of the plugin, or you already have a Flush pending that has not 165 //
169 // issued its callback yet. In the failure case, nothing will be updated and 166 // Returns PP_OK on success, PP_Error_BadResource if the device context is
170 // no callback will be scheduled. 167 // invalid, PP_Error_BadArgument if the callback is null and Flush is being
171 bool (*Flush)(PP_Resource device_context, 168 // called from the main thread of the plugin, or PP_Error_InProgress if a
172 PPB_DeviceContext2D_FlushCallback callback, 169 // Flush is already pending that has not issued its callback yet. In the
173 void* callback_data); 170 // failure case, nothing will be updated and no callback will be scheduled.
171 int32_t (*Flush)(PP_Resource device_context, PP_CompletionCallback callback);
174 172
175 } PPB_DeviceContext2D; 173 } PPB_DeviceContext2D;
176 174
177 #endif // PPAPI_C_PPB_DEVICE_CONTEXT_2D_H_ 175 #endif // PPAPI_C_PPB_DEVICE_CONTEXT_2D_H_
OLDNEW
« no previous file with comments | « c/pp_errors.h ('k') | cpp/device_context_2d.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698