Commit 03f41ec4 authored by jvoung@google.com's avatar jvoung@google.com

Convert a few ppapi dev interfaces to IDL. NaCl has tests for these

dev interfaces, and we want it to go through IDL so that the PNaCl shim
will know about them. There are few others dev and private interfaces
not yet converted to IDL, but this is a start.

TEST= ./generator.py
BUG= http://code.google.com/p/chromium/issues/detail?id=89968

Review URL: http://codereview.chromium.org/8586031

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110777 0039d316-1c4b-4281-b951-d872f2087c98
parent ab88d154
/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/**
* This file defines enumerations for cursor types.
*/
[assert_size(4)]
[notypedef] enum PP_CursorType_Dev {
PP_CURSORTYPE_CUSTOM = -1,
PP_CURSORTYPE_POINTER = 0,
PP_CURSORTYPE_CROSS = 1,
PP_CURSORTYPE_HAND = 2,
PP_CURSORTYPE_IBEAM = 3,
PP_CURSORTYPE_WAIT = 4,
PP_CURSORTYPE_HELP = 5,
PP_CURSORTYPE_EASTRESIZE = 6,
PP_CURSORTYPE_NORTHRESIZE = 7,
PP_CURSORTYPE_NORTHEASTRESIZE = 8,
PP_CURSORTYPE_NORTHWESTRESIZE = 9,
PP_CURSORTYPE_SOUTHRESIZE = 10,
PP_CURSORTYPE_SOUTHEASTRESIZE = 11,
PP_CURSORTYPE_SOUTHWESTRESIZE = 12,
PP_CURSORTYPE_WESTRESIZE = 13,
PP_CURSORTYPE_NORTHSOUTHRESIZE = 14,
PP_CURSORTYPE_EASTWESTRESIZE = 15,
PP_CURSORTYPE_NORTHEASTSOUTHWESTRESIZE = 16,
PP_CURSORTYPE_NORTHWESTSOUTHEASTRESIZE = 17,
PP_CURSORTYPE_COLUMNRESIZE = 18,
PP_CURSORTYPE_ROWRESIZE = 19,
PP_CURSORTYPE_MIDDLEPANNING = 20,
PP_CURSORTYPE_EASTPANNING = 21,
PP_CURSORTYPE_NORTHPANNING = 22,
PP_CURSORTYPE_NORTHEASTPANNING = 23,
PP_CURSORTYPE_NORTHWESTPANNING = 24,
PP_CURSORTYPE_SOUTHPANNING = 25,
PP_CURSORTYPE_SOUTHEASTPANNING = 26,
PP_CURSORTYPE_SOUTHWESTPANNING = 27,
PP_CURSORTYPE_WESTPANNING = 28,
PP_CURSORTYPE_MOVE = 29,
PP_CURSORTYPE_VERTICALTEXT = 30,
PP_CURSORTYPE_CELL = 31,
PP_CURSORTYPE_CONTEXTMENU = 32,
PP_CURSORTYPE_ALIAS = 33,
PP_CURSORTYPE_PROGRESS = 34,
PP_CURSORTYPE_NODROP = 35,
PP_CURSORTYPE_COPY = 36,
PP_CURSORTYPE_NONE = 37,
PP_CURSORTYPE_NOTALLOWED = 38,
PP_CURSORTYPE_ZOOMIN = 39,
PP_CURSORTYPE_ZOOMOUT = 40,
PP_CURSORTYPE_GRAB = 41,
PP_CURSORTYPE_GRABBING = 42
};
/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/**
* This file defines the <code>PPB_CursorControl_Dev</code> interface
* implemented by the browser for controlling the cursor.
*/
label Chrome {
M14 = 0.4
};
[macro="PPB_CURSOR_CONTROL_DEV_INTERFACE"]
interface PPB_CursorControl_Dev {
/**
* Set a cursor. If "type" is PP_CURSORTYPE_CUSTOM, then "custom_image"
* must be an ImageData resource containing the cursor and "hot_spot" must
* contain the offset within that image that refers to the cursor's position.
*/
PP_Bool SetCursor([in] PP_Instance instance,
[in] PP_CursorType_Dev type,
[in] PP_Resource custom_image,
[in] PP_Point hot_spot);
/**
* This method causes the cursor to be moved to the center of the
* instance and be locked, preventing the user from moving it.
* The cursor is implicitly hidden from the user while locked.
* Cursor lock may only be requested in response to a
* PP_InputEvent_MouseDown, and then only if the event was generated via
* user gesture.
*
* While the cursor is locked, any movement of the mouse will
* generate a PP_InputEvent_Type_MouseMove, whose x and y values
* indicate the position the cursor would have been moved to had
* the cursor not been locked, and had the screen been infinite in size.
*
* The browser may revoke cursor lock for reasons including but not
* limited to the user pressing the ESC key, the user activating
* another program via a reserved keystroke (e.g., ALT+TAB), or
* some other system event.
*
* Returns PP_TRUE if the cursor could be locked, PP_FALSE otherwise.
*/
PP_Bool LockCursor([in] PP_Instance instance);
/**
* Causes the cursor to be unlocked, allowing it to track user
* movement again.
*/
PP_Bool UnlockCursor([in] PP_Instance instance);
/**
* Returns PP_TRUE if the cursor is locked, PP_FALSE otherwise.
*/
PP_Bool HasCursorLock([in] PP_Instance instance);
/**
* Returns PP_TRUE if the cursor can be locked, PP_FALSE otherwise.
*/
PP_Bool CanLockCursor([in] PP_Instance instance);
};
/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/**
* This file defines the <code>PPB_Memory interface</code> for functions
* related to memory management.
*/
label Chrome {
M14 = 0.1
};
/**
* The PPB_Memory_Dev interface contains pointers to functions related to memory
* management.
*
*/
interface PPB_Memory_Dev {
/**
* MemAlloc is a pointer to a function that allocate memory.
*
* @param[in] num_bytes A number of bytes to allocate.
* @return A pointer to the memory if successful, NULL If the
* allocation fails.
*/
mem_t MemAlloc([in] uint32_t num_bytes);
/**
* MemFree is a pointer to a function that deallocates memory.
*
* @param[in] ptr A pointer to the memory to deallocate. It is safe to
* pass NULL to this function.
*/
void MemFree([inout] mem_t ptr);
};
/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/**
* This file contains interface functions used for unit testing. Do not use in
* production code. They are not guaranteed to be available in normal plugin
* environments so you should not depend on them.
*/
label Chrome {
M14 = 0.7
};
interface PPB_Testing_Dev {
/**
* Reads the bitmap data out of the backing store for the given
* DeviceContext2D and into the given image. If the data was successfully
* read, it will return PP_TRUE.
*
* This function should not generally be necessary for normal plugin
* operation. If you want to update portions of a device, the expectation is
* that you will either regenerate the data, or maintain a backing store
* pushing updates to the device from your backing store via PaintImageData.
* Using this function will introduce an extra copy which will make your
* plugin slower. In some cases, this may be a very expensive operation (it
* may require slow cross-process transitions or graphics card readbacks).
*
* Data will be read into the image starting at |top_left| in the device
* context, and proceeding down and to the right for as many pixels as the
* image is large. If any part of the image bound would fall outside of the
* backing store of the device if positioned at |top_left|, this function
* will fail and return PP_FALSE.
*
* The image format must be of the format
* PPB_ImageData.GetNativeImageDataFormat() or this function will fail and
* return PP_FALSE.
*
* The returned image data will represent the current status of the backing
* store. This will not include any paint, scroll, or replace operations
* that have not yet been flushed; these operations are only reflected in
* the backing store (and hence ReadImageData) until after a Flush()
* operation has completed.
*/
PP_Bool ReadImageData([in] PP_Resource device_context_2d,
[in] PP_Resource image,
[in] PP_Point top_left);
/**
* Runs a nested message loop. The plugin will be reentered from this call.
* This function is used for unit testing the API. The normal pattern is to
* issue some asynchronous call that has a callback. Then you call
* RunMessageLoop which will suspend the plugin and go back to processing
* messages, giving the asynchronous operation time to complete. In your
* callback, you save the data and call QuitMessageLoop, which will then
* pop back up and continue with the test. This avoids having to write a
* complicated state machine for simple tests for asynchronous APIs.
*/
void RunMessageLoop([in] PP_Instance instance);
/**
* Posts a quit message for the outermost nested message loop. Use this to
* exit and return back to the caller after you call RunMessageLoop.
*/
void QuitMessageLoop([in] PP_Instance instance);
/**
* Returns the number of live objects (resources + strings + objects)
* associated with this plugin instance. Used for detecting leaks. Returns
* (uint32_t)-1 on failure.
*/
uint32_t GetLiveObjectsForInstance([in] PP_Instance instance);
/**
* Returns PP_TRUE if the plugin is running out-of-process, PP_FALSE
* otherwise.
*/
PP_Bool IsOutOfProcess();
};
/* Copyright (c) 2011 The Chromium Authors. All rights reserved.
* Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file.
*/
/**
* Implementation of the Printing interface.
*/
label Chrome {
M14 = 0.5
};
[assert_size(4)]
enum PP_PrintOrientation_Dev {
PP_PRINTORIENTATION_NORMAL = 0,
PP_PRINTORIENTATION_ROTATED_90_CW = 1,
PP_PRINTORIENTATION_ROTATED_180 = 2,
PP_PRINTORIENTATION_ROTATED_90_CCW = 3
};
[assert_size(4)]
enum PP_PrintOutputFormat_Dev {
PP_PRINTOUTPUTFORMAT_RASTER = 1u << 0,
PP_PRINTOUTPUTFORMAT_PDF = 1u << 1,
PP_PRINTOUTPUTFORMAT_POSTSCRIPT = 1u << 2,
PP_PRINTOUTPUTFORMAT_EMF = 1u << 3
};
[assert_size(32)]
struct PP_PrintSettings_Dev {
/** This is the size of the printable area in points (1/72 of an inch) */
PP_Rect printable_area;
int32_t dpi;
PP_PrintOrientation_Dev orientation;
PP_Bool grayscale;
PP_PrintOutputFormat_Dev format;
};
/**
* Specifies a contiguous range of page numbers to be printed.
* The page numbers use a zero-based index.
*/
[assert_size(8)]
struct PP_PrintPageNumberRange_Dev {
uint32_t first_page_number;
uint32_t last_page_number;
};
interface PPP_Printing_Dev {
/**
* Returns a bit field representing the supported print output formats. For
* example, if only Raster and PostScript are supported,
* QuerySupportedFormats returns a value equivalent to:
* (PP_PRINTOUTPUTFORMAT_RASTER | PP_PRINTOUTPUTFORMAT_POSTSCRIPT)
*/
uint32_t QuerySupportedFormats([in] PP_Instance instance);
/**
* Begins a print session with the given print settings. Calls to PrintPage
* can only be made after a successful call to Begin. Returns the number of
* pages required for the print output at the given page size (0 indicates
* a failure).
*/
int32_t Begin([in] PP_Instance instance,
[in] PP_PrintSettings_Dev print_settings);
/**
* Prints the specified pages using the format specified in Begin.
* Returns a resource that represents the printed output.
* This is a PPB_ImageData resource if the output format is
* PP_PrintOutputFormat_Raster and a PPB_Blob otherwise. Returns 0 on
* failure.
*/
PP_Resource PrintPages([in] PP_Instance instance,
[in] PP_PrintPageNumberRange_Dev page_ranges,
[in] uint32_t page_range_count);
/** Ends the print session. Further calls to PrintPage will fail. */
void End([in] PP_Instance instance);
/**
* Returns true if the current content should be printed into the full page
* and not scaled down to fit within the printer's printable area.
*/
PP_Bool IsScalingDisabled([in] PP_Instance instance);
};
...@@ -2,11 +2,24 @@ ...@@ -2,11 +2,24 @@
* Use of this source code is governed by a BSD-style license that can be * Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file. * found in the LICENSE file.
*/ */
#ifndef PPAPI_C_DEV_PP_CURSORTYPE_DEV_H_
#define PPAPI_C_DEV_PP_CURSORTYPE_DEV_H_ /* From dev/pp_cursor_type_dev.idl modified Thu Nov 17 15:27:17 2011. */
#ifndef PPAPI_C_DEV_PP_CURSOR_TYPE_DEV_H_
#define PPAPI_C_DEV_PP_CURSOR_TYPE_DEV_H_
#include "ppapi/c/pp_macros.h" #include "ppapi/c/pp_macros.h"
/**
* @file
* This file defines enumerations for cursor types.
*/
/**
* @addtogroup Enums
* @{
*/
enum PP_CursorType_Dev { enum PP_CursorType_Dev {
PP_CURSORTYPE_CUSTOM = -1, PP_CURSORTYPE_CUSTOM = -1,
PP_CURSORTYPE_POINTER = 0, PP_CURSORTYPE_POINTER = 0,
...@@ -54,6 +67,9 @@ enum PP_CursorType_Dev { ...@@ -54,6 +67,9 @@ enum PP_CursorType_Dev {
PP_CURSORTYPE_GRABBING = 42 PP_CURSORTYPE_GRABBING = 42
}; };
PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_CursorType_Dev, 4); PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(PP_CursorType_Dev, 4);
/**
* @}
*/
#endif /* PPAPI_C_DEV_PP_CURSORTYPE_DEV_H_ */ #endif /* PPAPI_C_DEV_PP_CURSOR_TYPE_DEV_H_ */
...@@ -2,57 +2,82 @@ ...@@ -2,57 +2,82 @@
* Use of this source code is governed by a BSD-style license that can be * Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file. * found in the LICENSE file.
*/ */
/* From dev/ppb_cursor_control_dev.idl modified Thu Nov 17 14:24:28 2011. */
#ifndef PPAPI_C_DEV_PPB_CURSOR_CONTROL_DEV_H_ #ifndef PPAPI_C_DEV_PPB_CURSOR_CONTROL_DEV_H_
#define PPAPI_C_DEV_PPB_CURSOR_CONTROL_DEV_H_ #define PPAPI_C_DEV_PPB_CURSOR_CONTROL_DEV_H_
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/dev/pp_cursor_type_dev.h" #include "ppapi/c/dev/pp_cursor_type_dev.h"
#include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_macros.h"
#include "ppapi/c/pp_point.h" #include "ppapi/c/pp_point.h"
#include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_stdint.h"
#define PPB_CURSOR_CONTROL_DEV_INTERFACE_0_4 "PPB_CursorControl(Dev);0.4" #define PPB_CURSOR_CONTROL_DEV_INTERFACE_0_4 "PPB_CursorControl(Dev);0.4"
#define PPB_CURSOR_CONTROL_DEV_INTERFACE PPB_CURSOR_CONTROL_DEV_INTERFACE_0_4 #define PPB_CURSOR_CONTROL_DEV_INTERFACE PPB_CURSOR_CONTROL_DEV_INTERFACE_0_4
/**
* @file
* This file defines the <code>PPB_CursorControl_Dev</code> interface
* implemented by the browser for controlling the cursor.
*/
/**
* @addtogroup Interfaces
* @{
*/
struct PPB_CursorControl_Dev { struct PPB_CursorControl_Dev {
// Set a cursor. If "type" is PP_CURSORTYPE_CUSTOM, then "custom_image" /**
// must be an ImageData resource containing the cursor and "hot_spot" must * Set a cursor. If "type" is PP_CURSORTYPE_CUSTOM, then "custom_image"
// contain the offset within that image that refers to the cursor's position. * must be an ImageData resource containing the cursor and "hot_spot" must
* contain the offset within that image that refers to the cursor's position.
*/
PP_Bool (*SetCursor)(PP_Instance instance, PP_Bool (*SetCursor)(PP_Instance instance,
enum PP_CursorType_Dev type, enum PP_CursorType_Dev type,
PP_Resource custom_image, PP_Resource custom_image,
const struct PP_Point* hot_spot); const struct PP_Point* hot_spot);
/**
// This method causes the cursor to be moved to the center of the * This method causes the cursor to be moved to the center of the
// instance and be locked, preventing the user from moving it. * instance and be locked, preventing the user from moving it.
// The cursor is implicitly hidden from the user while locked. * The cursor is implicitly hidden from the user while locked.
// Cursor lock may only be requested in response to a * Cursor lock may only be requested in response to a
// PP_InputEvent_MouseDown, and then only if the event was generated via * PP_InputEvent_MouseDown, and then only if the event was generated via
// user gesture. * user gesture.
// *
// While the cursor is locked, any movement of the mouse will * While the cursor is locked, any movement of the mouse will
// generate a PP_InputEvent_Type_MouseMove, whose x and y values * generate a PP_InputEvent_Type_MouseMove, whose x and y values
// indicate the position the cursor would have been moved to had * indicate the position the cursor would have been moved to had
// the cursor not been locked, and had the screen been infinite in size. * the cursor not been locked, and had the screen been infinite in size.
// *
// The browser may revoke cursor lock for reasons including but not * The browser may revoke cursor lock for reasons including but not
// limited to the user pressing the ESC key, the user activating * limited to the user pressing the ESC key, the user activating
// another program via a reserved keystroke (e.g., ALT+TAB), or * another program via a reserved keystroke (e.g., ALT+TAB), or
// some other system event. * some other system event.
// *
// Returns PP_TRUE if the cursor could be locked, PP_FALSE otherwise. * Returns PP_TRUE if the cursor could be locked, PP_FALSE otherwise.
PP_Bool (*LockCursor)(PP_Instance); */
PP_Bool (*LockCursor)(PP_Instance instance);
// Causes the cursor to be unlocked, allowing it to track user /**
// movement again. * Causes the cursor to be unlocked, allowing it to track user
PP_Bool (*UnlockCursor)(PP_Instance); * movement again.
*/
// Returns PP_TRUE if the cursor is locked, PP_FALSE otherwise. PP_Bool (*UnlockCursor)(PP_Instance instance);
PP_Bool (*HasCursorLock)(PP_Instance); /**
* Returns PP_TRUE if the cursor is locked, PP_FALSE otherwise.
// Returns PP_TRUE if the cursor can be locked, PP_FALSE otherwise. */
PP_Bool (*CanLockCursor)(PP_Instance); PP_Bool (*HasCursorLock)(PP_Instance instance);
/**
* Returns PP_TRUE if the cursor can be locked, PP_FALSE otherwise.
*/
PP_Bool (*CanLockCursor)(PP_Instance instance);
}; };
/**
* @}
*/
#endif /* PPAPI_C_DEV_PPB_CURSOR_CONTROL_DEV_H_ */ #endif /* PPAPI_C_DEV_PPB_CURSOR_CONTROL_DEV_H_ */
...@@ -2,9 +2,13 @@ ...@@ -2,9 +2,13 @@
* Use of this source code is governed by a BSD-style license that can be * Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file. * found in the LICENSE file.
*/ */
/* From dev/ppb_memory_dev.idl modified Thu Nov 17 09:45:57 2011. */
#ifndef PPAPI_C_DEV_PPB_MEMORY_DEV_H_ #ifndef PPAPI_C_DEV_PPB_MEMORY_DEV_H_
#define PPAPI_C_DEV_PPB_MEMORY_DEV_H_ #define PPAPI_C_DEV_PPB_MEMORY_DEV_H_
#include "ppapi/c/pp_macros.h"
#include "ppapi/c/pp_stdint.h" #include "ppapi/c/pp_stdint.h"
#define PPB_MEMORY_DEV_INTERFACE_0_1 "PPB_Memory(Dev);0.1" #define PPB_MEMORY_DEV_INTERFACE_0_1 "PPB_Memory(Dev);0.1"
...@@ -12,15 +16,15 @@ ...@@ -12,15 +16,15 @@
/** /**
* @file * @file
* This file defines the PPB_Memory interface defined by the browser and * This file defines the <code>PPB_Memory interface</code> for functions
* and containing pointers to functions related to memory management. * related to memory management.
*/ */
/** /**
* @addtogroup Interfaces * @addtogroup Interfaces
* @{ * @{
*/ */
/** /**
* The PPB_Memory_Dev interface contains pointers to functions related to memory * The PPB_Memory_Dev interface contains pointers to functions related to memory
* management. * management.
...@@ -35,7 +39,6 @@ struct PPB_Memory_Dev { ...@@ -35,7 +39,6 @@ struct PPB_Memory_Dev {
* allocation fails. * allocation fails.
*/ */
void* (*MemAlloc)(uint32_t num_bytes); void* (*MemAlloc)(uint32_t num_bytes);
/** /**
* MemFree is a pointer to a function that deallocates memory. * MemFree is a pointer to a function that deallocates memory.
* *
...@@ -49,3 +52,4 @@ struct PPB_Memory_Dev { ...@@ -49,3 +52,4 @@ struct PPB_Memory_Dev {
*/ */
#endif /* PPAPI_C_DEV_PPB_MEMORY_DEV_H_ */ #endif /* PPAPI_C_DEV_PPB_MEMORY_DEV_H_ */
...@@ -2,79 +2,98 @@ ...@@ -2,79 +2,98 @@
* Use of this source code is governed by a BSD-style license that can be * Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file. * found in the LICENSE file.
*/ */
/* From dev/ppb_testing_dev.idl modified Thu Nov 17 13:50:20 2011. */
#ifndef PPAPI_C_DEV_PPB_TESTING_DEV_H_ #ifndef PPAPI_C_DEV_PPB_TESTING_DEV_H_
#define PPAPI_C_DEV_PPB_TESTING_DEV_H_ #define PPAPI_C_DEV_PPB_TESTING_DEV_H_
#include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_macros.h"
#include "ppapi/c/pp_point.h"
#include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_stdint.h" #include "ppapi/c/pp_stdint.h"
struct PP_Point;
// TODO(dmichael): Delete support for 0.6.
#define PPB_TESTING_DEV_INTERFACE_0_6 "PPB_Testing(Dev);0.6"
#define PPB_TESTING_DEV_INTERFACE_0_7 "PPB_Testing(Dev);0.7" #define PPB_TESTING_DEV_INTERFACE_0_7 "PPB_Testing(Dev);0.7"
#define PPB_TESTING_DEV_INTERFACE PPB_TESTING_DEV_INTERFACE_0_7 #define PPB_TESTING_DEV_INTERFACE PPB_TESTING_DEV_INTERFACE_0_7
// This interface contains functions used for unit testing. Do not use in /**
// production code. They are not guaranteed to be available in normal plugin * @file
// environments so you should not depend on them. * This file contains interface functions used for unit testing. Do not use in
* production code. They are not guaranteed to be available in normal plugin
* environments so you should not depend on them.
*/
/**
* @addtogroup Interfaces
* @{
*/
struct PPB_Testing_Dev { struct PPB_Testing_Dev {
// Reads the bitmap data out of the backing store for the given /**
// DeviceContext2D and into the given image. If the data was successfully * Reads the bitmap data out of the backing store for the given
// read, it will return PP_TRUE. * DeviceContext2D and into the given image. If the data was successfully
// * read, it will return PP_TRUE.
// This function should not generally be necessary for normal plugin *
// operation. If you want to update portions of a device, the expectation is * This function should not generally be necessary for normal plugin
// that you will either regenerate the data, or maintain a backing store * operation. If you want to update portions of a device, the expectation is
// pushing updates to the device from your backing store via PaintImageData. * that you will either regenerate the data, or maintain a backing store
// Using this function will introduce an extra copy which will make your * pushing updates to the device from your backing store via PaintImageData.
// plugin slower. In some cases, this may be a very expensive operation (it * Using this function will introduce an extra copy which will make your
// may require slow cross-process transitions or graphics card readbacks). * plugin slower. In some cases, this may be a very expensive operation (it
// * may require slow cross-process transitions or graphics card readbacks).
// Data will be read into the image starting at |top_left| in the device *
// context, and proceeding down and to the right for as many pixels as the * Data will be read into the image starting at |top_left| in the device
// image is large. If any part of the image bound would fall outside of the * context, and proceeding down and to the right for as many pixels as the
// backing store of the device if positioned at |top_left|, this function * image is large. If any part of the image bound would fall outside of the
// will fail and return PP_FALSE. * backing store of the device if positioned at |top_left|, this function
// * will fail and return PP_FALSE.
// The image format must be of the format *
// PPB_ImageData.GetNativeImageDataFormat() or this function will fail and * The image format must be of the format
// return PP_FALSE. * PPB_ImageData.GetNativeImageDataFormat() or this function will fail and
// * return PP_FALSE.
// The returned image data will represent the current status of the backing *
// store. This will not include any paint, scroll, or replace operations * The returned image data will represent the current status of the backing
// that have not yet been flushed; these operations are only reflected in * store. This will not include any paint, scroll, or replace operations
// the backing store (and hence ReadImageData) until after a Flush() * that have not yet been flushed; these operations are only reflected in
// operation has completed. * the backing store (and hence ReadImageData) until after a Flush()
* operation has completed.
*/
PP_Bool (*ReadImageData)(PP_Resource device_context_2d, PP_Bool (*ReadImageData)(PP_Resource device_context_2d,
PP_Resource image, PP_Resource image,
const struct PP_Point* top_left); const struct PP_Point* top_left);
/**
// Runs a nested message loop. The plugin will be reentered from this call. * Runs a nested message loop. The plugin will be reentered from this call.
// This function is used for unit testing the API. The normal pattern is to * This function is used for unit testing the API. The normal pattern is to
// issue some asynchronous call that has a callback. Then you call * issue some asynchronous call that has a callback. Then you call
// RunMessageLoop which will suspend the plugin and go back to processing * RunMessageLoop which will suspend the plugin and go back to processing
// messages, giving the asynchronous operation time to complete. In your * messages, giving the asynchronous operation time to complete. In your
// callback, you save the data and call QuitMessageLoop, which will then * callback, you save the data and call QuitMessageLoop, which will then
// pop back up and continue with the test. This avoids having to write a * pop back up and continue with the test. This avoids having to write a
// complicated state machine for simple tests for asynchronous APIs. * complicated state machine for simple tests for asynchronous APIs.
*/
void (*RunMessageLoop)(PP_Instance instance); void (*RunMessageLoop)(PP_Instance instance);
/**
// Posts a quit message for the outermost nested message loop. Use this to * Posts a quit message for the outermost nested message loop. Use this to
// exit and return back to the caller after you call RunMessageLoop. * exit and return back to the caller after you call RunMessageLoop.
*/
void (*QuitMessageLoop)(PP_Instance instance); void (*QuitMessageLoop)(PP_Instance instance);
/**
// Returns the number of live objects (resources + strings + objects) * Returns the number of live objects (resources + strings + objects)
// associated with this plugin instance. Used for detecting leaks. Returns * associated with this plugin instance. Used for detecting leaks. Returns
// (uint32_t)-1 on failure. * (uint32_t)-1 on failure.
*/
uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance); uint32_t (*GetLiveObjectsForInstance)(PP_Instance instance);
/**
// Returns PP_TRUE if the plugin is running out-of-process, PP_FALSE * Returns PP_TRUE if the plugin is running out-of-process, PP_FALSE
// otherwise. * otherwise.
*/
PP_Bool (*IsOutOfProcess)(); PP_Bool (*IsOutOfProcess)();
}; };
/**
* @}
*/
#endif /* PPAPI_C_DEV_PPB_TESTING_DEV_H_ */ #endif /* PPAPI_C_DEV_PPB_TESTING_DEV_H_ */
...@@ -2,32 +2,57 @@ ...@@ -2,32 +2,57 @@
* Use of this source code is governed by a BSD-style license that can be * Use of this source code is governed by a BSD-style license that can be
* found in the LICENSE file. * found in the LICENSE file.
*/ */
/* From dev/ppp_printing_dev.idl modified Thu Nov 17 13:26:05 2011. */
#ifndef PPAPI_C_DEV_PPP_PRINTING_DEV_H_ #ifndef PPAPI_C_DEV_PPP_PRINTING_DEV_H_
#define PPAPI_C_DEV_PPP_PRINTING_DEV_H_ #define PPAPI_C_DEV_PPP_PRINTING_DEV_H_
#include "ppapi/c/pp_bool.h" #include "ppapi/c/pp_bool.h"
#include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_instance.h"
#include "ppapi/c/pp_macros.h" #include "ppapi/c/pp_macros.h"
#include "ppapi/c/pp_point.h"
#include "ppapi/c/pp_rect.h" #include "ppapi/c/pp_rect.h"
#include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_resource.h"
#include "ppapi/c/pp_size.h"
#include "ppapi/c/pp_stdint.h" #include "ppapi/c/pp_stdint.h"
#define PPP_PRINTING_DEV_INTERFACE_0_5 "PPP_Printing(Dev);0.5"
#define PPP_PRINTING_DEV_INTERFACE PPP_PRINTING_DEV_INTERFACE_0_5
/**
* @file
* Implementation of the Printing interface.
*/
/**
* @addtogroup Enums
* @{
*/
typedef enum { typedef enum {
PP_PRINTORIENTATION_NORMAL = 0, PP_PRINTORIENTATION_NORMAL = 0,
PP_PRINTORIENTATION_ROTATED_90_CW = 1, PP_PRINTORIENTATION_ROTATED_90_CW = 1,
PP_PRINTORIENTATION_ROTATED_180 = 2, PP_PRINTORIENTATION_ROTATED_180 = 2,
PP_PRINTORIENTATION_ROTATED_90_CCW = 3 PP_PRINTORIENTATION_ROTATED_90_CCW = 3
} PP_PrintOrientation_Dev; } PP_PrintOrientation_Dev;
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOrientation_Dev, 4); PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOrientation_Dev, 4);
typedef enum { typedef enum {
PP_PRINTOUTPUTFORMAT_RASTER = 1u << 0, PP_PRINTOUTPUTFORMAT_RASTER = 1u << 0,
PP_PRINTOUTPUTFORMAT_PDF = 1u << 1, PP_PRINTOUTPUTFORMAT_PDF = 1u << 1,
PP_PRINTOUTPUTFORMAT_POSTSCRIPT = 1u << 2, PP_PRINTOUTPUTFORMAT_POSTSCRIPT = 1u << 2,
PP_PRINTOUTPUTFORMAT_EMF = 1u << 3 PP_PRINTOUTPUTFORMAT_EMF = 1u << 3
} PP_PrintOutputFormat_Dev; } PP_PrintOutputFormat_Dev;
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOutputFormat_Dev, 4); PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOutputFormat_Dev, 4);
/**
* @}
*/
/**
* @addtogroup Structs
* @{
*/
struct PP_PrintSettings_Dev { struct PP_PrintSettings_Dev {
/** This is the size of the printable area in points (1/72 of an inch) */ /** This is the size of the printable area in points (1/72 of an inch) */
struct PP_Rect printable_area; struct PP_Rect printable_area;
...@@ -47,11 +72,14 @@ struct PP_PrintPageNumberRange_Dev { ...@@ -47,11 +72,14 @@ struct PP_PrintPageNumberRange_Dev {
uint32_t last_page_number; uint32_t last_page_number;
}; };
PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintPageNumberRange_Dev, 8); PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_PrintPageNumberRange_Dev, 8);
/**
* @}
*/
/* Interface for the plugin to implement printing. */ /**
#define PPP_PRINTING_DEV_INTERFACE_0_5 "PPP_Printing(Dev);0.5" * @addtogroup Interfaces
#define PPP_PRINTING_DEV_INTERFACE PPP_PRINTING_DEV_INTERFACE_0_5 * @{
*/
struct PPP_Printing_Dev { struct PPP_Printing_Dev {
/** /**
* Returns a bit field representing the supported print output formats. For * Returns a bit field representing the supported print output formats. For
...@@ -60,7 +88,6 @@ struct PPP_Printing_Dev { ...@@ -60,7 +88,6 @@ struct PPP_Printing_Dev {
* (PP_PRINTOUTPUTFORMAT_RASTER | PP_PRINTOUTPUTFORMAT_POSTSCRIPT) * (PP_PRINTOUTPUTFORMAT_RASTER | PP_PRINTOUTPUTFORMAT_POSTSCRIPT)
*/ */
uint32_t (*QuerySupportedFormats)(PP_Instance instance); uint32_t (*QuerySupportedFormats)(PP_Instance instance);
/** /**
* Begins a print session with the given print settings. Calls to PrintPage * Begins a print session with the given print settings. Calls to PrintPage
* can only be made after a successful call to Begin. Returns the number of * can only be made after a successful call to Begin. Returns the number of
...@@ -69,7 +96,6 @@ struct PPP_Printing_Dev { ...@@ -69,7 +96,6 @@ struct PPP_Printing_Dev {
*/ */
int32_t (*Begin)(PP_Instance instance, int32_t (*Begin)(PP_Instance instance,
const struct PP_PrintSettings_Dev* print_settings); const struct PP_PrintSettings_Dev* print_settings);
/** /**
* Prints the specified pages using the format specified in Begin. * Prints the specified pages using the format specified in Begin.
* Returns a resource that represents the printed output. * Returns a resource that represents the printed output.
...@@ -81,16 +107,17 @@ struct PPP_Printing_Dev { ...@@ -81,16 +107,17 @@ struct PPP_Printing_Dev {
PP_Instance instance, PP_Instance instance,
const struct PP_PrintPageNumberRange_Dev* page_ranges, const struct PP_PrintPageNumberRange_Dev* page_ranges,
uint32_t page_range_count); uint32_t page_range_count);
/** Ends the print session. Further calls to PrintPage will fail. */ /** Ends the print session. Further calls to PrintPage will fail. */
void (*End)(PP_Instance instance); void (*End)(PP_Instance instance);
/** /**
* Returns true if the current content should be printed into the full page * Returns true if the current content should be printed into the full page
* and not scaled down to fit within the printer's printable area. * and not scaled down to fit within the printer's printable area.
*/ */
PP_Bool (*IsScalingDisabled)(PP_Instance instance); PP_Bool (*IsScalingDisabled)(PP_Instance instance);
}; };
/**
* @}
*/
#endif /* PPAPI_C_DEV_PPP_PRINTING_DEV_H_ */ #endif /* PPAPI_C_DEV_PPP_PRINTING_DEV_H_ */
...@@ -90,6 +90,11 @@ def GenerateHeader(out, filenode, releases): ...@@ -90,6 +90,11 @@ def GenerateHeader(out, filenode, releases):
name = '%s%s' % (pref, node.GetName()) name = '%s%s' % (pref, node.GetName())
if node.IsA('Struct'): if node.IsA('Struct'):
form = 'PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(%s, %s);\n' form = 'PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(%s, %s);\n'
elif node.IsA('Enum'):
if node.GetProperty('notypedef'):
form = 'PP_COMPILE_ASSERT_ENUM_SIZE_IN_BYTES(%s, %s);\n'
else:
form = 'PP_COMPILE_ASSERT_SIZE_IN_BYTES(%s, %s);\n'
else: else:
form = 'PP_COMPILE_ASSERT_SIZE_IN_BYTES(%s, %s);\n' form = 'PP_COMPILE_ASSERT_SIZE_IN_BYTES(%s, %s);\n'
item += form % (name, asize[0]) item += form % (name, asize[0])
...@@ -219,4 +224,3 @@ def Main(args): ...@@ -219,4 +224,3 @@ def Main(args):
if __name__ == '__main__': if __name__ == '__main__':
retval = Main(sys.argv[1:]) retval = Main(sys.argv[1:])
sys.exit(retval) sys.exit(retval)
...@@ -254,7 +254,11 @@ class CGen(object): ...@@ -254,7 +254,11 @@ class CGen(object):
# If it's an enum, or typedef then return the Enum's name # If it's an enum, or typedef then return the Enum's name
elif typeref.IsA('Enum', 'Typedef'): elif typeref.IsA('Enum', 'Typedef'):
name = '%s%s' % (prefix, typeref.GetName()) # The enum may have skipped having a typedef, we need prefix with 'enum'.
if typeref.GetProperty('notypedef'):
name = 'enum %s%s' % (prefix, typeref.GetName())
else:
name = '%s%s' % (prefix, typeref.GetName())
else: else:
raise RuntimeError('Getting name of non-type %s.' % node) raise RuntimeError('Getting name of non-type %s.' % node)
...@@ -413,12 +417,15 @@ class CGen(object): ...@@ -413,12 +417,15 @@ class CGen(object):
def DefineEnum(self, node, releases, prefix='', comment=False): def DefineEnum(self, node, releases, prefix='', comment=False):
__pychecker__ = 'unusednames=comment,releases' __pychecker__ = 'unusednames=comment,releases'
self.LogEnter('DefineEnum %s' % node) self.LogEnter('DefineEnum %s' % node)
unnamed = node.GetProperty('unnamed') name = '%s%s' % (prefix, node.GetName())
notypedef = node.GetProperty('notypedef')
unnamed = node.GetProperty('unnamed')
if unnamed: if unnamed:
out = 'enum {' out = 'enum {'
elif notypedef:
out = 'enum %s {' % name
else: else:
out = 'typedef enum {' out = 'typedef enum {'
name = '%s%s' % (prefix, node.GetName())
enumlist = [] enumlist = []
for child in node.GetListOf('EnumItem'): for child in node.GetListOf('EnumItem'):
value = child.GetProperty('VALUE') value = child.GetProperty('VALUE')
...@@ -430,7 +437,7 @@ class CGen(object): ...@@ -430,7 +437,7 @@ class CGen(object):
enumlist.append('%s %s' % (comment_txt, item_txt)) enumlist.append('%s %s' % (comment_txt, item_txt))
self.LogExit('Exit DefineEnum') self.LogExit('Exit DefineEnum')
if unnamed: if unnamed or notypedef:
out = '%s\n%s\n};\n' % (out, ',\n'.join(enumlist)) out = '%s\n%s\n};\n' % (out, ',\n'.join(enumlist))
else: else:
out = '%s\n%s\n} %s;\n' % (out, ',\n'.join(enumlist), name) out = '%s\n%s\n} %s;\n' % (out, ',\n'.join(enumlist), name)
......
...@@ -97,7 +97,7 @@ class IDLLexer(object): ...@@ -97,7 +97,7 @@ class IDLLexer(object):
# Constant values # Constant values
t_FLOAT = r'-?(\d+\.\d*|\d*\.\d+)([Ee][+-]?\d+)?|-?\d+[Ee][+-]?\d+' t_FLOAT = r'-?(\d+\.\d*|\d*\.\d+)([Ee][+-]?\d+)?|-?\d+[Ee][+-]?\d+'
t_INT = r'-?[0-9]+' t_INT = r'-?[0-9]+[uU]?'
t_OCT = r'-?0[0-7]+' t_OCT = r'-?0[0-7]+'
t_HEX = r'-?0[Xx][0-9A-Fa-f]+' t_HEX = r'-?0[Xx][0-9A-Fa-f]+'
t_LSHIFT = r'<<' t_LSHIFT = r'<<'
...@@ -330,4 +330,3 @@ def Main(args): ...@@ -330,4 +330,3 @@ def Main(args):
if __name__ == '__main__': if __name__ == '__main__':
sys.exit(Main(sys.argv[1:])) sys.exit(Main(sys.argv[1:]))
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment