diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-15 03:44:13 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-15 03:44:13 +0000 |
commit | 859a7f3a9264b3a2174e9625d6cfa20412ac6081 (patch) | |
tree | b9911798925fbff065346fa6c085b254d7fb2e55 /ppapi/c | |
parent | f615770cd0412b2524b8b4451e6518608af9abed (diff) | |
download | chromium_src-859a7f3a9264b3a2174e9625d6cfa20412ac6081.zip chromium_src-859a7f3a9264b3a2174e9625d6cfa20412ac6081.tar.gz chromium_src-859a7f3a9264b3a2174e9625d6cfa20412ac6081.tar.bz2 |
Make PP_Resources associated with the Instance rather than the module. This
adds PP_Instance to the necessary places in the API to make this possible.
String and Object vars used to be PP_Resources. But it is not practical to
assocaited strings with an instance since then we can't have implicit var
constructors and have to litter every string with an instance. So this changes
vars to use their own tracking system associated with the module (i.e. keeping
the current semantics) and making it no longer a resource. I made the internal
Var IDs 32 bits since Neb is about to land his 64->32 change.
Now it force-deletes resources associated with an instance when that instance
goes away. I added some additional code and tracking in ResourceTracker to do
this. I could then remove the Instance::Observer class since the resource can
use the (now renamed) StoppedTracking to know that it's being deleted in
response to the instance being destroyed.
TEST=ppapi ui tests
BUG=none
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@71544 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/c')
-rw-r--r-- | ppapi/c/dev/ppb_buffer_dev.h | 4 | ||||
-rw-r--r-- | ppapi/c/dev/ppb_char_set_dev.h | 10 | ||||
-rw-r--r-- | ppapi/c/dev/ppb_file_io_dev.h | 4 | ||||
-rw-r--r-- | ppapi/c/dev/ppb_font_dev.h | 4 | ||||
-rw-r--r-- | ppapi/c/dev/ppb_transport_dev.h | 2 | ||||
-rw-r--r-- | ppapi/c/ppb_url_request_info.h | 6 | ||||
-rw-r--r-- | ppapi/c/private/ppb_flash.h | 22 | ||||
-rw-r--r-- | ppapi/c/private/ppb_pdf.h | 10 |
8 files changed, 32 insertions, 30 deletions
diff --git a/ppapi/c/dev/ppb_buffer_dev.h b/ppapi/c/dev/ppb_buffer_dev.h index 6788772..49252d6 100644 --- a/ppapi/c/dev/ppb_buffer_dev.h +++ b/ppapi/c/dev/ppb_buffer_dev.h @@ -6,7 +6,7 @@ #define PPAPI_C_DEV_PPB_BUFFER_DEV_H_ #include "ppapi/c/pp_bool.h" -#include "ppapi/c/pp_module.h" +#include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_stdint.h" @@ -16,7 +16,7 @@ struct PPB_Buffer_Dev { // Allocates a buffer of the given size in bytes. The return value will have // a non-zero ID on success, or zero on failure. Failure means the module // handle was invalid. The buffer will be initialized to contain zeroes. - PP_Resource (*Create)(PP_Module module, uint32_t size_in_bytes); + PP_Resource (*Create)(PP_Instance instance, uint32_t size_in_bytes); // Returns PP_TRUE if the given resource is a Buffer. Returns PP_FALSE if the // resource is invalid or some type other than a Buffer. diff --git a/ppapi/c/dev/ppb_char_set_dev.h b/ppapi/c/dev/ppb_char_set_dev.h index 74c1ca5..6aca03715 100644 --- a/ppapi/c/dev/ppb_char_set_dev.h +++ b/ppapi/c/dev/ppb_char_set_dev.h @@ -5,8 +5,8 @@ #ifndef PPAPI_C_DEV_PPB_CHAR_SET_DEV_H_ #define PPAPI_C_DEV_PPB_CHAR_SET_DEV_H_ +#include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_macros.h" -#include "ppapi/c/pp_module.h" #include "ppapi/c/pp_stdint.h" #include "ppapi/c/pp_var.h" @@ -50,7 +50,8 @@ struct PPB_CharSet_Dev { // This function will return NULL if there was an error converting the string // and you requested PP_CHARSET_CONVERSIONERROR_FAIL, or the output character // set was unknown. - char* (*UTF16ToCharSet)(const uint16_t* utf16, uint32_t utf16_len, + char* (*UTF16ToCharSet)(PP_Instance instance, + const uint16_t* utf16, uint32_t utf16_len, const char* output_char_set, enum PP_CharSet_ConversionError on_error, uint32_t* output_length); @@ -63,7 +64,8 @@ struct PPB_CharSet_Dev { // Since UTF16 can represent every Unicode character, the only time the // replacement character will be used is if the encoding in the input string // is incorrect. - uint16_t* (*CharSetToUTF16)(const char* input, uint32_t input_len, + uint16_t* (*CharSetToUTF16)(PP_Instance instance, + const char* input, uint32_t input_len, const char* input_char_set, enum PP_CharSet_ConversionError on_error, uint32_t* output_length); @@ -74,7 +76,7 @@ struct PPB_CharSet_Dev { // WARNING: You really shouldn't be using this function unless you're dealing // with legacy data. You should be using UTF-8 or UTF-16 and you don't have // to worry about the character sets. - struct PP_Var (*GetDefaultCharSet)(PP_Module module); + struct PP_Var (*GetDefaultCharSet)(PP_Instance instance); }; #endif /* PPAPI_C_DEV_PPB_CHAR_SET_DEV_H_ */ diff --git a/ppapi/c/dev/ppb_file_io_dev.h b/ppapi/c/dev/ppb_file_io_dev.h index ee7324d..0758ca9 100644 --- a/ppapi/c/dev/ppb_file_io_dev.h +++ b/ppapi/c/dev/ppb_file_io_dev.h @@ -6,8 +6,8 @@ #define PPAPI_C_DEV_PPB_FILE_IO_DEV_H_ #include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_macros.h" -#include "ppapi/c/pp_module.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_stdint.h" #include "ppapi/c/pp_time.h" @@ -44,7 +44,7 @@ PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_FileOpenFlags_Dev, 4); // Use this interface to operate on a regular file (PP_FileType_Regular). struct PPB_FileIO_Dev { // Creates a new FileIO object. Returns 0 if the module is invalid. - PP_Resource (*Create)(PP_Module module); + PP_Resource (*Create)(PP_Instance instance); // Returns PP_TRUE if the given resource is a FileIO. Returns PP_FALSE if the // resource is invalid or some type other than a FileIO. diff --git a/ppapi/c/dev/ppb_font_dev.h b/ppapi/c/dev/ppb_font_dev.h index 2262856..e2bba3c 100644 --- a/ppapi/c/dev/ppb_font_dev.h +++ b/ppapi/c/dev/ppb_font_dev.h @@ -6,8 +6,8 @@ #define PPAPI_C_DEV_PPB_FONT_DEV_H_ #include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_macros.h" -#include "ppapi/c/pp_module.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_stdint.h" #include "ppapi/c/pp_var.h" @@ -103,7 +103,7 @@ PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_TextRun_Dev, 24); struct PPB_Font_Dev { // Returns a font which best matches the given description. The return value // will have a non-zero ID on success, or zero on failure. - PP_Resource (*Create)(PP_Module module, + PP_Resource (*Create)(PP_Instance instance, const struct PP_FontDescription_Dev* description); // Returns PP_TRUE if the given resource is a Font. Returns PP_FALSE if the diff --git a/ppapi/c/dev/ppb_transport_dev.h b/ppapi/c/dev/ppb_transport_dev.h index 1e56ff4..7dc9ad3 100644 --- a/ppapi/c/dev/ppb_transport_dev.h +++ b/ppapi/c/dev/ppb_transport_dev.h @@ -18,7 +18,7 @@ struct PPB_Transport_Dev { // Creates a new transport object with the specified name // using the specified protocol. - PP_Resource (*CreateTransport)(PP_Module module, + PP_Resource (*CreateTransport)(PP_Instance instance, const char* name, const char* proto); diff --git a/ppapi/c/ppb_url_request_info.h b/ppapi/c/ppb_url_request_info.h index de7e3da..aef42bb 100644 --- a/ppapi/c/ppb_url_request_info.h +++ b/ppapi/c/ppb_url_request_info.h @@ -6,8 +6,8 @@ #define PPAPI_C_PPB_URL_REQUEST_INFO_H_ #include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_instance.h" #include "ppapi/c/pp_macros.h" -#include "ppapi/c/pp_module.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_stdint.h" #include "ppapi/c/pp_time.h" @@ -35,11 +35,11 @@ typedef enum { } PP_URLRequestProperty; PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_URLRequestProperty, 4); -#define PPB_URLREQUESTINFO_INTERFACE "PPB_URLRequestInfo;0.1" +#define PPB_URLREQUESTINFO_INTERFACE "PPB_URLRequestInfo;0.2" struct PPB_URLRequestInfo { // Create a new URLRequestInfo object. Returns 0 if the module is invalid. - PP_Resource (*Create)(PP_Module module); + PP_Resource (*Create)(PP_Instance instance); // Returns PP_TRUE if the given resource is an URLRequestInfo. Returns // PP_FALSE if the resource is invalid or some type other than an diff --git a/ppapi/c/private/ppb_flash.h b/ppapi/c/private/ppb_flash.h index 49535e4..f689772 100644 --- a/ppapi/c/private/ppb_flash.h +++ b/ppapi/c/private/ppb_flash.h @@ -11,7 +11,6 @@ #include "ppapi/c/pp_errors.h" #include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_module.h" #include "ppapi/c/pp_point.h" #include "ppapi/c/pp_rect.h" #include "ppapi/c/pp_resource.h" @@ -19,7 +18,7 @@ // PPB_Flash ------------------------------------------------------------------- -#define PPB_FLASH_INTERFACE "PPB_Flash;2" +#define PPB_FLASH_INTERFACE "PPB_Flash;3" #ifdef _WIN32 typedef HANDLE PP_FileHandle; @@ -49,7 +48,8 @@ struct PPB_Flash { // this case. void (*SetInstanceAlwaysOnTop)(PP_Instance instance, bool on_top); - bool (*DrawGlyphs)(PP_Resource pp_image_data, + bool (*DrawGlyphs)(PP_Instance instance, + PP_Resource pp_image_data, const PP_FontDescription_Dev* font_desc, uint32_t color, PP_Point position, @@ -61,21 +61,21 @@ struct PPB_Flash { // Retrieves the proxy that will be used for the given URL. The result will // be a string in PAC format, or an undefined var on error. - PP_Var (*GetProxyForURL)(PP_Module module, const char* url); + PP_Var (*GetProxyForURL)(PP_Instance instance, const char* url); // Opens a module-local file, returning a file descriptor (posix) or a HANDLE // (win32) into file. Module-local file paths (here and below) are // '/'-separated UTF-8 strings, relative to a module-specific root. The return // value is the ppapi error, PP_OK if success, one of the PP_ERROR_* in case // of failure. - int32_t (*OpenModuleLocalFile)(PP_Module module, + int32_t (*OpenModuleLocalFile)(PP_Instance instance, const char* path, int32_t mode, PP_FileHandle* file); // Renames a module-local file. The return value is the ppapi error, PP_OK if // success, one of the PP_ERROR_* in case of failure. - int32_t (*RenameModuleLocalFile)(PP_Module module, + int32_t (*RenameModuleLocalFile)(PP_Instance instance, const char* path_from, const char* path_to); @@ -83,17 +83,17 @@ struct PPB_Flash { // points to a directory, deletes all the contents of the directory. The // return value is the ppapi error, PP_OK if success, one of the PP_ERROR_* in // case of failure. - int32_t (*DeleteModuleLocalFileOrDir)(PP_Module module, + int32_t (*DeleteModuleLocalFileOrDir)(PP_Instance instance, const char* path, bool recursive); // Creates a module-local directory. The return value is the ppapi error, // PP_OK if success, one of the PP_ERROR_* in case of failure. - int32_t (*CreateModuleLocalDir)(PP_Module module, const char* path); + int32_t (*CreateModuleLocalDir)(PP_Instance instance, const char* path); // Queries information about a module-local file. The return value is the // ppapi error, PP_OK if success, one of the PP_ERROR_* in case of failure. - int32_t (*QueryModuleLocalFile)(PP_Module module, + int32_t (*QueryModuleLocalFile)(PP_Instance instance, const char* path, PP_FileInfo_Dev* info); @@ -101,12 +101,12 @@ struct PPB_Flash { // value is the ppapi error, PP_OK if success, one of the PP_ERROR_* in case // of failure. If non-NULL, the returned contents should be freed with // FreeModuleLocalDirContents. - int32_t (*GetModuleLocalDirContents)(PP_Module module, + int32_t (*GetModuleLocalDirContents)(PP_Instance instance, const char* path, PP_DirContents_Dev** contents); // Frees the data allocated by GetModuleLocalDirContents. - void (*FreeModuleLocalDirContents)(PP_Module module, + void (*FreeModuleLocalDirContents)(PP_Instance instance, PP_DirContents_Dev* contents); // Navigate to URL. May open a new tab if target is not "_self". Return true diff --git a/ppapi/c/private/ppb_pdf.h b/ppapi/c/private/ppb_pdf.h index 8a03525..cdc384a 100644 --- a/ppapi/c/private/ppb_pdf.h +++ b/ppapi/c/private/ppb_pdf.h @@ -7,7 +7,6 @@ #include "ppapi/c/dev/ppb_font_dev.h" #include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_module.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/pp_var.h" @@ -83,10 +82,11 @@ struct PP_PrivateFindResult { struct PPB_PDF { // Returns a localized string. - PP_Var (*GetLocalizedString)(PP_Module module, PP_ResourceString string_id); + PP_Var (*GetLocalizedString)(PP_Instance instance, + PP_ResourceString string_id); // Returns a resource image. - PP_Resource (*GetResourceImage)(PP_Module module, + PP_Resource (*GetResourceImage)(PP_Instance instance, PP_ResourceImage image_id); // Returns a resource identifying a font file corresponding to the given font @@ -94,7 +94,7 @@ struct PPB_PDF { // // Currently Linux-only. PP_Resource (*GetFontFileWithFallback)( - PP_Module module, + PP_Instance instance, const PP_FontDescription_Dev* description, PP_PrivateFontCharset charset); @@ -108,7 +108,7 @@ struct PPB_PDF { // Search the given string using ICU. Use PPB_Core's MemFree on results when // done. void (*SearchString)( - PP_Module module, + PP_Instance instance, const unsigned short* string, const unsigned short* term, bool case_sensitive, |