summaryrefslogtreecommitdiffstats
path: root/ppapi
diff options
context:
space:
mode:
authorwuchengli@chromium.org <wuchengli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-22 07:23:15 +0000
committerwuchengli@chromium.org <wuchengli@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-08-22 07:25:20 +0000
commitab8bcef370b99db6414eee827ba845a44d683380 (patch)
tree453b3d5f39f6850f6b2d7e1642ce179144e2485a /ppapi
parent6690931097c3d6aef72eb3917df369c693fb6fae (diff)
downloadchromium_src-ab8bcef370b99db6414eee827ba845a44d683380.zip
chromium_src-ab8bcef370b99db6414eee827ba845a44d683380.tar.gz
chromium_src-ab8bcef370b99db6414eee827ba845a44d683380.tar.bz2
PPAPI: make generator output a pointer to an array correctly.
Originally an IDL argument like "[out] int[] foo" will generate int* foo[]. It means an array of pointers to integers and what we want is a pointer to an array of integers. Change the output to int** foo to be not confusing. BUG=387547 TEST=Run generator and build chrome. Review URL: https://codereview.chromium.org/490433002 Cr-Commit-Position: refs/heads/master@{#291349} git-svn-id: svn://svn.chromium.org/chrome/trunk/src@291349 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r--ppapi/api/private/ppb_camera_capabilities_private.idl20
-rw-r--r--ppapi/api/private/ppp_flash_browser_operations.idl2
-rw-r--r--ppapi/c/private/ppb_camera_capabilities_private.h26
-rw-r--r--ppapi/c/private/ppp_flash_browser_operations.h6
-rwxr-xr-xppapi/generators/idl_c_proto.py8
-rw-r--r--ppapi/thunk/ppb_camera_capabilities_private_thunk.cc6
6 files changed, 37 insertions, 31 deletions
diff --git a/ppapi/api/private/ppb_camera_capabilities_private.idl b/ppapi/api/private/ppb_camera_capabilities_private.idl
index 13b47d1..57c7421 100644
--- a/ppapi/api/private/ppb_camera_capabilities_private.idl
+++ b/ppapi/api/private/ppb_camera_capabilities_private.idl
@@ -53,11 +53,11 @@ interface PPB_CameraCapabilities_Private {
* @param[in] capabilities A <code>PP_Resource</code> corresponding to an
* image capture capabilities resource.
* @param[out] array_size The size of preview size array.
- * @param[out] An array of <code>PP_Size</code> corresponding to the
- * supported preview sizes in pixels. The ownership of the array belongs to
- * <code>PPB_CameraCapabilities_Private</code> and the caller should not
- * free it. When a PPB_CameraCapabilities_Private is deleted, the array
- * returning from this is no longer valid.
+ * @param[out] preview_sizes An array of <code>PP_Size</code> corresponding
+ * to the supported preview sizes in pixels. The ownership of the array
+ * belongs to <code>PPB_CameraCapabilities_Private</code> and the caller
+ * should not free it. When a PPB_CameraCapabilities_Private is deleted,
+ * the array returning from this is no longer valid.
*/
void GetSupportedPreviewSizes(
[in] PP_Resource capabilities,
@@ -72,11 +72,11 @@ interface PPB_CameraCapabilities_Private {
* image capture capabilities resource.
* @param[out] array_size The size of JPEG size array. If the output of this
* is 0, the camera has no support for generating JPEG images.
- * @param[out] An array of <code>PP_Size</code> corresponding to the
- * supported JPEG image sizes in pixels. The ownership of the array belongs
- * to <code>PPB_CameraCapabilities_Private</code> and the caller should not
- * free it. When a PPB_CameraCapabilities_Private is deleted, the array
- * returning from this is no longer valid.
+ * @param[out] jpeg_sizes An array of <code>PP_Size</code> corresponding to
+ * the supported JPEG image sizes in pixels. The ownership of the array
+ * belongs to <code>PPB_CameraCapabilities_Private</code> and the caller
+ * should not free it. When a PPB_CameraCapabilities_Private is deleted, the
+ * array returning from this is no longer valid.
*/
void GetSupportedJpegSizes(
[in] PP_Resource capabilities,
diff --git a/ppapi/api/private/ppp_flash_browser_operations.idl b/ppapi/api/private/ppp_flash_browser_operations.idl
index 1504ad1..d067fbf 100644
--- a/ppapi/api/private/ppp_flash_browser_operations.idl
+++ b/ppapi/api/private/ppp_flash_browser_operations.idl
@@ -1,4 +1,4 @@
-/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
+/* Copyright 2012 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.
*/
diff --git a/ppapi/c/private/ppb_camera_capabilities_private.h b/ppapi/c/private/ppb_camera_capabilities_private.h
index 542c69e..c5c17d6e 100644
--- a/ppapi/c/private/ppb_camera_capabilities_private.h
+++ b/ppapi/c/private/ppb_camera_capabilities_private.h
@@ -4,7 +4,7 @@
*/
/* From private/ppb_camera_capabilities_private.idl,
- * modified Thu Aug 14 11:40:27 2014.
+ * modified Fri Aug 22 11:08:14 2014.
*/
#ifndef PPAPI_C_PRIVATE_PPB_CAMERA_CAPABILITIES_PRIVATE_H_
@@ -68,15 +68,15 @@ struct PPB_CameraCapabilities_Private_0_1 {
* @param[in] capabilities A <code>PP_Resource</code> corresponding to an
* image capture capabilities resource.
* @param[out] array_size The size of preview size array.
- * @param[out] An array of <code>PP_Size</code> corresponding to the
- * supported preview sizes in pixels. The ownership of the array belongs to
- * <code>PPB_CameraCapabilities_Private</code> and the caller should not
- * free it. When a PPB_CameraCapabilities_Private is deleted, the array
- * returning from this is no longer valid.
+ * @param[out] preview_sizes An array of <code>PP_Size</code> corresponding
+ * to the supported preview sizes in pixels. The ownership of the array
+ * belongs to <code>PPB_CameraCapabilities_Private</code> and the caller
+ * should not free it. When a PPB_CameraCapabilities_Private is deleted,
+ * the array returning from this is no longer valid.
*/
void (*GetSupportedPreviewSizes)(PP_Resource capabilities,
int32_t* array_size,
- struct PP_Size* preview_sizes[]);
+ struct PP_Size** preview_sizes);
/**
* GetSupportedJpegSize() returns the supported JPEG sizes for the given
* <code>PPB_CameraCapabilities_Private</code>.
@@ -85,15 +85,15 @@ struct PPB_CameraCapabilities_Private_0_1 {
* image capture capabilities resource.
* @param[out] array_size The size of JPEG size array. If the output of this
* is 0, the camera has no support for generating JPEG images.
- * @param[out] An array of <code>PP_Size</code> corresponding to the
- * supported JPEG image sizes in pixels. The ownership of the array belongs
- * to <code>PPB_CameraCapabilities_Private</code> and the caller should not
- * free it. When a PPB_CameraCapabilities_Private is deleted, the array
- * returning from this is no longer valid.
+ * @param[out] jpeg_sizes An array of <code>PP_Size</code> corresponding to
+ * the supported JPEG image sizes in pixels. The ownership of the array
+ * belongs to <code>PPB_CameraCapabilities_Private</code> and the caller
+ * should not free it. When a PPB_CameraCapabilities_Private is deleted, the
+ * array returning from this is no longer valid.
*/
void (*GetSupportedJpegSizes)(PP_Resource capabilities,
int32_t* array_size,
- struct PP_Size* jpeg_sizes[]);
+ struct PP_Size** jpeg_sizes);
};
typedef struct PPB_CameraCapabilities_Private_0_1
diff --git a/ppapi/c/private/ppp_flash_browser_operations.h b/ppapi/c/private/ppp_flash_browser_operations.h
index 301b74c..2f8803b 100644
--- a/ppapi/c/private/ppp_flash_browser_operations.h
+++ b/ppapi/c/private/ppp_flash_browser_operations.h
@@ -1,10 +1,10 @@
-/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
+/* Copyright 2012 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.
*/
/* From private/ppp_flash_browser_operations.idl,
- * modified Thu Mar 28 10:23:11 2013.
+ * modified Fri Aug 22 11:10:06 2014.
*/
#ifndef PPAPI_C_PRIVATE_PPP_FLASH_BROWSER_OPERATIONS_H_
@@ -186,7 +186,7 @@ struct PPP_Flash_BrowserOperations_1_3 {
* See also the NPP_GetSitesWithData function in NPAPI:
* https://wiki.mozilla.org/NPAPI:ClearSiteData
*/
- void (*GetSitesWithData)(const char* plugin_data_path, char** sites[]);
+ void (*GetSitesWithData)(const char* plugin_data_path, char*** sites);
/**
* Frees the list of sites returned by GetSitesWithData.
*
diff --git a/ppapi/generators/idl_c_proto.py b/ppapi/generators/idl_c_proto.py
index a6179a8..d029f93 100755
--- a/ppapi/generators/idl_c_proto.py
+++ b/ppapi/generators/idl_c_proto.py
@@ -384,6 +384,13 @@ class CGen(object):
# Generate passing type by modifying root type
rtype = self.GetTypeByMode(node, release, mode)
+ # If this is an array output, change it from type* foo[] to type** foo.
+ # type* foo[] means an array of pointers to type, which is confusing.
+ arrayspec = [self.GetArraySpec(array) for array in node.GetListOf('Array')]
+ if mode == 'out' and len(arrayspec) == 1 and arrayspec[0] == '[]':
+ rtype += '*'
+ del arrayspec[0]
+
if node.IsA('Enum', 'Interface', 'Struct'):
rname = node.GetName()
else:
@@ -394,7 +401,6 @@ class CGen(object):
if '%' in rtype:
rtype = rtype % rname
name = node.GetName()
- arrayspec = [self.GetArraySpec(array) for array in node.GetListOf('Array')]
callnode = node.GetOneOf('Callspec')
if callnode:
callspec = []
diff --git a/ppapi/thunk/ppb_camera_capabilities_private_thunk.cc b/ppapi/thunk/ppb_camera_capabilities_private_thunk.cc
index 7656097..173d451 100644
--- a/ppapi/thunk/ppb_camera_capabilities_private_thunk.cc
+++ b/ppapi/thunk/ppb_camera_capabilities_private_thunk.cc
@@ -3,7 +3,7 @@
// found in the LICENSE file.
// From private/ppb_camera_capabilities_private.idl,
-// modified Wed Aug 13 14:08:24 2014.
+// modified Tue Aug 19 14:43:34 2014.
#include "ppapi/c/pp_errors.h"
#include "ppapi/c/private/ppb_camera_capabilities_private.h"
@@ -33,7 +33,7 @@ PP_Bool IsCameraCapabilities(PP_Resource resource) {
void GetSupportedPreviewSizes(PP_Resource capabilities,
int32_t* array_size,
- struct PP_Size* preview_sizes[]) {
+ struct PP_Size** preview_sizes) {
VLOG(4) << "PPB_CameraCapabilities_Private::GetSupportedPreviewSizes()";
EnterResource<PPB_CameraCapabilities_API> enter(capabilities, true);
if (enter.failed())
@@ -43,7 +43,7 @@ void GetSupportedPreviewSizes(PP_Resource capabilities,
void GetSupportedJpegSizes(PP_Resource capabilities,
int32_t* array_size,
- struct PP_Size* jpeg_sizes[]) {
+ struct PP_Size** jpeg_sizes) {
VLOG(4) << "PPB_CameraCapabilities_Private::GetSupportedJpegSizes()";
EnterResource<PPB_CameraCapabilities_API> enter(capabilities, true);
if (enter.failed())