summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authordmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-29 20:15:46 +0000
committerdmichael@chromium.org <dmichael@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-08-29 20:15:46 +0000
commit5931a6430264b34744d8a0908fcb2a10a88bce89 (patch)
treeec16879efc3d944d52873c83851cceb5db2dc403 /ppapi
parent6a892ebcf000d3c1d742c4b8c404b2df6be07e90 (diff)
downloadchromium_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')
-rw-r--r--ppapi/c/dev/ppp_printing_dev.h44
-rw-r--r--ppapi/cpp/dev/printing_dev.cc12
-rw-r--r--ppapi/cpp/dev/printing_dev.h5
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/browser_ppp_printing.cc29
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/plugin_ppp_printing_rpc_server.cc26
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/ppp_printing.srpc3
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/ppp_rpc_client.cc8
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/ppp_rpc_server.cc5
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/trusted/srpcgen/ppp_rpc.h3
-rw-r--r--ppapi/native_client/src/shared/ppapi_proxy/untrusted/srpcgen/ppp_rpc.h3
-rw-r--r--ppapi/native_client/src/trusted/plugin/plugin.cc9
11 files changed, 26 insertions, 121 deletions
diff --git a/ppapi/c/dev/ppp_printing_dev.h b/ppapi/c/dev/ppp_printing_dev.h
index 658fd23..2662826 100644
--- a/ppapi/c/dev/ppp_printing_dev.h
+++ b/ppapi/c/dev/ppp_printing_dev.h
@@ -36,19 +36,10 @@ typedef enum {
PP_PRINTOUTPUTFORMAT_POSTSCRIPT_0_4 = 1u << 2
} PP_PrintOutputFormat_Dev_0_4;
-/* TODO(dmichael): Remove the conditional compilation when NaCl proxy is
- ported to 0.4. Remove 0.3 when PDF is ported. */
-#ifdef PPP_PRINTING_DEV_USE_0_4
typedef PP_PrintOutputFormat_Dev_0_4 PP_PrintOutputFormat_Dev;
#define PP_PRINTOUTPUTFORMAT_RASTER PP_PRINTOUTPUTFORMAT_RASTER_0_4
#define PP_PRINTOUTPUTFORMAT_PDF PP_PRINTOUTPUTFORMAT_PDF_0_4
#define PP_PRINTOUTPUTFORMAT_POSTSCRIPT PP_PRINTOUTPUTFORMAT_POSTSCRIPT_0_4
-#else
-typedef PP_PrintOutputFormat_Dev_0_3 PP_PrintOutputFormat_Dev;
-#define PP_PRINTOUTPUTFORMAT_RASTER PP_PRINTOUTPUTFORMAT_RASTER_0_3
-#define PP_PRINTOUTPUTFORMAT_PDF PP_PRINTOUTPUTFORMAT_PDF_0_3
-#define PP_PRINTOUTPUTFORMAT_POSTSCRIPT PP_PRINTOUTPUTFORMAT_POSTSCRIPT_0_3
-#endif
PP_COMPILE_ASSERT_SIZE_IN_BYTES(PP_PrintOutputFormat_Dev, 4);
struct PP_PrintSettings_Dev {
@@ -98,13 +89,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_3 "PPP_Printing(Dev);0.3"
#define PPP_PRINTING_DEV_INTERFACE_0_4 "PPP_Printing(Dev);0.4"
-#ifdef PPP_PRINTING_DEV_USE_0_4
#define PPP_PRINTING_DEV_INTERFACE PPP_PRINTING_DEV_INTERFACE_0_4
-#else
-#define PPP_PRINTING_DEV_INTERFACE PPP_PRINTING_DEV_INTERFACE_0_3
-#endif
-#ifdef PPP_PRINTING_DEV_USE_0_4
struct PPP_Printing_Dev {
/**
* Returns a bit field representing the supported print output formats. For
@@ -138,37 +124,13 @@ struct PPP_Printing_Dev {
/** Ends the print session. Further calls to PrintPage will fail. */
void (*End)(PP_Instance instance);
};
-#else
-struct PPP_Printing_Dev {
- /**
- * Returns an array of supported print output formats. The array is allocated
- * using PPB_Core.MemAlloc. The caller is responsible for freeing the array
- * using PPB_Core.MemFree.
- * Sets |*format_count| to 0 returns NULL if printing is not supported at
- * all.
- */
- PP_PrintOutputFormat_Dev* (*QuerySupportedFormats)(
- PP_Instance instance, uint32_t* format_count);
- /* See the alternate definition of PPP_Printing_Dev above for documentation
- * on these functions.
- */
- int32_t (*Begin)(PP_Instance instance,
- const struct PP_PrintSettings_Dev* print_settings);
- PP_Resource (*PrintPages)(
- PP_Instance instance,
- const struct PP_PrintPageNumberRange_Dev* page_ranges,
- uint32_t page_range_count);
- void (*End)(PP_Instance instance);
-};
-#endif
/* The following versioned structs are exact copies of the above unversioned
- structs, except that PP_PrintSettings_Dev_0_3 or PP_PrintSettings_Dev_0_4 is
+ struct, except that PP_PrintSettings_Dev_0_3 or PP_PrintSettings_Dev_0_4 is
used instead of PP_PrintSettings_Dev. This is for use by Chrome & NaCl, which
always use versioned type names. Each must be bit-for-bit compatible with the
associated version of PPP_Printing_Dev above.
- TODO(dmichael,noelallen): Fix this by having separate internal vs external
- headers generated by IDL. */
+ TODO(dmichael): Remove versioning from this header. */
struct PPP_Printing_Dev_0_4 {
uint32_t (*QuerySupportedFormats)(PP_Instance instance);
int32_t (*Begin)(PP_Instance instance,
@@ -181,7 +143,7 @@ struct PPP_Printing_Dev_0_4 {
};
struct PPP_Printing_Dev_0_3 {
- PP_PrintOutputFormat_Dev* (*QuerySupportedFormats)(
+ PP_PrintOutputFormat_Dev_0_3* (*QuerySupportedFormats)(
PP_Instance instance, uint32_t* format_count);
int32_t (*Begin)(PP_Instance instance,
const struct PP_PrintSettings_Dev_0_3* print_settings);
diff --git a/ppapi/cpp/dev/printing_dev.cc b/ppapi/cpp/dev/printing_dev.cc
index cf1d318..93055e7 100644
--- a/ppapi/cpp/dev/printing_dev.cc
+++ b/ppapi/cpp/dev/printing_dev.cc
@@ -14,7 +14,6 @@ namespace {
static const char kPPPPrintingInterface[] = PPP_PRINTING_DEV_INTERFACE;
-#ifdef PPP_PRINTING_DEV_USE_0_4
uint32_t QuerySupportedFormats(PP_Instance instance) {
void* object =
pp::Instance::GetPerInstanceObject(instance, kPPPPrintingInterface);
@@ -22,17 +21,6 @@ uint32_t QuerySupportedFormats(PP_Instance instance) {
return 0;
return static_cast<Printing_Dev*>(object)->QuerySupportedPrintOutputFormats();
}
-#else
-PP_PrintOutputFormat_Dev* QuerySupportedFormats(PP_Instance instance,
- uint32_t* format_count) {
- void* object =
- pp::Instance::GetPerInstanceObject(instance, kPPPPrintingInterface);
- if (!object)
- return NULL;
- return static_cast<Printing_Dev*>(object)->QuerySupportedPrintOutputFormats(
- format_count);
-}
-#endif
int32_t Begin(PP_Instance instance,
const struct PP_PrintSettings_Dev* print_settings) {
diff --git a/ppapi/cpp/dev/printing_dev.h b/ppapi/cpp/dev/printing_dev.h
index 1a6f09e..80d9fe4 100644
--- a/ppapi/cpp/dev/printing_dev.h
+++ b/ppapi/cpp/dev/printing_dev.h
@@ -22,12 +22,7 @@ class Printing_Dev {
// PPP_Printing_Dev functions exposed as virtual functions for you to
// override.
-#ifdef PPP_PRINTING_DEV_USE_0_4
virtual uint32_t QuerySupportedPrintOutputFormats() = 0;
-#else
- virtual PP_PrintOutputFormat_Dev* QuerySupportedPrintOutputFormats(
- uint32_t* format_count) = 0;
-#endif
virtual int32_t PrintBegin(const PP_PrintSettings_Dev& print_settings) = 0;
virtual Resource PrintPages(const PP_PrintPageNumberRange_Dev* page_ranges,
uint32_t page_range_count) = 0;
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) {