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 |
| 6 /* From dev/ppb_testing_dev.idl modified Thu Nov 17 13:50:20 2011. */ |
| 7 |
5 #ifndef PPAPI_C_DEV_PPB_TESTING_DEV_H_ | 8 #ifndef PPAPI_C_DEV_PPB_TESTING_DEV_H_ |
6 #define PPAPI_C_DEV_PPB_TESTING_DEV_H_ | 9 #define PPAPI_C_DEV_PPB_TESTING_DEV_H_ |
7 | 10 |
8 #include "ppapi/c/pp_bool.h" | 11 #include "ppapi/c/pp_bool.h" |
9 #include "ppapi/c/pp_instance.h" | 12 #include "ppapi/c/pp_instance.h" |
| 13 #include "ppapi/c/pp_macros.h" |
| 14 #include "ppapi/c/pp_point.h" |
10 #include "ppapi/c/pp_resource.h" | 15 #include "ppapi/c/pp_resource.h" |
11 #include "ppapi/c/pp_stdint.h" | 16 #include "ppapi/c/pp_stdint.h" |
12 | 17 |
13 struct PP_Point; | |
14 | |
15 // TODO(dmichael): Delete support for 0.6. | |
16 #define PPB_TESTING_DEV_INTERFACE_0_6 "PPB_Testing(Dev);0.6" | |
17 #define PPB_TESTING_DEV_INTERFACE_0_7 "PPB_Testing(Dev);0.7" | 18 #define PPB_TESTING_DEV_INTERFACE_0_7 "PPB_Testing(Dev);0.7" |
18 #define PPB_TESTING_DEV_INTERFACE PPB_TESTING_DEV_INTERFACE_0_7 | 19 #define PPB_TESTING_DEV_INTERFACE PPB_TESTING_DEV_INTERFACE_0_7 |
19 | 20 |
20 // This interface contains functions used for unit testing. Do not use in | 21 /** |
21 // production code. They are not guaranteed to be available in normal plugin | 22 * @file |
22 // environments so you should not depend on them. | 23 * This file contains interface functions used for unit testing. Do not use in |
| 24 * production code. They are not guaranteed to be available in normal plugin |
| 25 * environments so you should not depend on them. |
| 26 */ |
| 27 |
| 28 |
| 29 /** |
| 30 * @addtogroup Interfaces |
| 31 * @{ |
| 32 */ |
23 struct PPB_Testing_Dev { | 33 struct PPB_Testing_Dev { |
24 // Reads the bitmap data out of the backing store for the given | 34 /** |
25 // DeviceContext2D and into the given image. If the data was successfully | 35 * Reads the bitmap data out of the backing store for the given |
26 // read, it will return PP_TRUE. | 36 * DeviceContext2D and into the given image. If the data was successfully |
27 // | 37 * read, it will return PP_TRUE. |
28 // This function should not generally be necessary for normal plugin | 38 * |
29 // operation. If you want to update portions of a device, the expectation is | 39 * This function should not generally be necessary for normal plugin |
30 // that you will either regenerate the data, or maintain a backing store | 40 * operation. If you want to update portions of a device, the expectation is |
31 // pushing updates to the device from your backing store via PaintImageData. | 41 * that you will either regenerate the data, or maintain a backing store |
32 // Using this function will introduce an extra copy which will make your | 42 * pushing updates to the device from your backing store via PaintImageData. |
33 // plugin slower. In some cases, this may be a very expensive operation (it | 43 * Using this function will introduce an extra copy which will make your |
34 // may require slow cross-process transitions or graphics card readbacks). | 44 * plugin slower. In some cases, this may be a very expensive operation (it |
35 // | 45 * may require slow cross-process transitions or graphics card readbacks). |
36 // Data will be read into the image starting at |top_left| in the device | 46 * |
37 // context, and proceeding down and to the right for as many pixels as the | 47 * Data will be read into the image starting at |top_left| in the device |
38 // image is large. If any part of the image bound would fall outside of the | 48 * context, and proceeding down and to the right for as many pixels as the |
39 // backing store of the device if positioned at |top_left|, this function | 49 * image is large. If any part of the image bound would fall outside of the |
40 // will fail and return PP_FALSE. | 50 * backing store of the device if positioned at |top_left|, this function |
41 // | 51 * will fail and return PP_FALSE. |
42 // The image format must be of the format | 52 * |
43 // PPB_ImageData.GetNativeImageDataFormat() or this function will fail and | 53 * The image format must be of the format |
44 // return PP_FALSE. | 54 * PPB_ImageData.GetNativeImageDataFormat() or this function will fail and |
45 // | 55 * return PP_FALSE. |
46 // The returned image data will represent the current status of the backing | 56 * |
47 // store. This will not include any paint, scroll, or replace operations | 57 * The returned image data will represent the current status of the backing |
48 // that have not yet been flushed; these operations are only reflected in | 58 * store. This will not include any paint, scroll, or replace operations |
49 // the backing store (and hence ReadImageData) until after a Flush() | 59 * that have not yet been flushed; these operations are only reflected in |
50 // operation has completed. | 60 * the backing store (and hence ReadImageData) until after a Flush() |
| 61 * operation has completed. |
| 62 */ |
51 PP_Bool (*ReadImageData)(PP_Resource device_context_2d, | 63 PP_Bool (*ReadImageData)(PP_Resource device_context_2d, |
52 PP_Resource image, | 64 PP_Resource image, |
53 const struct PP_Point* top_left); | 65 const struct PP_Point* top_left); |
54 | 66 /** |
55 // Runs a nested message loop. The plugin will be reentered from this call. | 67 * Runs a nested message loop. The plugin will be reentered from this call. |
56 // This function is used for unit testing the API. The normal pattern is to | 68 * This function is used for unit testing the API. The normal pattern is to |
57 // issue some asynchronous call that has a callback. Then you call | 69 * issue some asynchronous call that has a callback. Then you call |
58 // RunMessageLoop which will suspend the plugin and go back to processing | 70 * RunMessageLoop which will suspend the plugin and go back to processing |
59 // messages, giving the asynchronous operation time to complete. In your | 71 * messages, giving the asynchronous operation time to complete. In your |
60 // callback, you save the data and call QuitMessageLoop, which will then | 72 * callback, you save the data and call QuitMessageLoop, which will then |
61 // pop back up and continue with the test. This avoids having to write a | 73 * pop back up and continue with the test. This avoids having to write a |
62 // complicated state machine for simple tests for asynchronous APIs. | 74 * complicated state machine for simple tests for asynchronous APIs. |
| 75 */ |
63 void (*RunMessageLoop)(PP_Instance instance); | 76 void (*RunMessageLoop)(PP_Instance instance); |
64 | 77 /** |
65 // Posts a quit message for the outermost nested message loop. Use this to | 78 * Posts a quit message for the outermost nested message loop. Use this to |
66 // exit and return back to the caller after you call RunMessageLoop. | 79 * exit and return back to the caller after you call RunMessageLoop. |
| 80 */ |
67 void (*QuitMessageLoop)(PP_Instance instance); | 81 void (*QuitMessageLoop)(PP_Instance instance); |
68 | 82 /** |
69 // Returns the number of live objects (resources + strings + objects) | 83 * Returns the number of live objects (resources + strings + objects) |
70 // associated with this plugin instance. Used for detecting leaks. Returns | 84 * associated with this plugin instance. Used for detecting leaks. Returns |
71 // (uint32_t)-1 on failure. | 85 * (uint32_t)-1 on failure. |
| 86 */ |
72 uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance); | 87 uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance); |
73 | 88 /** |
74 // Returns PP_TRUE if the plugin is running out-of-process, PP_FALSE | 89 * Returns PP_TRUE if the plugin is running out-of-process, PP_FALSE |
75 // otherwise. | 90 * otherwise. |
| 91 */ |
76 PP_Bool (*IsOutOfProcess)(); | 92 PP_Bool (*IsOutOfProcess)(); |
77 }; | 93 }; |
| 94 /** |
| 95 * @} |
| 96 */ |
78 | 97 |
79 #endif /* PPAPI_C_DEV_PPB_TESTING_DEV_H_ */ | 98 #endif /* PPAPI_C_DEV_PPB_TESTING_DEV_H_ */ |
80 | 99 |
OLD | NEW |