diff options
author | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-11 04:38:11 +0000 |
---|---|---|
committer | yzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-12-11 04:38:11 +0000 |
commit | 63e56c83c4689dd0dfcef4b40e5fa8ef135e86f5 (patch) | |
tree | d81f77cc66e02be05332afe49ff77937b9207bf1 /ppapi | |
parent | bc71f4e91c7117d38644fa77d179fca23f1de5fb (diff) | |
download | chromium_src-63e56c83c4689dd0dfcef4b40e5fa8ef135e86f5.zip chromium_src-63e56c83c4689dd0dfcef4b40e5fa8ef135e86f5.tar.gz chromium_src-63e56c83c4689dd0dfcef4b40e5fa8ef135e86f5.tar.bz2 |
Add PPB_Alarms_Dev interface definition.
The C++ wrapper will be in a separate CL.
BUG=327197,233439
TEST=None
Review URL: https://codereview.chromium.org/103993006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@240013 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/api/dev/pp_optional_structs_dev.idl | 14 | ||||
-rw-r--r-- | ppapi/api/dev/ppb_alarms_dev.idl | 181 | ||||
-rw-r--r-- | ppapi/c/dev/pp_optional_structs_dev.h | 34 | ||||
-rw-r--r-- | ppapi/c/dev/ppb_alarms_dev.h | 210 | ||||
-rwxr-xr-x | ppapi/generators/idl_c_header.py | 7 | ||||
-rw-r--r-- | ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c | 52 | ||||
-rw-r--r-- | ppapi/ppapi_shared.gypi | 1 | ||||
-rw-r--r-- | ppapi/ppapi_sources.gypi | 2 | ||||
-rw-r--r-- | ppapi/proxy/interface_list.cc | 1 | ||||
-rw-r--r-- | ppapi/tests/all_c_includes.h | 2 | ||||
-rw-r--r-- | ppapi/thunk/interfaces_ppb_public_dev.h | 1 | ||||
-rw-r--r-- | ppapi/thunk/ppb_alarms_dev_thunk.cc | 82 |
12 files changed, 581 insertions, 6 deletions
diff --git a/ppapi/api/dev/pp_optional_structs_dev.idl b/ppapi/api/dev/pp_optional_structs_dev.idl new file mode 100644 index 0000000..3e0829f --- /dev/null +++ b/ppapi/api/dev/pp_optional_structs_dev.idl @@ -0,0 +1,14 @@ +/* Copyright 2013 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. + */ + +/** + * This file defines optional structs for primitive types. + */ + +struct PP_Optional_Double_Dev { + double_t value; + PP_Bool is_set; +}; + diff --git a/ppapi/api/dev/ppb_alarms_dev.idl b/ppapi/api/dev/ppb_alarms_dev.idl new file mode 100644 index 0000000..b2345c4 --- /dev/null +++ b/ppapi/api/dev/ppb_alarms_dev.idl @@ -0,0 +1,181 @@ +/* Copyright 2013 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. + */ + +/** + * This file defines the Pepper equivalent of the <code>chrome.alarms</code> + * extension API. + */ + +label Chrome { + M33 = 0.1 +}; + +struct PP_Alarms_Alarm_Dev { + /** + * Name of this alarm. + */ + PP_Var name; + /** + * Time at which this alarm was scheduled to fire, in milliseconds past the + * epoch. For performance reasons, the alarm may have been delayed an + * arbitrary amount beyond this. + */ + double_t scheduled_time; + /** + * If set, the alarm is a repeating alarm and will fire again in + * <code>period_in_minutes</code> minutes. + */ + PP_Optional_Double_Dev period_in_minutes; +}; + +struct PP_Alarms_AlarmCreateInfo_Dev { + /** + * Time at which the alarm should fire, in milliseconds past the epoch. + */ + PP_Optional_Double_Dev when; + /** + * Length of time in minutes after which the + * <code>PP_Alarms_OnAlarm_Dev</code> event should fire. + */ + PP_Optional_Double_Dev delay_in_minutes; + /** + * If set, the <code>PP_Alarms_OnAlarm_Dev</code> event should fire every + * <code>period_in_minutes</code> minutes after the initial event specified by + * <code>when</code> or <code>delay_in_minutes</code>. If not set, the alarm + * will only fire once. + */ + PP_Optional_Double_Dev period_in_minutes; +}; + +struct PP_Alarms_Alarm_Array_Dev { + uint32_t size; + [size_is(count)] PP_Alarms_Alarm_Dev[] elements; +}; + +/** + * Fired when an alarm has elapsed. Useful for event pages. + * + * @param[in] listener_id The listener ID. + * @param[inout] user_data The opaque pointer that was used when registering the + * listener. + * @param[in] alarm The alarm that has elapsed. + */ +typedef void PP_Alarms_OnAlarm_Dev( + [in] uint32_t listener_id, + [inout] mem_t user_data, + [in] PP_Alarms_Alarm_Dev alarm); + +interface PPB_Alarms_Dev { + /** + * Creates an alarm. Near the time(s) specified by <code>alarm_info</code>, + * the <code>PP_Alarms_OnAlarm_Dev</code> event is fired. If there is another + * alarm with the same name (or no name if none is specified), it will be + * cancelled and replaced by this alarm. + * + * In order to reduce the load on the user's machine, Chrome limits alarms + * to at most once every 1 minute but may delay them an arbitrary amount more. + * That is, setting + * <code>PP_Alarms_AlarmCreateInfo_Dev.delay_in_minutes</code> or + * <code>PP_Alarms_AlarmCreateInfo_Dev.period_in_minutes</code> to less than + * <code>1</code> will not be honored and will cause a warning. + * <code>PP_Alarms_AlarmCreateInfo_Dev.when</code> can be set to less than 1 + * minute after "now" without warning but won't actually cause the alarm to + * fire for at least 1 minute. + * + * To help you debug your app or extension, when you've loaded it unpacked, + * there's no limit to how often the alarm can fire. + * + * @param[in] instance A <code>PP_Instance</code>. + * @param[in] name A string or undefined <code>PP_Var</code>. Optional name to + * identify this alarm. Defaults to the empty string. + * @param[in] alarm_info Describes when the alarm should fire. The initial + * time must be specified by either <code>when</code> or + * <code>delay_in_minutes</code> (but not both). If + * <code>period_in_minutes</code> is set, the alarm will repeat every + * <code>period_in_minutes</code> minutes after the initial event. If neither + * <code>when</code> or <code>delay_in_minutes</code> is set for a repeating + * alarm, <code>period_in_minutes</code> is used as the default for + * <code>delay_in_minutes</code>. + */ + void Create( + [in] PP_Instance instance, + [in] PP_Var name, + [in] PP_Alarms_AlarmCreateInfo_Dev alarm_info); + + /** + * Retrieves details about the specified alarm. + * + * @param[in] instance A <code>PP_Instance</code>. + * @param[in] name A string or undefined <code>PP_Var</code>. The name of the + * alarm to get. Defaults to the empty string. + * @param[out] alarm A <code>PP_Alarms_Alarm_Dev</code> struct to store the + * output result. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An error code from <code>pp_errors.h</code> + */ + int32_t Get( + [in] PP_Instance instance, + [in] PP_Var name, + [out] PP_Alarms_Alarm_Dev alarm, + [in] PP_CompletionCallback callback); + + /** + * Gets an array of all the alarms. + * + * @param[in] instance A <code>PP_Instance</code>. + * @param[out] alarms A <code>PP_Alarms_Alarm_Array_Dev</code> to store the + * output result. + * @param[in] array_allocator A <code>PP_ArrayOutput</code> to allocate memory + * for <code>alarms</code>. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An error code from <code>pp_errors.h</code> + */ + int32_t GetAll( + [in] PP_Instance instance, + [out] PP_Alarms_Alarm_Array_Dev alarms, + [in] PP_ArrayOutput array_allocator, + [in] PP_CompletionCallback callback); + + /** + * Clears the alarm with the given name. + * + * @param[in] instance A <code>PP_Instance</code>. + * @param[in] name A string or undefined <code>PP_Var</code>. The name of the + * alarm to clear. Defaults to the empty string. + */ + void Clear( + [in] PP_Instance instance, + [in] PP_Var name); + + /** + * Clears all alarms. + * + * @param[in] instance A <code>PP_Instance</code>. + */ + void ClearAll( + [in] PP_Instance instance); + + /** + * Registers <code>PP_Alarms_OnAlarm_Dev</code> event. + * + * @param[in] instance A <code>PP_Instance</code>. + * @param[in] callback The callback to receive notifications. + * @param[inout] user_data An opaque pointer that will be passed to + * <code>callback</code>. + * + * @return A listener ID, or 0 if failed. + * + * TODO(yzshen): add a PPB_Events_Dev interface for unregistering: + * void UnregisterListener(PP_instance instance, uint32_t listener_id); + */ + uint32_t AddOnAlarmListener( + [in] PP_Instance instance, + [in] PP_Alarms_OnAlarm_Dev callback, + [inout] mem_t user_data); +}; diff --git a/ppapi/c/dev/pp_optional_structs_dev.h b/ppapi/c/dev/pp_optional_structs_dev.h new file mode 100644 index 0000000..06608fe --- /dev/null +++ b/ppapi/c/dev/pp_optional_structs_dev.h @@ -0,0 +1,34 @@ +/* Copyright 2013 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 dev/pp_optional_structs_dev.idl modified Tue Dec 10 17:39:38 2013. */ + +#ifndef PPAPI_C_DEV_PP_OPTIONAL_STRUCTS_DEV_H_ +#define PPAPI_C_DEV_PP_OPTIONAL_STRUCTS_DEV_H_ + +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" + +/** + * @file + * This file defines optional structs for primitive types. + */ + + +/** + * @addtogroup Structs + * @{ + */ +struct PP_Optional_Double_Dev { + double value; + PP_Bool is_set; +}; +/** + * @} + */ + +#endif /* PPAPI_C_DEV_PP_OPTIONAL_STRUCTS_DEV_H_ */ + diff --git a/ppapi/c/dev/ppb_alarms_dev.h b/ppapi/c/dev/ppb_alarms_dev.h new file mode 100644 index 0000000..9661793 --- /dev/null +++ b/ppapi/c/dev/ppb_alarms_dev.h @@ -0,0 +1,210 @@ +/* Copyright 2013 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 dev/ppb_alarms_dev.idl modified Tue Dec 10 17:40:20 2013. */ + +#ifndef PPAPI_C_DEV_PPB_ALARMS_DEV_H_ +#define PPAPI_C_DEV_PPB_ALARMS_DEV_H_ + +#include "ppapi/c/dev/pp_optional_structs_dev.h" +#include "ppapi/c/pp_array_output.h" +#include "ppapi/c/pp_bool.h" +#include "ppapi/c/pp_completion_callback.h" +#include "ppapi/c/pp_instance.h" +#include "ppapi/c/pp_macros.h" +#include "ppapi/c/pp_stdint.h" +#include "ppapi/c/pp_var.h" + +#define PPB_ALARMS_DEV_INTERFACE_0_1 "PPB_Alarms(Dev);0.1" +#define PPB_ALARMS_DEV_INTERFACE PPB_ALARMS_DEV_INTERFACE_0_1 + +/** + * @file + * This file defines the Pepper equivalent of the <code>chrome.alarms</code> + * extension API. + */ + + +/** + * @addtogroup Structs + * @{ + */ +struct PP_Alarms_Alarm_Dev { + /** + * Name of this alarm. + */ + struct PP_Var name; + /** + * Time at which this alarm was scheduled to fire, in milliseconds past the + * epoch. For performance reasons, the alarm may have been delayed an + * arbitrary amount beyond this. + */ + double scheduled_time; + /** + * If set, the alarm is a repeating alarm and will fire again in + * <code>period_in_minutes</code> minutes. + */ + struct PP_Optional_Double_Dev period_in_minutes; +}; + +struct PP_Alarms_AlarmCreateInfo_Dev { + /** + * Time at which the alarm should fire, in milliseconds past the epoch. + */ + struct PP_Optional_Double_Dev when; + /** + * Length of time in minutes after which the + * <code>PP_Alarms_OnAlarm_Dev</code> event should fire. + */ + struct PP_Optional_Double_Dev delay_in_minutes; + /** + * If set, the <code>PP_Alarms_OnAlarm_Dev</code> event should fire every + * <code>period_in_minutes</code> minutes after the initial event specified by + * <code>when</code> or <code>delay_in_minutes</code>. If not set, the alarm + * will only fire once. + */ + struct PP_Optional_Double_Dev period_in_minutes; +}; + +struct PP_Alarms_Alarm_Array_Dev { + uint32_t size; + struct PP_Alarms_Alarm_Dev *elements; +}; +/** + * @} + */ + +/** + * @addtogroup Typedefs + * @{ + */ +/** + * Fired when an alarm has elapsed. Useful for event pages. + * + * @param[in] listener_id The listener ID. + * @param[inout] user_data The opaque pointer that was used when registering the + * listener. + * @param[in] alarm The alarm that has elapsed. + */ +typedef void (*PP_Alarms_OnAlarm_Dev)( + uint32_t listener_id, + void* user_data, + const struct PP_Alarms_Alarm_Dev* alarm); +/** + * @} + */ + +/** + * @addtogroup Interfaces + * @{ + */ +struct PPB_Alarms_Dev_0_1 { + /** + * Creates an alarm. Near the time(s) specified by <code>alarm_info</code>, + * the <code>PP_Alarms_OnAlarm_Dev</code> event is fired. If there is another + * alarm with the same name (or no name if none is specified), it will be + * cancelled and replaced by this alarm. + * + * In order to reduce the load on the user's machine, Chrome limits alarms + * to at most once every 1 minute but may delay them an arbitrary amount more. + * That is, setting + * <code>PP_Alarms_AlarmCreateInfo_Dev.delay_in_minutes</code> or + * <code>PP_Alarms_AlarmCreateInfo_Dev.period_in_minutes</code> to less than + * <code>1</code> will not be honored and will cause a warning. + * <code>PP_Alarms_AlarmCreateInfo_Dev.when</code> can be set to less than 1 + * minute after "now" without warning but won't actually cause the alarm to + * fire for at least 1 minute. + * + * To help you debug your app or extension, when you've loaded it unpacked, + * there's no limit to how often the alarm can fire. + * + * @param[in] instance A <code>PP_Instance</code>. + * @param[in] name A string or undefined <code>PP_Var</code>. Optional name to + * identify this alarm. Defaults to the empty string. + * @param[in] alarm_info Describes when the alarm should fire. The initial + * time must be specified by either <code>when</code> or + * <code>delay_in_minutes</code> (but not both). If + * <code>period_in_minutes</code> is set, the alarm will repeat every + * <code>period_in_minutes</code> minutes after the initial event. If neither + * <code>when</code> or <code>delay_in_minutes</code> is set for a repeating + * alarm, <code>period_in_minutes</code> is used as the default for + * <code>delay_in_minutes</code>. + */ + void (*Create)(PP_Instance instance, + struct PP_Var name, + const struct PP_Alarms_AlarmCreateInfo_Dev* alarm_info); + /** + * Retrieves details about the specified alarm. + * + * @param[in] instance A <code>PP_Instance</code>. + * @param[in] name A string or undefined <code>PP_Var</code>. The name of the + * alarm to get. Defaults to the empty string. + * @param[out] alarm A <code>PP_Alarms_Alarm_Dev</code> struct to store the + * output result. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An error code from <code>pp_errors.h</code> + */ + int32_t (*Get)(PP_Instance instance, + struct PP_Var name, + struct PP_Alarms_Alarm_Dev* alarm, + struct PP_CompletionCallback callback); + /** + * Gets an array of all the alarms. + * + * @param[in] instance A <code>PP_Instance</code>. + * @param[out] alarms A <code>PP_Alarms_Alarm_Array_Dev</code> to store the + * output result. + * @param[in] array_allocator A <code>PP_ArrayOutput</code> to allocate memory + * for <code>alarms</code>. + * @param[in] callback A <code>PP_CompletionCallback</code> to be called upon + * completion. + * + * @return An error code from <code>pp_errors.h</code> + */ + int32_t (*GetAll)(PP_Instance instance, + struct PP_Alarms_Alarm_Array_Dev* alarms, + struct PP_ArrayOutput array_allocator, + struct PP_CompletionCallback callback); + /** + * Clears the alarm with the given name. + * + * @param[in] instance A <code>PP_Instance</code>. + * @param[in] name A string or undefined <code>PP_Var</code>. The name of the + * alarm to clear. Defaults to the empty string. + */ + void (*Clear)(PP_Instance instance, struct PP_Var name); + /** + * Clears all alarms. + * + * @param[in] instance A <code>PP_Instance</code>. + */ + void (*ClearAll)(PP_Instance instance); + /** + * Registers <code>PP_Alarms_OnAlarm_Dev</code> event. + * + * @param[in] instance A <code>PP_Instance</code>. + * @param[in] callback The callback to receive notifications. + * @param[inout] user_data An opaque pointer that will be passed to + * <code>callback</code>. + * + * @return A listener ID, or 0 if failed. + * + * TODO(yzshen): add a PPB_Events_Dev interface for unregistering: + * void UnregisterListener(PP_instance instance, uint32_t listener_id); + */ + uint32_t (*AddOnAlarmListener)(PP_Instance instance, + PP_Alarms_OnAlarm_Dev callback, + void* user_data); +}; + +typedef struct PPB_Alarms_Dev_0_1 PPB_Alarms_Dev; +/** + * @} + */ + +#endif /* PPAPI_C_DEV_PPB_ALARMS_DEV_H_ */ + diff --git a/ppapi/generators/idl_c_header.py b/ppapi/generators/idl_c_header.py index a3b8688..d3a1b32 100755 --- a/ppapi/generators/idl_c_header.py +++ b/ppapi/generators/idl_c_header.py @@ -145,12 +145,7 @@ def CheckTypedefs(filenode, releases): See http://crbug.com/233439 for details. """ cgen = CGen() - # TODO(teravest): Fix the following callback to pass PP_Var by pointer - # instead of by value. - node_whitelist = ['PP_Ext_Alarms_OnAlarm_Func_Dev_0_1'] for node in filenode.GetListOf('Typedef'): - if node.GetName() in node_whitelist: - continue build_list = node.GetUniqueReleases(releases) callnode = node.GetOneOf('Callspec') if callnode: @@ -162,7 +157,7 @@ def CheckTypedefs(filenode, releases): t = param.GetType(build_list[0]) while t.IsA('Typedef'): t = t.GetType(build_list[0]) - if t.IsA('Struct'): + if t.IsA('Struct') and t.GetProperty('passByValue'): raise Exception('%s is a struct in callback %s. ' 'See http://crbug.com/233439' % (t.GetName(), node.GetName())) diff --git a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c index 4a44225..bb9b089 100644 --- a/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c +++ b/ppapi/native_client/src/untrusted/pnacl_irt_shim/pnacl_shim.c @@ -7,6 +7,7 @@ #include "ppapi/generators/pnacl_shim.h" #include "ppapi/c/ppb.h" +#include "ppapi/c/dev/ppb_alarms_dev.h" #include "ppapi/c/dev/ppb_audio_input_dev.h" #include "ppapi/c/dev/ppb_buffer_dev.h" #include "ppapi/c/dev/ppb_crypto_dev.h" @@ -173,6 +174,7 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarArrayBuffer_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_VarDictionary_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_WebSocket_1_0; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Messaging_1_0; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Alarms_Dev_0_1; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_2; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3; static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_4; @@ -1619,6 +1621,40 @@ static void Pnacl_M14_PPP_Messaging_HandleMessage(PP_Instance instance, struct P /* Not generating wrapper methods for PPB_URLLoaderTrusted_0_3 */ +/* Begin wrapper methods for PPB_Alarms_Dev_0_1 */ + +static void Pnacl_M33_PPB_Alarms_Dev_Create(PP_Instance instance, struct PP_Var* name, const struct PP_Alarms_AlarmCreateInfo_Dev* alarm_info) { + const struct PPB_Alarms_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Alarms_Dev_0_1.real_iface; + iface->Create(instance, *name, alarm_info); +} + +static int32_t Pnacl_M33_PPB_Alarms_Dev_Get(PP_Instance instance, struct PP_Var* name, struct PP_Alarms_Alarm_Dev* alarm, struct PP_CompletionCallback* callback) { + const struct PPB_Alarms_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Alarms_Dev_0_1.real_iface; + return iface->Get(instance, *name, alarm, *callback); +} + +static int32_t Pnacl_M33_PPB_Alarms_Dev_GetAll(PP_Instance instance, struct PP_Alarms_Alarm_Array_Dev* alarms, struct PP_ArrayOutput* array_allocator, struct PP_CompletionCallback* callback) { + const struct PPB_Alarms_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Alarms_Dev_0_1.real_iface; + return iface->GetAll(instance, alarms, *array_allocator, *callback); +} + +static void Pnacl_M33_PPB_Alarms_Dev_Clear(PP_Instance instance, struct PP_Var* name) { + const struct PPB_Alarms_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Alarms_Dev_0_1.real_iface; + iface->Clear(instance, *name); +} + +static void Pnacl_M33_PPB_Alarms_Dev_ClearAll(PP_Instance instance) { + const struct PPB_Alarms_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Alarms_Dev_0_1.real_iface; + iface->ClearAll(instance); +} + +static uint32_t Pnacl_M33_PPB_Alarms_Dev_AddOnAlarmListener(PP_Instance instance, PP_Alarms_OnAlarm_Dev callback, void* user_data) { + const struct PPB_Alarms_Dev_0_1 *iface = Pnacl_WrapperInfo_PPB_Alarms_Dev_0_1.real_iface; + return iface->AddOnAlarmListener(instance, callback, user_data); +} + +/* End wrapper methods for PPB_Alarms_Dev_0_1 */ + /* Begin wrapper methods for PPB_AudioInput_Dev_0_2 */ static PP_Resource Pnacl_M19_PPB_AudioInput_Dev_Create(PP_Instance instance) { @@ -4435,6 +4471,15 @@ struct PPP_Messaging_1_0 Pnacl_Wrappers_PPP_Messaging_1_0 = { /* Not generating wrapper interface for PPB_URLLoaderTrusted_0_3 */ +struct PPB_Alarms_Dev_0_1 Pnacl_Wrappers_PPB_Alarms_Dev_0_1 = { + .Create = (void (*)(PP_Instance instance, struct PP_Var name, const struct PP_Alarms_AlarmCreateInfo_Dev* alarm_info))&Pnacl_M33_PPB_Alarms_Dev_Create, + .Get = (int32_t (*)(PP_Instance instance, struct PP_Var name, struct PP_Alarms_Alarm_Dev* alarm, struct PP_CompletionCallback callback))&Pnacl_M33_PPB_Alarms_Dev_Get, + .GetAll = (int32_t (*)(PP_Instance instance, struct PP_Alarms_Alarm_Array_Dev* alarms, struct PP_ArrayOutput array_allocator, struct PP_CompletionCallback callback))&Pnacl_M33_PPB_Alarms_Dev_GetAll, + .Clear = (void (*)(PP_Instance instance, struct PP_Var name))&Pnacl_M33_PPB_Alarms_Dev_Clear, + .ClearAll = (void (*)(PP_Instance instance))&Pnacl_M33_PPB_Alarms_Dev_ClearAll, + .AddOnAlarmListener = (uint32_t (*)(PP_Instance instance, PP_Alarms_OnAlarm_Dev callback, void* user_data))&Pnacl_M33_PPB_Alarms_Dev_AddOnAlarmListener +}; + struct PPB_AudioInput_Dev_0_2 Pnacl_Wrappers_PPB_AudioInput_Dev_0_2 = { .Create = (PP_Resource (*)(PP_Instance instance))&Pnacl_M19_PPB_AudioInput_Dev_Create, .IsAudioInput = (PP_Bool (*)(PP_Resource resource))&Pnacl_M19_PPB_AudioInput_Dev_IsAudioInput, @@ -5335,6 +5380,12 @@ static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPP_Messaging_1_0 = { .real_iface = NULL }; +static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_Alarms_Dev_0_1 = { + .iface_macro = PPB_ALARMS_DEV_INTERFACE_0_1, + .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_Alarms_Dev_0_1, + .real_iface = NULL +}; + static struct __PnaclWrapperInfo Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_2 = { .iface_macro = PPB_AUDIO_INPUT_DEV_INTERFACE_0_2, .wrapped_iface = (void *) &Pnacl_Wrappers_PPB_AudioInput_Dev_0_2, @@ -5745,6 +5796,7 @@ static struct __PnaclWrapperInfo *s_ppb_wrappers[] = { &Pnacl_WrapperInfo_PPB_VarArrayBuffer_1_0, &Pnacl_WrapperInfo_PPB_VarDictionary_1_0, &Pnacl_WrapperInfo_PPB_WebSocket_1_0, + &Pnacl_WrapperInfo_PPB_Alarms_Dev_0_1, &Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_2, &Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_3, &Pnacl_WrapperInfo_PPB_AudioInput_Dev_0_4, diff --git a/ppapi/ppapi_shared.gypi b/ppapi/ppapi_shared.gypi index 0a96e4e..3cdec10 100644 --- a/ppapi/ppapi_shared.gypi +++ b/ppapi/ppapi_shared.gypi @@ -131,6 +131,7 @@ 'thunk/enter.cc', 'thunk/enter.h', 'thunk/extensions_common_api.h', + 'thunk/ppb_alarms_dev_thunk.cc', 'thunk/ppb_audio_api.h', 'thunk/ppb_audio_config_api.h', 'thunk/ppb_audio_config_thunk.cc', diff --git a/ppapi/ppapi_sources.gypi b/ppapi/ppapi_sources.gypi index cae19b4..793cbfc 100644 --- a/ppapi/ppapi_sources.gypi +++ b/ppapi/ppapi_sources.gypi @@ -69,7 +69,9 @@ # Dev interfaces. 'c/dev/pp_cursor_type_dev.h', + 'c/dev/pp_optional_structs_dev.h', 'c/dev/pp_video_dev.h', + 'c/dev/ppb_alarms_dev.h', 'c/dev/ppb_buffer_dev.h', 'c/dev/ppb_char_set_dev.h', 'c/dev/ppb_cursor_control_dev.h', diff --git a/ppapi/proxy/interface_list.cc b/ppapi/proxy/interface_list.cc index b32a07e..588d354 100644 --- a/ppapi/proxy/interface_list.cc +++ b/ppapi/proxy/interface_list.cc @@ -6,6 +6,7 @@ #include "base/lazy_instance.h" #include "base/memory/singleton.h" +#include "ppapi/c/dev/ppb_alarms_dev.h" #include "ppapi/c/dev/ppb_audio_input_dev.h" #include "ppapi/c/dev/ppb_buffer_dev.h" #include "ppapi/c/dev/ppb_char_set_dev.h" diff --git a/ppapi/tests/all_c_includes.h b/ppapi/tests/all_c_includes.h index 1dbd4e1..52a42fb 100644 --- a/ppapi/tests/all_c_includes.h +++ b/ppapi/tests/all_c_includes.h @@ -10,7 +10,9 @@ #include "ppapi/c/dev/deprecated_bool.h" #include "ppapi/c/dev/pp_cursor_type_dev.h" +#include "ppapi/c/dev/pp_optional_structs_dev.h" #include "ppapi/c/dev/pp_video_dev.h" +#include "ppapi/c/dev/ppb_alarms_dev.h" #include "ppapi/c/dev/ppb_buffer_dev.h" #include "ppapi/c/dev/ppb_char_set_dev.h" #include "ppapi/c/dev/ppb_crypto_dev.h" diff --git a/ppapi/thunk/interfaces_ppb_public_dev.h b/ppapi/thunk/interfaces_ppb_public_dev.h index 44af06d..2c894e4 100644 --- a/ppapi/thunk/interfaces_ppb_public_dev.h +++ b/ppapi/thunk/interfaces_ppb_public_dev.h @@ -10,6 +10,7 @@ // Map the old dev console interface to the stable one (which is the same) to // keep Flash, etc. working. PROXIED_IFACE(PPB_Instance, "PPB_Console(Dev);0.1", PPB_Console_1_0) +PROXIED_IFACE(NoAPIName, PPB_ALARMS_DEV_INTERFACE_0_1, PPB_Alarms_Dev_0_1) PROXIED_IFACE(NoAPIName, PPB_CURSOR_CONTROL_DEV_INTERFACE_0_4, PPB_CursorControl_Dev_0_4) PROXIED_IFACE(NoAPIName, PPB_EXT_SOCKET_DEV_INTERFACE_0_1, diff --git a/ppapi/thunk/ppb_alarms_dev_thunk.cc b/ppapi/thunk/ppb_alarms_dev_thunk.cc new file mode 100644 index 0000000..2d2ae14 --- /dev/null +++ b/ppapi/thunk/ppb_alarms_dev_thunk.cc @@ -0,0 +1,82 @@ +// Copyright 2013 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. + +#include "base/logging.h" +#include "ppapi/c/dev/ppb_alarms_dev.h" +#include "ppapi/shared_impl/tracked_callback.h" +#include "ppapi/thunk/enter.h" +#include "ppapi/thunk/extensions_common_api.h" +#include "ppapi/thunk/thunk.h" + +namespace ppapi { +namespace thunk { + +namespace { + +// TODO(yzshen): crbug.com/327197 Implement the thunk. + +void Create(PP_Instance instance, + PP_Var name, + const PP_Alarms_AlarmCreateInfo_Dev* alarm_info) { + NOTIMPLEMENTED(); +} + +int32_t Get(PP_Instance instance, + PP_Var name, + PP_Alarms_Alarm_Dev* alarm, + PP_CompletionCallback callback) { + EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback); + if (enter.failed()) + return enter.retval(); + + NOTIMPLEMENTED(); + + return enter.SetResult(PP_ERROR_FAILED); +} + +int32_t GetAll(PP_Instance instance, + PP_Alarms_Alarm_Array_Dev* alarms, + PP_ArrayOutput array_allocator, + PP_CompletionCallback callback) { + EnterInstanceAPI<ExtensionsCommon_API> enter(instance, callback); + if (enter.failed()) + return enter.retval(); + + NOTIMPLEMENTED(); + + return enter.SetResult(PP_ERROR_FAILED); +} + +void Clear(PP_Instance instance, PP_Var name) { + NOTIMPLEMENTED(); +} + +void ClearAll(PP_Instance instance) { + NOTIMPLEMENTED(); +} + +uint32_t AddOnAlarmListener(PP_Instance instance, + PP_Alarms_OnAlarm_Dev callback, + void* user_data) { + NOTIMPLEMENTED(); + return 0; +} + +const PPB_Alarms_Dev_0_1 g_ppb_alarms_dev_0_1_thunk = { + &Create, + &Get, + &GetAll, + &Clear, + &ClearAll, + &AddOnAlarmListener +}; + +} // namespace + +const PPB_Alarms_Dev_0_1* GetPPB_Alarms_Dev_0_1_Thunk() { + return &g_ppb_alarms_dev_0_1_thunk; +} + +} // namespace thunk +} // namespace ppapi |