| OLD | NEW |
| 1 /* Copyright (c) 2006-2009 The Chromium Authors. All rights reserved. | 1 /* Copyright (c) 2006-2009 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 | 5 |
| 6 #ifndef _NP_EXTENSIONS_H_ | 6 #ifndef _NP_EXTENSIONS_H_ |
| 7 #define _NP_EXTENSIONS_H_ | 7 #define _NP_EXTENSIONS_H_ |
| 8 | 8 |
| 9 #include "third_party/npapi/bindings/npapi.h" | 9 #include "third_party/npapi/bindings/npapi.h" |
| 10 | 10 |
| 11 /* | 11 /* |
| 12 * A fake "enum" value for getting Pepper extensions. | 12 * A fake "enum" value for getting Pepper extensions. |
| 13 * The variable returns a pointer to an NPPepperExtensions structure | 13 * The variable returns a pointer to an NPPepperExtensions structure |
| 14 */ | 14 */ |
| 15 #define NPNVPepperExtensions ((NPNVariable) 4000) | 15 #define NPNVPepperExtensions ((NPNVariable) 4000) |
| 16 | 16 |
| 17 typedef void NPDeviceConfig; | 17 typedef void NPDeviceConfig; |
| 18 typedef void NPDeviceContext; | 18 typedef void NPDeviceContext; |
| 19 typedef void NPUserData; | 19 typedef void NPUserData; |
| 20 | 20 |
| 21 /* unique id for each device interface */ | 21 /* unique id for each device interface */ |
| 22 typedef int32 NPDeviceID; | 22 typedef int32 NPDeviceID; |
| 23 | 23 |
| 24 |
| 25 typedef struct _NPDeviceBuffer { |
| 26 void* ptr; |
| 27 size_t size; |
| 28 } NPDeviceBuffer; |
| 29 |
| 24 /* completion callback for flush device */ | 30 /* completion callback for flush device */ |
| 25 typedef void (*NPDeviceFlushContextCallbackPtr)( | 31 typedef void (*NPDeviceFlushContextCallbackPtr)( |
| 26 NPP instace, | 32 NPP instace, |
| 27 NPDeviceContext* context, | 33 NPDeviceContext* context, |
| 28 NPError err, | 34 NPError err, |
| 29 NPUserData* userData); | 35 NPUserData* userData); |
| 30 | 36 |
| 31 /* query single capabilities of device */ | 37 /* query single capabilities of device */ |
| 32 typedef NPError ( | 38 typedef NPError ( |
| 33 *NPDeviceQueryCapabilityPtr)(NPP instance, | 39 *NPDeviceQueryCapabilityPtr)(NPP instance, |
| (...skipping 26 matching lines...) Expand all Loading... |
| 60 typedef NPError (*NPDeviceFlushContextPtr)( | 66 typedef NPError (*NPDeviceFlushContextPtr)( |
| 61 NPP instance, | 67 NPP instance, |
| 62 NPDeviceContext* context, | 68 NPDeviceContext* context, |
| 63 NPDeviceFlushContextCallbackPtr callback, | 69 NPDeviceFlushContextCallbackPtr callback, |
| 64 void* userData); | 70 void* userData); |
| 65 /* destroy device context. Application responsible for */ | 71 /* destroy device context. Application responsible for */ |
| 66 /* freeing context, if applicable */ | 72 /* freeing context, if applicable */ |
| 67 typedef NPError (*NPDeviceDestroyContextPtr)( | 73 typedef NPError (*NPDeviceDestroyContextPtr)( |
| 68 NPP instance, | 74 NPP instance, |
| 69 NPDeviceContext* context); | 75 NPDeviceContext* context); |
| 76 /* Create a buffer associated with a particular context. The usage of the */ |
| 77 /* buffer is device specific. The lifetime of the buffer is scoped with the */ |
| 78 /* lifetime of the context. */ |
| 79 typedef NPError (*NPDeviceCreateBufferPtr)( |
| 80 NPP instance, |
| 81 NPDeviceContext* context, |
| 82 size_t size, |
| 83 int32* id); |
| 84 /* Destroy a buffer associated with a particular context. */ |
| 85 typedef NPError (*NPDeviceDestroyBufferPtr)( |
| 86 NPP instance, |
| 87 NPDeviceContext* context, |
| 88 int32 id); |
| 89 /* Map a buffer id to its address. */ |
| 90 typedef NPError (*NPDeviceMapBufferPtr)( |
| 91 NPP instance, |
| 92 NPDeviceContext* context, |
| 93 int32 id, |
| 94 NPDeviceBuffer* buffer); |
| 70 | 95 |
| 71 /* forward decl typdef structs */ | 96 /* forward decl typdef structs */ |
| 72 typedef struct NPDevice NPDevice; | 97 typedef struct NPDevice NPDevice; |
| 73 typedef struct NPExtensions NPExtensions; | 98 typedef struct NPExtensions NPExtensions; |
| 74 | 99 |
| 75 /* generic device interface */ | 100 /* generic device interface */ |
| 76 struct NPDevice { | 101 struct NPDevice { |
| 77 NPDeviceQueryCapabilityPtr queryCapability; | 102 NPDeviceQueryCapabilityPtr queryCapability; |
| 78 NPDeviceQueryConfigPtr queryConfig; | 103 NPDeviceQueryConfigPtr queryConfig; |
| 79 NPDeviceInitializeContextPtr initializeContext; | 104 NPDeviceInitializeContextPtr initializeContext; |
| 80 NPDeviceSetStateContextPtr setStateContext; | 105 NPDeviceSetStateContextPtr setStateContext; |
| 81 NPDeviceGetStateContextPtr getStateContext; | 106 NPDeviceGetStateContextPtr getStateContext; |
| 82 NPDeviceFlushContextPtr flushContext; | 107 NPDeviceFlushContextPtr flushContext; |
| 83 NPDeviceDestroyContextPtr destroyContext; | 108 NPDeviceDestroyContextPtr destroyContext; |
| 109 NPDeviceCreateBufferPtr createBuffer; |
| 110 NPDeviceDestroyBufferPtr destroyBuffer; |
| 111 NPDeviceMapBufferPtr mapBuffer; |
| 84 }; | 112 }; |
| 85 | 113 |
| 86 /* returns NULL if deviceID unavailable / unrecognized */ | 114 /* returns NULL if deviceID unavailable / unrecognized */ |
| 87 typedef NPDevice* (*NPAcquireDevicePtr)( | 115 typedef NPDevice* (*NPAcquireDevicePtr)( |
| 88 NPP instance, | 116 NPP instance, |
| 89 NPDeviceID device); | 117 NPDeviceID device); |
| 90 | 118 |
| 91 /* Pepper extensions */ | 119 /* Pepper extensions */ |
| 92 struct NPExtensions { | 120 struct NPExtensions { |
| 93 /* Device interface acquisition */ | 121 /* Device interface acquisition */ |
| (...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 218 int32 right; | 246 int32 right; |
| 219 int32 bottom; | 247 int32 bottom; |
| 220 } dirty; | 248 } dirty; |
| 221 } NPDeviceContext2D; | 249 } NPDeviceContext2D; |
| 222 | 250 |
| 223 /* 3D -----------------------------------------------------------------------*/ | 251 /* 3D -----------------------------------------------------------------------*/ |
| 224 | 252 |
| 225 #define NPPepper3DDevice 2 | 253 #define NPPepper3DDevice 2 |
| 226 | 254 |
| 227 typedef struct _NPDeviceContext3DConfig { | 255 typedef struct _NPDeviceContext3DConfig { |
| 256 int32 commandBufferEntries; |
| 228 } NPDeviceContext3DConfig; | 257 } NPDeviceContext3DConfig; |
| 229 | 258 |
| 259 typedef enum { |
| 260 // The offset the command buffer service has read to. |
| 261 NPDeviceContext3DState_GetOffset, |
| 262 // The offset the plugin instance has written to. |
| 263 NPDeviceContext3DState_PutOffset, |
| 264 // The last token processed by the command buffer service. |
| 265 NPDeviceContext3DState_Token, |
| 266 // The most recent parse error. Getting this value resets the parse error |
| 267 // if it recoverable. |
| 268 NPDeviceContext3DState_ParseError, |
| 269 // Wether the command buffer has encountered an unrecoverable error. |
| 270 NPDeviceContext3DState_ErrorStatus, |
| 271 } NPDeviceContext3DState; |
| 272 |
| 230 typedef struct _NPDeviceContext3D | 273 typedef struct _NPDeviceContext3D |
| 231 { | 274 { |
| 232 void* reserved; | 275 void* reserved; |
| 233 void* buffer; | 276 |
| 234 int32 bufferLength; | 277 // Buffer in which commands are stored. |
| 278 void* commandBuffer; |
| 279 int32 commandBufferEntries; |
| 280 |
| 281 // Offset in command buffer reader has reached. Synchronized on flush. |
| 282 int32 getOffset; |
| 283 |
| 284 // Offset in command buffer writer has reached. Synchronized on flush. |
| 285 int32 putOffset; |
| 235 } NPDeviceContext3D; | 286 } NPDeviceContext3D; |
| 236 | 287 |
| 237 #endif /* _NP_EXTENSIONS_H_ */ | 288 #endif /* _NP_EXTENSIONS_H_ */ |
| OLD | NEW |