diff options
author | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-29 20:15:46 +0000 |
---|---|---|
committer | dmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-08-29 20:15:46 +0000 |
commit | 5931a6430264b34744d8a0908fcb2a10a88bce89 (patch) | |
tree | ec16879efc3d944d52873c83851cceb5db2dc403 /ppapi/native_client | |
parent | 6a892ebcf000d3c1d742c4b8c404b2df6be07e90 (diff) | |
download | chromium_src-5931a6430264b34744d8a0908fcb2a10a88bce89.zip chromium_src-5931a6430264b34744d8a0908fcb2a10a88bce89.tar.gz chromium_src-5931a6430264b34744d8a0908fcb2a10a88bce89.tar.bz2 |
ppapi: Make 0.4 the default for PPP_Printing_Dev, leave backwards-compat.
Since I didn't land this before the NaCl proxy move to chrome, I had to incorporate the proxy changes that were in http://codereview.chromium.org/7714041/
After PDF lands, I should be able to remove backwards-compat code.
BUG=80696
TEST=ppapi tests, manual test of PDF plugin
Review URL: http://codereview.chromium.org/7718004
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98684 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/native_client')
8 files changed, 23 insertions, 63 deletions
diff --git a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_printing.cc b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_printing.cc index ae96a62..4d93818 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_printing.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_printing.cc @@ -4,53 +4,38 @@ #include "native_client/src/shared/ppapi_proxy/browser_ppp_printing.h" -// Include file order cannot be observed because ppp_instance declares a -// structure return type that causes an error on Windows. -// TODO(sehr, brettw): fix the return types and include order in PPAPI. -#include "ppapi/c/pp_instance.h" -#include "ppapi/c/pp_resource.h" -#include "srpcgen/ppp_rpc.h" #include "native_client/src/include/portability.h" #include "native_client/src/shared/ppapi_proxy/browser_globals.h" #include "native_client/src/shared/ppapi_proxy/browser_ppp.h" +#include "native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppp_rpc.h" #include "native_client/src/shared/ppapi_proxy/utility.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_resource.h" namespace ppapi_proxy { namespace { -const nacl_abi_size_t kPPPrintOutputFormatBytes = - static_cast<nacl_abi_size_t>(sizeof(PP_PrintOutputFormat_Dev)); const nacl_abi_size_t kPPPrintSettingsBytes = static_cast<nacl_abi_size_t>(sizeof(struct PP_PrintSettings_Dev)); const nacl_abi_size_t kPPPrintPageNumberRangeBytes = static_cast<nacl_abi_size_t>(sizeof(struct PP_PrintPageNumberRange_Dev)); -PP_PrintOutputFormat_Dev* QuerySupportedFormats(PP_Instance instance, - uint32_t* format_count) { +uint32_t QuerySupportedFormats(PP_Instance instance) { DebugPrintf("PPP_Printing_Dev::QuerySupportedFormats: " "instance=%"NACL_PRIu32"\n", instance); - const PPB_Memory_Dev* ppb_memory = PPBMemoryInterface(); - const nacl_abi_size_t kMaxFormats = 8; - nacl_abi_size_t formats_bytes = kMaxFormats * kPPPrintOutputFormatBytes; - char* formats = - reinterpret_cast<char*>(ppb_memory->MemAlloc(formats_bytes)); + int32_t formats = 0; NaClSrpcError srpc_result = PppPrintingRpcClient::PPP_Printing_QuerySupportedFormats( GetMainSrpcChannel(instance), instance, - &formats_bytes, formats, - reinterpret_cast<int32_t*>(format_count)); + &formats); DebugPrintf("PPP_Printing_Dev::QuerySupportedFormats: %s\n", NaClSrpcErrorString(srpc_result)); - if (*format_count > 0) - return reinterpret_cast<PP_PrintOutputFormat_Dev*>(formats); - - ppb_memory->MemFree(formats); - return NULL; + return static_cast<uint32_t>(formats); } int32_t Begin(PP_Instance instance, diff --git a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_printing_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_printing_rpc_server.cc index 79b0896..2beef5e 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_printing_rpc_server.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_printing_rpc_server.cc @@ -10,19 +10,17 @@ #include "native_client/src/include/portability_process.h" #include "native_client/src/shared/ppapi_proxy/browser_globals.h" #include "native_client/src/shared/ppapi_proxy/plugin_globals.h" +#include "native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppp_rpc.h" #include "native_client/src/shared/ppapi_proxy/utility.h" #include "ppapi/c/dev/ppp_printing_dev.h" #include "ppapi/c/pp_resource.h" #include "ppapi/c/ppp.h" -#include "srpcgen/ppp_rpc.h" using ppapi_proxy::DebugPrintf; using ppapi_proxy::PPPPrintingInterface; namespace { -const nacl_abi_size_t kPPPrintOutputFormatBytes = - static_cast<nacl_abi_size_t>(sizeof(PP_PrintOutputFormat_Dev)); const nacl_abi_size_t kPPPrintSettingsBytes = static_cast<nacl_abi_size_t>(sizeof(struct PP_PrintSettings_Dev)); const nacl_abi_size_t kPPPrintPageNumberRangeBytes = @@ -36,29 +34,15 @@ void PppPrintingRpcServer::PPP_Printing_QuerySupportedFormats( // inputs PP_Instance instance, // outputs - nacl_abi_size_t* formats_bytes, char* formats, - int32_t* format_count) { + int32_t* formats) { rpc->result = NACL_SRPC_RESULT_APP_ERROR; NaClSrpcClosureRunner runner(done); - PP_PrintOutputFormat_Dev* pp_formats = - PPPPrintingInterface()->QuerySupportedFormats( - instance, - reinterpret_cast<uint32_t*>(format_count)); - if (pp_formats != NULL) { - nacl_abi_size_t formats_bytes_needed = - *format_count * kPPPrintOutputFormatBytes; - if (*formats_bytes >= formats_bytes_needed) { - *formats_bytes = formats_bytes_needed; - memcpy(pp_formats, formats, formats_bytes_needed); - } else { - *format_count = 0; - } - ppapi_proxy::PPBMemoryInterface()->MemFree(pp_formats); - } + uint32_t pp_formats = PPPPrintingInterface()->QuerySupportedFormats(instance); + *formats = static_cast<int32_t>(pp_formats); DebugPrintf("PPP_Printing::QuerySupportedFormats: " - "format_count=%"NACL_PRId32"\n", *format_count); + "formats=%"NACL_PRId32"\n", *formats); rpc->result = NACL_SRPC_RESULT_OK; } diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppp_printing.srpc b/ppapi/native_client/src/shared/ppapi_proxy/ppp_printing.srpc index e7aba2a..c1301ef 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/ppp_printing.srpc +++ b/ppapi/native_client/src/shared/ppapi_proxy/ppp_printing.srpc @@ -10,8 +10,7 @@ {'name': 'PPP_Printing_QuerySupportedFormats', 'inputs': [['instance', 'PP_Instance'], ], - 'outputs': [['formats', 'char[]'], # PP_PrintOutputFormat_Dev array - ['format_count', 'int32_t'], # uint32_t + 'outputs': [['formats', 'int32_t'], # uint32_t ] }, {'name': 'PPP_Printing_Begin', diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppp_rpc_client.cc b/ppapi/native_client/src/shared/ppapi_proxy/ppp_rpc_client.cc index 9de4ae6..98ae085 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/ppp_rpc_client.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/ppp_rpc_client.cc @@ -283,15 +283,13 @@ NaClSrpcError PppMessagingRpcClient::PPP_Messaging_HandleMessage( NaClSrpcError PppPrintingRpcClient::PPP_Printing_QuerySupportedFormats( NaClSrpcChannel* channel, PP_Instance instance, - nacl_abi_size_t* formats_bytes, char* formats, - int32_t* format_count) { + int32_t* formats) { NaClSrpcError retval; retval = NaClSrpcInvokeBySignature( channel, - "PPP_Printing_QuerySupportedFormats:i:Ci", + "PPP_Printing_QuerySupportedFormats:i:i", instance, - formats_bytes, formats, - format_count + formats ); if (retval == NACL_SRPC_RESULT_INTERNAL) ppapi_proxy::CleanUpAfterDeadNexe(instance); diff --git a/ppapi/native_client/src/shared/ppapi_proxy/ppp_rpc_server.cc b/ppapi/native_client/src/shared/ppapi_proxy/ppp_rpc_server.cc index b420d78..325291c 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/ppp_rpc_server.cc +++ b/ppapi/native_client/src/shared/ppapi_proxy/ppp_rpc_server.cc @@ -266,8 +266,7 @@ static void PPP_Printing_QuerySupportedFormatsDispatcher( rpc, done, inputs[0]->u.ival, - &(outputs[0]->u.count), outputs[0]->arrays.carr, - &(outputs[1]->u.ival) + &(outputs[0]->u.ival) ); } @@ -413,7 +412,7 @@ NaClSrpcHandlerDesc PppRpcs::srpc_methods[] = { { "PPP_Instance_DidChangeFocus:ib:", PPP_Instance_DidChangeFocusDispatcher }, { "PPP_Instance_HandleDocumentLoad:ii:i", PPP_Instance_HandleDocumentLoadDispatcher }, { "PPP_Messaging_HandleMessage:iC:", PPP_Messaging_HandleMessageDispatcher }, - { "PPP_Printing_QuerySupportedFormats:i:Ci", PPP_Printing_QuerySupportedFormatsDispatcher }, + { "PPP_Printing_QuerySupportedFormats:i:i", PPP_Printing_QuerySupportedFormatsDispatcher }, { "PPP_Printing_Begin:iC:i", PPP_Printing_BeginDispatcher }, { "PPP_Printing_PrintPages:iCi:i", PPP_Printing_PrintPagesDispatcher }, { "PPP_Printing_End:i:", PPP_Printing_EndDispatcher }, diff --git a/ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppp_rpc.h b/ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppp_rpc.h index a1c70c6..efaa3fe 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppp_rpc.h +++ b/ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppp_rpc.h @@ -160,8 +160,7 @@ class PppPrintingRpcClient { static NaClSrpcError PPP_Printing_QuerySupportedFormats( NaClSrpcChannel* channel, PP_Instance instance, - nacl_abi_size_t* formats_bytes, char* formats, - int32_t* format_count); + int32_t* formats); static NaClSrpcError PPP_Printing_Begin( NaClSrpcChannel* channel, PP_Instance instance, diff --git a/ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppp_rpc.h b/ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppp_rpc.h index 2cfc560d..146d0a2 100644 --- a/ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppp_rpc.h +++ b/ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppp_rpc.h @@ -176,8 +176,7 @@ class PppPrintingRpcServer { NaClSrpcRpc* rpc, NaClSrpcClosure* done, PP_Instance instance, - nacl_abi_size_t* formats_bytes, char* formats, - int32_t* format_count); + int32_t* formats); static void PPP_Printing_Begin( NaClSrpcRpc* rpc, NaClSrpcClosure* done, diff --git a/ppapi/native_client/src/trusted/plugin/plugin.cc b/ppapi/native_client/src/trusted/plugin/plugin.cc index 1fdf449..b262874 100644 --- a/ppapi/native_client/src/trusted/plugin/plugin.cc +++ b/ppapi/native_client/src/trusted/plugin/plugin.cc @@ -310,14 +310,11 @@ class PrintingAdapter : public pp::Printing_Dev { proxy->GetPluginInterface(PPP_PRINTING_DEV_INTERFACE)); } - PP_PrintOutputFormat_Dev* - QuerySupportedPrintOutputFormats(uint32_t* format_count) { + uint32_t QuerySupportedPrintOutputFormats() { if (ppp_printing_ != NULL) { - return ppp_printing_->QuerySupportedFormats(plugin_->pp_instance(), - format_count); + return ppp_printing_->QuerySupportedFormats(plugin_->pp_instance()); } - *format_count = 0; - return NULL; + return 0; } int32_t PrintBegin(const PP_PrintSettings_Dev& print_settings) { |