diff options
-rw-r--r-- | ppapi/proxy/dispatcher.cc | 16 | ||||
-rw-r--r-- | ppapi/proxy/interface_id.h | 7 | ||||
-rw-r--r-- | ppapi/proxy/plugin_resource.h | 5 | ||||
-rw-r--r-- | ppapi/proxy/plugin_resource_tracker.cc | 19 | ||||
-rw-r--r-- | ppapi/proxy/plugin_resource_tracker.h | 25 | ||||
-rw-r--r-- | ppapi/proxy/plugin_var_tracker.cc | 2 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_messages_internal.h | 146 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_param_traits.cc | 107 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_param_traits.h | 31 | ||||
-rw-r--r-- | ppapi/proxy/ppb_var_deprecated_proxy.cc | 43 | ||||
-rw-r--r-- | ppapi/proxy/ppb_var_deprecated_proxy.h | 9 |
11 files changed, 342 insertions, 68 deletions
diff --git a/ppapi/proxy/dispatcher.cc b/ppapi/proxy/dispatcher.cc index e2c6f1e..3a0f5a4 100644 --- a/ppapi/proxy/dispatcher.cc +++ b/ppapi/proxy/dispatcher.cc @@ -13,6 +13,10 @@ #include "ipc/ipc_sync_channel.h" #include "ppapi/proxy/interface_proxy.h" #include "ppapi/proxy/ppapi_messages.h" +#include "ppapi/c/dev/ppb_testing_dev.h" +#include "ppapi/c/dev/ppb_url_loader_dev.h" +#include "ppapi/c/dev/ppb_url_request_info_dev.h" +#include "ppapi/c/dev/ppb_url_response_info_dev.h" #include "ppapi/c/dev/ppb_var_deprecated.h" #include "ppapi/c/pp_errors.h" #include "ppapi/c/ppb_core.h" @@ -24,6 +28,10 @@ #include "ppapi/proxy/ppb_graphics_2d_proxy.h" #include "ppapi/proxy/ppb_image_data_proxy.h" #include "ppapi/proxy/ppb_instance_proxy.h" +#include "ppapi/proxy/ppb_testing_proxy.h" +#include "ppapi/proxy/ppb_url_loader_proxy.h" +#include "ppapi/proxy/ppb_url_request_info_proxy.h" +#include "ppapi/proxy/ppb_url_response_info_proxy.h" #include "ppapi/proxy/ppb_var_deprecated_proxy.h" #include "ppapi/proxy/ppp_class_proxy.h" #include "ppapi/proxy/ppp_instance_proxy.h" @@ -202,6 +210,14 @@ InterfaceProxy* Dispatcher::CreateProxyForInterface( return new PPB_ImageData_Proxy(this, interface_functions); if (interface_name == PPB_INSTANCE_INTERFACE) return new PPB_Instance_Proxy(this, interface_functions); + if (interface_name == PPB_TESTING_DEV_INTERFACE) + return new PPB_Testing_Proxy(this, interface_functions); + if (interface_name == PPB_URLLOADER_DEV_INTERFACE) + return new PPB_URLLoader_Proxy(this, interface_functions); + if (interface_name == PPB_URLREQUESTINFO_DEV_INTERFACE) + return new PPB_URLRequestInfo_Proxy(this, interface_functions); + if (interface_name == PPB_URLRESPONSEINFO_DEV_INTERFACE) + return new PPB_URLResponseInfo_Proxy(this, interface_functions); if (interface_name == PPB_VAR_DEPRECATED_INTERFACE) return new PPB_Var_Deprecated_Proxy(this, interface_functions); if (interface_name == PPP_INSTANCE_INTERFACE) diff --git a/ppapi/proxy/interface_id.h b/ppapi/proxy/interface_id.h index 8f5ad9b..c85bfc9 100644 --- a/ppapi/proxy/interface_id.h +++ b/ppapi/proxy/interface_id.h @@ -12,11 +12,16 @@ namespace proxy { // to route messages to the appropriate message handler. enum InterfaceID { // Zero is reserved for control messages. - INTERFACE_ID_PPB_CORE = 1, + INTERFACE_ID_PPB_CHAR_SET = 1, + INTERFACE_ID_PPB_CORE, + INTERFACE_ID_PPB_FONT, INTERFACE_ID_PPB_GRAPHICS_2D, INTERFACE_ID_PPB_IMAGE_DATA, INTERFACE_ID_PPB_INSTANCE, + INTERFACE_ID_PPB_TESTING, INTERFACE_ID_PPB_URL_LOADER, + INTERFACE_ID_PPB_URL_REQUEST_INFO, + INTERFACE_ID_PPB_URL_RESPONSE_INFO, INTERFACE_ID_PPB_VAR, INTERFACE_ID_PPB_VAR_DEPRECATED, diff --git a/ppapi/proxy/plugin_resource.h b/ppapi/proxy/plugin_resource.h index 9a70266..072f2cb 100644 --- a/ppapi/proxy/plugin_resource.h +++ b/ppapi/proxy/plugin_resource.h @@ -11,9 +11,12 @@ // If you inherit from resource, make sure you add the class name here. #define FOR_ALL_RESOURCES(F) \ + F(Font) \ F(Graphics2D) \ F(ImageData) \ - F(URLLoader) + F(URLLoader) \ + F(URLRequestInfo)\ + F(URLResponseInfo) namespace pp { namespace proxy { diff --git a/ppapi/proxy/plugin_resource_tracker.cc b/ppapi/proxy/plugin_resource_tracker.cc index a285311..84a0054 100644 --- a/ppapi/proxy/plugin_resource_tracker.cc +++ b/ppapi/proxy/plugin_resource_tracker.cc @@ -67,6 +67,25 @@ void PluginResourceTracker::ReleaseResource(PP_Resource resource) { ReleasePluginResourceRef(resource, true); } +bool PluginResourceTracker::PreparePreviouslyTrackedResource( + PP_Resource resource) { + ResourceMap::iterator found = resource_map_.find(resource); + if (found == resource_map_.end()) + return false; // We've not seen this resource before. + + // We have already seen this resource and the caller wants the plugin to + // have one more ref to the object (this function is called when retuning + // a resource). + // + // This is like the PluginVarTracker::ReceiveObjectPassRef. We do an AddRef + // in the plugin for the additional ref, and then a Release in the renderer + // because the code in the renderer addrefed on behalf of the caller. + found->second.ref_count++; + dispatcher_->Send(new PpapiHostMsg_PPBCore_ReleaseResource( + INTERFACE_ID_PPB_CORE, resource)); + return true; +} + void PluginResourceTracker::ReleasePluginResourceRef( const PP_Resource& resource, bool notify_browser_on_release) { diff --git a/ppapi/proxy/plugin_resource_tracker.h b/ppapi/proxy/plugin_resource_tracker.h index a9ea963..a758744 100644 --- a/ppapi/proxy/plugin_resource_tracker.h +++ b/ppapi/proxy/plugin_resource_tracker.h @@ -33,6 +33,31 @@ class PluginResourceTracker { void AddRefResource(PP_Resource resource); void ReleaseResource(PP_Resource resource); + // Checks if the resource just returned from the renderer is already + // tracked by the plugin side and adjusts the refcounts if so. + // + // When the browser returns a PP_Resource, it could be a new one, in which + // case the proxy wants to create a corresponding object and call + // AddResource() on it. However, if the resouce is already known, then the + // refcount needs to be adjusted in both the plugin and the renderer side + // and no such object needs to be created. + // + // Returns true if the resource was previously known. The refcount will be + // fixed up such that it's ready to use by the plugin. A proxy can then + // just return the resource without doing any more work. + // + // Typical usage: + // + // PP_Resource result; + // dispatcher->Send(new MyMessage(..., &result)); + // if (dispatcher->plugin_resource_tracker()-> + // PreparePreviouslyTrackedResource(result)) + // return result; + // ... create resource object ... + // dispatcher->plugin_resource_tracker()->AddResource(result, object); + // return result; + bool PreparePreviouslyTrackedResource(PP_Resource resource); + private: struct ResourceInfo { ResourceInfo(); diff --git a/ppapi/proxy/plugin_var_tracker.cc b/ppapi/proxy/plugin_var_tracker.cc index 49f7d3f..dabdf8f 100644 --- a/ppapi/proxy/plugin_var_tracker.cc +++ b/ppapi/proxy/plugin_var_tracker.cc @@ -121,7 +121,7 @@ void PluginVarTracker::SendAddRefObjectMsg(int64_t id) { void PluginVarTracker::SendReleaseObjectMsg(int64_t id) { dispatcher_->Send(new PpapiHostMsg_PPBVar_ReleaseObject( - INTERFACE_ID_PPB_VAR_DEPRECATED, id)); + INTERFACE_ID_PPB_VAR_DEPRECATED, id)); } } // namesace proxy diff --git a/ppapi/proxy/ppapi_messages_internal.h b/ppapi/proxy/ppapi_messages_internal.h index f99f4cc..e5a8222 100644 --- a/ppapi/proxy/ppapi_messages_internal.h +++ b/ppapi/proxy/ppapi_messages_internal.h @@ -93,7 +93,7 @@ IPC_BEGIN_MESSAGES(Ppapi) PP_Instance /* instance */, std::vector<std::string> /* argn */, std::vector<std::string> /* argv */, - bool /* result */) + PP_Bool /* result */) IPC_MESSAGE_ROUTED1(PpapiMsg_PPPInstance_DidDestroy, PP_Instance /* instance */) IPC_MESSAGE_ROUTED3(PpapiMsg_PPPInstance_DidChangeView, @@ -102,15 +102,15 @@ IPC_BEGIN_MESSAGES(Ppapi) PP_Rect /* clip */) IPC_MESSAGE_ROUTED2(PpapiMsg_PPPInstance_DidChangeFocus, PP_Instance /* instance */, - bool /* has_focus */) + PP_Bool /* has_focus */) IPC_SYNC_MESSAGE_ROUTED2_1(PpapiMsg_PPPInstance_HandleInputEvent, PP_Instance /* instance */, PP_InputEvent /* event */, - bool /* result */) + PP_Bool /* result */) IPC_SYNC_MESSAGE_ROUTED2_1(PpapiMsg_PPPInstance_HandleDocumentLoad, PP_Instance /* instance */, PP_Resource /* url_loader */, - bool /* result */) + PP_Bool /* result */) IPC_SYNC_MESSAGE_ROUTED1_1(PpapiMsg_PPPInstance_GetInstanceObject, PP_Instance /* instance */, pp::proxy::SerializedVar /* result */) @@ -124,6 +124,10 @@ IPC_BEGIN_MESSAGES(Ppapi) int64 /* total_bytes_to_be_sent */, int64 /* bytes_received */, int64 /* total_bytes_to_be_received */) + IPC_MESSAGE_ROUTED3(PpapiMsg_PPBURLLoader_ReadResponseBody_Ack, + PP_Resource /* loader */, + int32 /* result */, + std::string /* data */) IPC_END_MESSAGES(Ppapi) // ----------------------------------------------------------------------------- @@ -136,20 +140,63 @@ IPC_BEGIN_MESSAGES(PpapiHost) // PPB_Core. IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBCore_AddRefResource, PP_Resource) IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBCore_ReleaseResource, PP_Resource) - IPC_SYNC_MESSAGE_ROUTED0_1(PpapiHostMsg_PPBCore_GetTime, - double /* return value -> time */) - IPC_SYNC_MESSAGE_ROUTED0_1(PpapiHostMsg_PPBCore_GetTimeTicks, - double /* return value -> time */) - IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBCore_CallOnMainThread, - int /* delay_in_msec */, - uint32_t /* serialized_callback */, - int32_t /* result */) + + // PPB_CharSet. + IPC_SYNC_MESSAGE_ROUTED3_2(PpapiHostMsg_PPBCharSet_UTF16ToCharSet, + string16 /* utf16 */, + std::string /* char_set */, + int32_t /* on_error */, + std::string /* output */, + bool /* output_is_success */) + IPC_SYNC_MESSAGE_ROUTED3_2(PpapiHostMsg_PPBCharSet_CharSetToUTF16, + std::string /* input */, + std::string /* char_set */, + int32_t /* on_error */, + string16 /* output */, + bool /* output_is_success */) + IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBCharSet_GetDefaultCharSet, + PP_Module /* module */, + pp::proxy::SerializedVar /* result */) + + // PPB_Font. + IPC_SYNC_MESSAGE_ROUTED2_3( + PpapiHostMsg_PPBFont_Create, + PP_Module /* pp_module */, + pp::proxy::SerializedFontDescription /* in_description */, + PP_Resource /* result */, + pp::proxy::SerializedFontDescription /* out_description */, + std::string /* out_metrics */) + IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFont_DrawTextAt, + pp::proxy::SerializedVar /* text */, + pp::proxy::PPBFont_DrawTextAt_Params /* params */, + PP_Bool /* result */) + IPC_SYNC_MESSAGE_ROUTED4_1(PpapiHostMsg_PPBFont_MeasureText, + PP_Resource /* font */, + pp::proxy::SerializedVar /* text */, + PP_Bool /* text_is_rtl */, + PP_Bool /* override_direction */, + int32_t /* result */) + IPC_SYNC_MESSAGE_ROUTED5_1(PpapiHostMsg_PPBFont_CharacterOffsetForPixel, + PP_Resource /* font */, + pp::proxy::SerializedVar /* text */, + PP_Bool /* text_is_rtl */, + PP_Bool /* override_direction */, + int32_t /* pixel_pos */, + uint32_t /* result */) + IPC_SYNC_MESSAGE_ROUTED5_1(PpapiHostMsg_PPBFont_PixelOffsetForCharacter, + PP_Resource /* font */, + pp::proxy::SerializedVar /* text */, + PP_Bool /* text_is_rtl */, + PP_Bool /* override_direction */, + uint32_t /* char_offset */, + int32_t /* result */) + // PPB_Graphics2D. IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBGraphics2D_Create, PP_Module /* module */, PP_Size /* size */, - bool /* is_always_opaque */, + PP_Bool /* is_always_opaque */, PP_Resource /* result */) IPC_MESSAGE_ROUTED5(PpapiHostMsg_PPBGraphics2D_PaintImageData, PP_Resource /* graphics_2d */, @@ -177,12 +224,12 @@ IPC_BEGIN_MESSAGES(PpapiHost) IPC_SYNC_MESSAGE_ROUTED1_1( PpapiHostMsg_PPBImageData_IsImageDataFormatSupported, int32 /* format */, - bool /* result */) + PP_Bool /* result */) IPC_SYNC_MESSAGE_ROUTED4_3(PpapiHostMsg_PPBImageData_Create, PP_Module /* module */, int32 /* format */, PP_Size /* size */, - bool /* init_to_zero */, + PP_Bool /* init_to_zero */, PP_Resource /* result_resource */, std::string /* image_data_desc */, uint64_t /* result_shm_handle */) @@ -197,16 +244,29 @@ IPC_BEGIN_MESSAGES(PpapiHost) IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBInstance_BindGraphics, PP_Instance /* instance */, PP_Resource /* device */, - bool /* result */) + PP_Bool /* result */) IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBInstance_IsFullFrame, PP_Instance /* instance */, - bool /* result */) + PP_Bool /* result */) IPC_SYNC_MESSAGE_ROUTED2_2(PpapiHostMsg_PPBInstance_ExecuteScript, PP_Instance /* instance */, pp::proxy::SerializedVar /* script */, pp::proxy::SerializedVar /* out_exception */, pp::proxy::SerializedVar /* result */) + // PPB_Testing. + IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBTesting_ReadImageData, + PP_Resource /* device_context_2d */, + PP_Resource /* image */, + PP_Point /* top_left */, + PP_Bool /* result */) + IPC_SYNC_MESSAGE_ROUTED0_1(PpapiHostMsg_PPBTesting_RunMessageLoop, + bool /* dummy since there's no 0_0 variant */) + IPC_MESSAGE_ROUTED0(PpapiHostMsg_PPBTesting_QuitMessageLoop) + IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBTesting_GetLiveObjectCount, + PP_Module /* module */, + uint32 /* result */) + // PPB_URLLoader. IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBURLLoader_Create, PP_Instance /* instance */, @@ -218,29 +278,45 @@ IPC_BEGIN_MESSAGES(PpapiHost) IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBURLLoader_FollowRedirect, PP_Resource /* loader */, uint32_t /* serialized_callback */) - IPC_SYNC_MESSAGE_ROUTED1_3(PpapiHostMsg_PPBURLLoader_GetUploadProgress, - PP_Resource /* loader */, - int64 /* bytes_sent */, - int64 /* total_bytes_to_be_sent */, - bool /* result */) - IPC_SYNC_MESSAGE_ROUTED1_3(PpapiHostMsg_PPBURLLoader_GetDownloadProgress, - PP_Resource /* loader */, - int64 /* bytes_received */, - int64 /* total_bytes_to_be_received */, - bool /* result */) IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBURLLoader_GetResponseInfo, PP_Resource /* loader */, PP_Resource /* response_info_out */) - IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBURLLoader_ReadResponseBody, + IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBURLLoader_ReadResponseBody, PP_Resource /* loader */, - int32_t /* bytes_to_read */, - uint32_t /* serialized_callback */) + int32_t /* bytes_to_read */) IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBURLLoader_FinishStreamingToFile, PP_Resource /* loader */, uint32_t /* serialized_callback */) IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBURLLoader_Close, PP_Resource /* loader */) + // PPB_URLRequestInfo. + IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBURLRequestInfo_Create, + PP_Module /* module */, + PP_Resource /* result */) + IPC_MESSAGE_ROUTED3(PpapiHostMsg_PPBURLRequestInfo_SetProperty, + PP_Resource /* request */, + int32_t /* property */, + pp::proxy::SerializedVar /* value */) + IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBURLRequestInfo_AppendDataToBody, + PP_Resource /* request */, + std::string /* data */) + IPC_MESSAGE_ROUTED5(PpapiHostMsg_PPBURLRequestInfo_AppendFileToBody, + PP_Resource /* request */, + PP_Resource /* file_ref */, + int64_t /* start_offset */, + int64_t /* number_of_bytes */, + double /* expected_last_modified_time */) + + // PPB_URLResponseInfo. + IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBURLResponseInfo_GetProperty, + PP_Resource /* response */, + int32_t /* property */, + pp::proxy::SerializedVar /* result */) + IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBURLResponseInfo_GetBody, + PP_Resource /* response */, + PP_Resource /* file_ref_result */) + // PPB_Var. IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBVar_AddRefObject, int64 /* object_id */) @@ -260,12 +336,12 @@ IPC_BEGIN_MESSAGES(PpapiHost) pp::proxy::SerializedVar /* object */, pp::proxy::SerializedVar /* property */, pp::proxy::SerializedVar /* out_exception */, - bool /* result */) + PP_Bool /* result */) IPC_SYNC_MESSAGE_ROUTED2_2(PpapiHostMsg_PPBVar_HasMethodDeprecated, pp::proxy::SerializedVar /* object */, pp::proxy::SerializedVar /* method */, pp::proxy::SerializedVar /* out_exception */, - bool /* result */) + PP_Bool /* result */) IPC_SYNC_MESSAGE_ROUTED2_2(PpapiHostMsg_PPBVar_GetProperty, pp::proxy::SerializedVar /* object */, pp::proxy::SerializedVar /* property */, @@ -275,7 +351,7 @@ IPC_BEGIN_MESSAGES(PpapiHost) pp::proxy::SerializedVar /* object */, pp::proxy::SerializedVar /* property */, pp::proxy::SerializedVar /* out_exception */, - bool /* result */) + PP_Bool /* result */) IPC_SYNC_MESSAGE_ROUTED1_2(PpapiHostMsg_PPBVar_EnumerateProperties, pp::proxy::SerializedVar /* object */, std::vector<pp::proxy::SerializedVar> /* props */, @@ -287,7 +363,7 @@ IPC_BEGIN_MESSAGES(PpapiHost) pp::proxy::SerializedVar /* out_exception */) IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBVar_IsCallable, pp::proxy::SerializedVar /* object */, - bool /* result */) + PP_Bool /* result */) IPC_SYNC_MESSAGE_ROUTED4_2(PpapiHostMsg_PPBVar_Call, pp::proxy::SerializedVar /* object */, pp::proxy::SerializedVar /* this_object */, @@ -310,7 +386,7 @@ IPC_BEGIN_MESSAGES(PpapiHost) pp::proxy::SerializedVar /* var */, int64 /* object_class */, int64 /* object-data */, - bool /* result */) + PP_Bool /* result */) IPC_SYNC_MESSAGE_ROUTED3_1(PpapiHostMsg_PPBVar_CreateObjectDeprecated, PP_Module /* module */, int64 /* object_class */, diff --git a/ppapi/proxy/ppapi_param_traits.cc b/ppapi/proxy/ppapi_param_traits.cc index 4bfe23c..04c014b 100644 --- a/ppapi/proxy/ppapi_param_traits.cc +++ b/ppapi/proxy/ppapi_param_traits.cc @@ -6,10 +6,38 @@ #include <string.h> // For memcpy +#include "ppapi/c/pp_resource.h" +#include "ppapi/proxy/interface_proxy.h" +#include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/serialized_var.h" namespace IPC { +// PP_Bool --------------------------------------------------------------------- + +// static +void ParamTraits<PP_Bool>::Write(Message* m, const param_type& p) { + ParamTraits<bool>::Write(m, pp::proxy::PPBoolToBool(p)); +} + +// static +bool ParamTraits<PP_Bool>::Read(const Message* m, void** iter, param_type* r) { + // We specifically want to be strict here about what types of input we accept, + // which ParamTraits<bool> does for us. We don't want to deserialize "2" into + // a PP_Bool, for example. + bool result = false; + if (!ParamTraits<bool>::Read(m, iter, &result)) + return false; + *r = pp::proxy::BoolToPPBool(result); + return true; +} + +// static +void ParamTraits<PP_Bool>::Log(const param_type& p, std::string* l) { +} + +// PP_InputEvent --------------------------------------------------------------- + // static void ParamTraits<PP_InputEvent>::Write(Message* m, const param_type& p) { // PP_InputEvent is just POD so we can just memcpy it. @@ -111,6 +139,46 @@ bool ParamTraits<PP_Size>::Read(const Message* m, void** iter, param_type* r) { void ParamTraits<PP_Size>::Log(const param_type& p, std::string* l) { } +// PPBFont_DrawTextAt_Params --------------------------------------------------- + +// static +void ParamTraits<pp::proxy::PPBFont_DrawTextAt_Params>::Write( + Message* m, + const param_type& p) { + ParamTraits<PP_Resource>::Write(m, p.font); + ParamTraits<PP_Resource>::Write(m, p.image_data); + ParamTraits<PP_Bool>::Write(m, p.text_is_rtl); + ParamTraits<PP_Bool>::Write(m, p.override_direction); + ParamTraits<PP_Point>::Write(m, p.position); + ParamTraits<uint32_t>::Write(m, p.color); + ParamTraits<PP_Rect>::Write(m, p.clip); + ParamTraits<bool>::Write(m, p.clip_is_null); + ParamTraits<PP_Bool>::Write(m, p.image_data_is_opaque); +} + +// static +bool ParamTraits<pp::proxy::PPBFont_DrawTextAt_Params>::Read( + const Message* m, + void** iter, + param_type* r) { + return + ParamTraits<PP_Resource>::Read(m, iter, &r->font) && + ParamTraits<PP_Resource>::Read(m, iter, &r->image_data) && + ParamTraits<PP_Bool>::Read(m, iter, &r->text_is_rtl) && + ParamTraits<PP_Bool>::Read(m, iter, &r->override_direction) && + ParamTraits<PP_Point>::Read(m, iter, &r->position) && + ParamTraits<uint32_t>::Read(m, iter, &r->color) && + ParamTraits<PP_Rect>::Read(m, iter, &r->clip) && + ParamTraits<bool>::Read(m, iter, &r->clip_is_null) && + ParamTraits<PP_Bool>::Read(m, iter, &r->image_data_is_opaque); +} + +// static +void ParamTraits<pp::proxy::PPBFont_DrawTextAt_Params>::Log( + const param_type& p, + std::string* l) { +} + // SerializedVar --------------------------------------------------------------- // static @@ -131,6 +199,44 @@ void ParamTraits<pp::proxy::SerializedVar>::Log(const param_type& p, std::string* l) { } +// pp::proxy::SerializedFontDescription ---------------------------------------- + +// static +void ParamTraits<pp::proxy::SerializedFontDescription>::Write( + Message* m, + const param_type& p) { + ParamTraits<pp::proxy::SerializedVar>::Write(m, p.face); + ParamTraits<int32_t>::Write(m, p.family); + ParamTraits<uint32_t>::Write(m, p.size); + ParamTraits<int32_t>::Write(m, p.weight); + ParamTraits<PP_Bool>::Write(m, p.italic); + ParamTraits<PP_Bool>::Write(m, p.small_caps); + ParamTraits<int32_t>::Write(m, p.letter_spacing); + ParamTraits<int32_t>::Write(m, p.word_spacing); +} + +// static +bool ParamTraits<pp::proxy::SerializedFontDescription>::Read( + const Message* m, + void** iter, + param_type* r) { + return + ParamTraits<pp::proxy::SerializedVar>::Read(m, iter, &r->face) && + ParamTraits<int32_t>::Read(m, iter, &r->family) && + ParamTraits<uint32_t>::Read(m, iter, &r->size) && + ParamTraits<int32_t>::Read(m, iter, &r->weight) && + ParamTraits<PP_Bool>::Read(m, iter, &r->italic) && + ParamTraits<PP_Bool>::Read(m, iter, &r->small_caps) && + ParamTraits<int32_t>::Read(m, iter, &r->letter_spacing) && + ParamTraits<int32_t>::Read(m, iter, &r->word_spacing); +} + +// static +void ParamTraits<pp::proxy::SerializedFontDescription>::Log( + const param_type& p, + std::string* l) { +} + // std::vector<SerializedVar> -------------------------------------------------- void ParamTraits< std::vector<pp::proxy::SerializedVar> >::Write( @@ -186,5 +292,4 @@ void ParamTraits< std::vector<pp::proxy::SerializedVar> >::Log( std::string* l) { } - } // namespace IPC diff --git a/ppapi/proxy/ppapi_param_traits.h b/ppapi/proxy/ppapi_param_traits.h index e8c17d8..0c13ff5 100644 --- a/ppapi/proxy/ppapi_param_traits.h +++ b/ppapi/proxy/ppapi_param_traits.h @@ -12,10 +12,12 @@ #include "ppapi/c/pp_var.h" #include "ppapi/proxy/serialized_var.h" // TODO(brettw) eraseme. -class PP_ObjectProperty; +struct PP_ObjectProperty; namespace pp { namespace proxy { +struct PPBFont_DrawTextAt_Params; +class SerializedFontDescription; class SerializedVar; } } @@ -23,6 +25,14 @@ class SerializedVar; namespace IPC { template<> +struct ParamTraits<PP_Bool> { + typedef PP_Bool param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); +}; + +template<> struct ParamTraits<PP_InputEvent> { typedef PP_InputEvent param_type; static void Write(Message* m, const param_type& p); @@ -63,6 +73,22 @@ struct ParamTraits<PP_Size> { }; template<> +struct ParamTraits<pp::proxy::PPBFont_DrawTextAt_Params> { + typedef pp::proxy::PPBFont_DrawTextAt_Params param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); +}; + +template<> +struct ParamTraits<pp::proxy::SerializedFontDescription> { + typedef pp::proxy::SerializedFontDescription param_type; + static void Write(Message* m, const param_type& p); + static bool Read(const Message* m, void** iter, param_type* r); + static void Log(const param_type& p, std::string* l); +}; + +template<> struct ParamTraits<pp::proxy::SerializedVar> { typedef pp::proxy::SerializedVar param_type; static void Write(Message* m, const param_type& p); @@ -70,9 +96,6 @@ struct ParamTraits<pp::proxy::SerializedVar> { static void Log(const param_type& p, std::string* l); }; -// We need a special implementation of sending a vector of SerializedVars -// because the behavior of vector doesn't always play nicely with our -// weird SerializedVar implementation (see "Read" in the .cc file). template<> struct ParamTraits< std::vector<pp::proxy::SerializedVar> > { typedef std::vector<pp::proxy::SerializedVar> param_type; diff --git a/ppapi/proxy/ppb_var_deprecated_proxy.cc b/ppapi/proxy/ppb_var_deprecated_proxy.cc index 8b5aff3..42abbc7 100644 --- a/ppapi/proxy/ppb_var_deprecated_proxy.cc +++ b/ppapi/proxy/ppb_var_deprecated_proxy.cc @@ -11,7 +11,6 @@ #include "ppapi/c/pp_var.h" #include "ppapi/c/ppb_core.h" #include "ppapi/proxy/plugin_dispatcher.h" -#include "ppapi/proxy/ppapi_message_helpers.h" #include "ppapi/proxy/ppapi_messages.h" #include "ppapi/proxy/ppp_class_proxy.h" #include "ppapi/proxy/serialized_var.h" @@ -57,14 +56,14 @@ bool HasProperty(PP_Var var, PP_Var* exception) { Dispatcher* dispatcher = PluginDispatcher::Get(); ReceiveSerializedException se(dispatcher, exception); - bool result = false; + PP_Bool result = PP_FALSE; if (!se.IsThrown()) { dispatcher->Send(new PpapiHostMsg_PPBVar_HasProperty( INTERFACE_ID_PPB_VAR_DEPRECATED, SerializedVarSendInput(dispatcher, var), SerializedVarSendInput(dispatcher, name), &se, &result)); } - return result; + return PPBoolToBool(result); } bool HasMethod(PP_Var var, @@ -72,14 +71,14 @@ bool HasMethod(PP_Var var, PP_Var* exception) { Dispatcher* dispatcher = PluginDispatcher::Get(); ReceiveSerializedException se(dispatcher, exception); - bool result = false; + PP_Bool result = PP_FALSE; if (!se.IsThrown()) { dispatcher->Send(new PpapiHostMsg_PPBVar_HasMethodDeprecated( INTERFACE_ID_PPB_VAR_DEPRECATED, SerializedVarSendInput(dispatcher, var), SerializedVarSendInput(dispatcher, name), &se, &result)); } - return result; + return PPBoolToBool(result); } PP_Var GetProperty(PP_Var var, @@ -134,7 +133,7 @@ void RemoveProperty(PP_Var var, PP_Var* exception) { Dispatcher* dispatcher = PluginDispatcher::Get(); ReceiveSerializedException se(dispatcher, exception); - bool result = false; + PP_Bool result = PP_FALSE; if (!se.IsThrown()) { dispatcher->Send(new PpapiHostMsg_PPBVar_DeleteProperty( INTERFACE_ID_PPB_VAR_DEPRECATED, @@ -184,9 +183,9 @@ PP_Var Construct(PP_Var object, } bool IsInstanceOf(PP_Var var, - const PPP_Class_Deprecated* ppp_class, - void** ppp_class_data) { - bool result = false; + const PPP_Class_Deprecated* ppp_class, + void** ppp_class_data) { + PP_Bool result = PP_FALSE; Dispatcher* dispatcher = PluginDispatcher::Get(); int64 class_int = static_cast<int64>(reinterpret_cast<intptr_t>(ppp_class)); int64 class_data_int = 0; @@ -195,7 +194,7 @@ bool IsInstanceOf(PP_Var var, class_int, &class_data_int, &result)); *ppp_class_data = reinterpret_cast<void*>(static_cast<intptr_t>(class_data_int)); - return result; + return PPBoolToBool(result); } PP_Var CreateObject(PP_Module module_id, @@ -278,20 +277,22 @@ void PPB_Var_Deprecated_Proxy::OnMsgHasProperty( SerializedVarReceiveInput var, SerializedVarReceiveInput name, SerializedVarOutParam exception, - bool* result) { - *result = ppb_var_target()->HasProperty(var.Get(dispatcher()), - name.Get(dispatcher()), - exception.OutParam(dispatcher())); + PP_Bool* result) { + *result = BoolToPPBool(ppb_var_target()->HasProperty( + var.Get(dispatcher()), + name.Get(dispatcher()), + exception.OutParam(dispatcher()))); } void PPB_Var_Deprecated_Proxy::OnMsgHasMethodDeprecated( SerializedVarReceiveInput var, SerializedVarReceiveInput name, SerializedVarOutParam exception, - bool* result) { - *result = ppb_var_target()->HasMethod(var.Get(dispatcher()), - name.Get(dispatcher()), - exception.OutParam(dispatcher())); + PP_Bool* result) { + *result = BoolToPPBool(ppb_var_target()->HasMethod( + var.Get(dispatcher()), + name.Get(dispatcher()), + exception.OutParam(dispatcher()))); } void PPB_Var_Deprecated_Proxy::OnMsgGetProperty( @@ -328,13 +329,13 @@ void PPB_Var_Deprecated_Proxy::OnMsgDeleteProperty( SerializedVarReceiveInput var, SerializedVarReceiveInput name, SerializedVarOutParam exception, - bool* result) { + PP_Bool* result) { ppb_var_target()->RemoveProperty(var.Get(dispatcher()), name.Get(dispatcher()), exception.OutParam(dispatcher())); // This deprecated function doesn't actually return a value, but we re-use // the message from the non-deprecated interface with the return value. - *result = true; + *result = PP_TRUE; } void PPB_Var_Deprecated_Proxy::OnMsgCallDeprecated( @@ -368,7 +369,7 @@ void PPB_Var_Deprecated_Proxy::OnMsgIsInstanceOfDeprecated( pp::proxy::SerializedVarReceiveInput var, int64 ppp_class, int64* ppp_class_data, - bool* result) { + PP_Bool* result) { // TODO(brettw) write this. } diff --git a/ppapi/proxy/ppb_var_deprecated_proxy.h b/ppapi/proxy/ppb_var_deprecated_proxy.h index 9fe123a..4148447 100644 --- a/ppapi/proxy/ppb_var_deprecated_proxy.h +++ b/ppapi/proxy/ppb_var_deprecated_proxy.h @@ -17,6 +17,7 @@ namespace pp { namespace proxy { class SerializedVar; +class SerializedVarArray; class SerializedVarReceiveInput; class SerializedVarVectorOutParam; class SerializedVarVectorReceiveInput; @@ -43,11 +44,11 @@ class PPB_Var_Deprecated_Proxy : public InterfaceProxy { void OnMsgHasProperty(SerializedVarReceiveInput var, SerializedVarReceiveInput name, SerializedVarOutParam exception, - bool* result); + PP_Bool* result); void OnMsgHasMethodDeprecated(SerializedVarReceiveInput var, SerializedVarReceiveInput name, SerializedVarOutParam exception, - bool* result); + PP_Bool* result); void OnMsgGetProperty(SerializedVarReceiveInput var, SerializedVarReceiveInput name, SerializedVarOutParam exception, @@ -63,7 +64,7 @@ class PPB_Var_Deprecated_Proxy : public InterfaceProxy { void OnMsgDeleteProperty(SerializedVarReceiveInput var, SerializedVarReceiveInput name, SerializedVarOutParam exception, - bool* result); + PP_Bool* result); void OnMsgCall(SerializedVarReceiveInput object, SerializedVarReceiveInput this_object, SerializedVarReceiveInput method_name, @@ -82,7 +83,7 @@ class PPB_Var_Deprecated_Proxy : public InterfaceProxy { void OnMsgIsInstanceOfDeprecated(pp::proxy::SerializedVarReceiveInput var, int64 ppp_class, int64* ppp_class_data, - bool* result); + PP_Bool* result); void OnMsgCreateObjectDeprecated(PP_Module module_id, int64 ppp_class, int64 ppp_class_data, |