summaryrefslogtreecommitdiffstats
path: root/ppapi/thunk
diff options
context:
space:
mode:
authorteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-17 16:01:32 +0000
committerteravest@chromium.org <teravest@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-11-17 16:01:32 +0000
commit8c311f064c0ad5a70049f771bd15677bf7c9b098 (patch)
tree2a2727243475ff72eec47736e2567db064bba953 /ppapi/thunk
parentd68206fcca8a719e5152a09c6e9d235cdbcdeec3 (diff)
downloadchromium_src-8c311f064c0ad5a70049f771bd15677bf7c9b098.zip
chromium_src-8c311f064c0ad5a70049f771bd15677bf7c9b098.tar.gz
chromium_src-8c311f064c0ad5a70049f771bd15677bf7c9b098.tar.bz2
Add support for generating thunk source from IDL.
This introduces a few new IDL attributes: generate_thunk - Enables thunk generation for an IDL file. create_func - Overrides the guessed create function name. on_failure - Overrides the default return value on failure. report_errors - Allows error reporting to be disabled. By using these attributes, we can generate _thunk.cc files for many IDL files. I'll send CLs for moving the thunks separately, as I found it tiring to review them all in a big lump. I have PPB_Widget_Dev here as an example. BUG= Review URL: https://chromiumcodereview.appspot.com/11417010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@168450 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/thunk')
-rw-r--r--ppapi/thunk/ppb_widget_thunk.cc32
1 files changed, 20 insertions, 12 deletions
diff --git a/ppapi/thunk/ppb_widget_thunk.cc b/ppapi/thunk/ppb_widget_thunk.cc
index f00b48b..c7e243e 100644
--- a/ppapi/thunk/ppb_widget_thunk.cc
+++ b/ppapi/thunk/ppb_widget_thunk.cc
@@ -2,10 +2,16 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "ppapi/thunk/thunk.h"
+// From dev/ppb_widget_dev.idl modified Fri Nov 16 11:26:06 2012.
+
+#include "ppapi/c/dev/ppb_widget_dev.h"
+#include "ppapi/c/pp_errors.h"
+#include "ppapi/shared_impl/tracked_callback.h"
#include "ppapi/thunk/enter.h"
+#include "ppapi/thunk/ppb_instance_api.h"
#include "ppapi/thunk/ppb_widget_api.h"
#include "ppapi/thunk/resource_creation_api.h"
+#include "ppapi/thunk/thunk.h"
namespace ppapi {
namespace thunk {
@@ -17,28 +23,30 @@ PP_Bool IsWidget(PP_Resource resource) {
return PP_FromBool(enter.succeeded());
}
-PP_Bool Paint(PP_Resource widget, const PP_Rect* rect, PP_Resource image_id) {
+PP_Bool Paint(PP_Resource widget,
+ const struct PP_Rect* rect,
+ PP_Resource image) {
EnterResource<PPB_Widget_API> enter(widget, false);
if (enter.failed())
return PP_FALSE;
- return enter.object()->Paint(rect, image_id);
+ return enter.object()->Paint(rect, image);
}
-PP_Bool HandleEvent(PP_Resource widget, PP_Resource pp_input_event) {
+PP_Bool HandleEvent(PP_Resource widget, PP_Resource input_event) {
EnterResource<PPB_Widget_API> enter(widget, false);
if (enter.failed())
return PP_FALSE;
- return enter.object()->HandleEvent(pp_input_event);
+ return enter.object()->HandleEvent(input_event);
}
-PP_Bool GetLocation(PP_Resource widget, PP_Rect* location) {
+PP_Bool GetLocation(PP_Resource widget, struct PP_Rect* location) {
EnterResource<PPB_Widget_API> enter(widget, false);
if (enter.failed())
return PP_FALSE;
return enter.object()->GetLocation(location);
}
-void SetLocation(PP_Resource widget, const PP_Rect* location) {
+void SetLocation(PP_Resource widget, const struct PP_Rect* location) {
EnterResource<PPB_Widget_API> enter(widget, false);
if (enter.succeeded())
enter.object()->SetLocation(location);
@@ -50,7 +58,7 @@ void SetScale(PP_Resource widget, float scale) {
enter.object()->SetScale(scale);
}
-const PPB_Widget_Dev_0_3 g_ppb_widget_thunk_0_3 = {
+const PPB_Widget_Dev_0_3 g_ppb_widget_dev_thunk_0_3 = {
&IsWidget,
&Paint,
&HandleEvent,
@@ -58,23 +66,23 @@ const PPB_Widget_Dev_0_3 g_ppb_widget_thunk_0_3 = {
&SetLocation,
};
-const PPB_Widget_Dev_0_4 g_ppb_widget_thunk_0_4 = {
+const PPB_Widget_Dev_0_4 g_ppb_widget_dev_thunk_0_4 = {
&IsWidget,
&Paint,
&HandleEvent,
&GetLocation,
&SetLocation,
- &SetScale
+ &SetScale,
};
} // namespace
const PPB_Widget_Dev_0_3* GetPPB_Widget_Dev_0_3_Thunk() {
- return &g_ppb_widget_thunk_0_3;
+ return &g_ppb_widget_dev_thunk_0_3;
}
const PPB_Widget_Dev_0_4* GetPPB_Widget_Dev_0_4_Thunk() {
- return &g_ppb_widget_thunk_0_4;
+ return &g_ppb_widget_dev_thunk_0_4;
}
} // namespace thunk