summaryrefslogtreecommitdiffstats
path: root/ppapi/c
diff options
context:
space:
mode:
authoryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-11 03:19:56 +0000
committeryzshen@chromium.org <yzshen@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-03-11 03:19:56 +0000
commit9997d2396ff1cb7eea3cdaca6c9f204b02d8ca21 (patch)
tree931298487a435d45fd28fc91356a839939a41a18 /ppapi/c
parent9ffac888e58e2984e518bc24eff6ddcc0b4fdecc (diff)
downloadchromium_src-9997d2396ff1cb7eea3cdaca6c9f204b02d8ca21.zip
chromium_src-9997d2396ff1cb7eea3cdaca6c9f204b02d8ca21.tar.gz
chromium_src-9997d2396ff1cb7eea3cdaca6c9f204b02d8ca21.tar.bz2
Revert 187227 since it caused buildbot failure in NativeClientSDK on linux-sdk-multi
- Add C/C++ interfaces for PPB_Ext_Alarms_Dev and PPB_Ext_Events_Dev. This CL also adds necessary C++ utilities to support these interfaces. An example of using these APIs: https://codereview.chromium.org/12387051/ BUG=None TEST=None Review URL: https://codereview.chromium.org/12295043 TBR=yzshen@chromium.org Review URL: https://codereview.chromium.org/12760002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@187229 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/c')
-rw-r--r--ppapi/c/extensions/dev/ppb_alarms_dev.h202
-rw-r--r--ppapi/c/extensions/dev/ppb_events_dev.h118
2 files changed, 0 insertions, 320 deletions
diff --git a/ppapi/c/extensions/dev/ppb_alarms_dev.h b/ppapi/c/extensions/dev/ppb_alarms_dev.h
deleted file mode 100644
index a573527..0000000
--- a/ppapi/c/extensions/dev/ppb_alarms_dev.h
+++ /dev/null
@@ -1,202 +0,0 @@
-/* Copyright (c) 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 extensions/dev/ppb_alarms_dev.idl modified Tue Mar 05 14:02:41 2013. */
-
-#ifndef PPAPI_C_EXTENSIONS_DEV_PPB_ALARMS_DEV_H_
-#define PPAPI_C_EXTENSIONS_DEV_PPB_ALARMS_DEV_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_EXT_ALARMS_DEV_INTERFACE_0_1 "PPB_Ext_Alarms(Dev);0.1"
-#define PPB_EXT_ALARMS_DEV_INTERFACE PPB_EXT_ALARMS_DEV_INTERFACE_0_1
-
-/**
- * @file
- * This file defines the Pepper equivalent of the <code>chrome.alarms</code>
- * extension API.
- */
-
-
-#include "ppapi/c/extensions/dev/ppb_events_dev.h"
-
-/**
- * @addtogroup Typedefs
- * @{
- */
-/**
- * A dictionary <code>PP_Var</code> which contains:
- * - "name" : string <code>PP_Var</code>
- * Name of this alarm.
- *
- * - "scheduledTime" : double <code>PP_Var</code>
- * Time at which this alarm was scheduled to fire, in milliseconds past the
- * epoch (e.g. <code>Date.now() + n</code>). For performance reasons, the
- * alarm may have been delayed an arbitrary amount beyond this.
- *
- * - "periodInMinutes" : double or undefined <code>PP_Var</code>
- * If not undefined, the alarm is a repeating alarm and will fire again in
- * <var>periodInMinutes</var> minutes.
- */
-typedef struct PP_Var PP_Ext_Alarms_Alarm_Dev;
-
-/**
- * A dictionary <code>PP_Var</code> which contains
- * - "when" : double or undefined <code>PP_Var</code>
- * Time at which the alarm should fire, in milliseconds past the epoch
- * (e.g. <code>Date.now() + n</code>).
- *
- * - "delayInMinutes" : double or undefined <code>PP_Var</code>
- * Length of time in minutes after which the
- * <code>PP_Ext_Alarms_OnAlarm_Dev</code> event should fire.
- *
- * - "periodInMinutes" : double or undefined <code>PP_Var</code>
- * If set, the <code>PP_Ext_Alarms_OnAlarm_Dev</code> event should fire every
- * <var>periodInMinutes</var> minutes after the initial event specified by
- * <var>when</var> or <var>delayInMinutes</var>. If not set, the alarm will
- * only fire once.
- */
-typedef struct PP_Var PP_Ext_Alarms_AlarmCreateInfo_Dev;
-
-/**
- * An array <code>PP_Var</code> which contains elements of
- * <code>PP_Ext_Alarms_Alarm_Dev</code>.
- */
-typedef struct PP_Var PP_Ext_Alarms_Alarm_Dev_Array;
-/**
- * @}
- */
-
-/**
- * @addtogroup Interfaces
- * @{
- */
-struct PPB_Ext_Alarms_Dev_0_1 {
- /**
- * Creates an alarm. Near the time(s) specified by <var>alarm_info</var>,
- * the <code>PP_Ext_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>$ref:[PP_Ext_Alarms_AlarmCreateInfo_Dev.delayInMinutes
- * delayInMinutes]</code> or
- * <code>$ref:[PP_Ext_Alarms_AlarmCreateInfo_Dev.periodInMinutes
- * periodInMinutes]</code> to less than <code>1</code> will not be honored
- * and will cause a warning.
- * <code>$ref:[PP_Ext_Alarms_AlarmCreateInfo_Dev.when 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 A <code>PP_Var</code> whose contents conform to the
- * description of <code>PP_Ext_Alarms_AlarmCreateInfo_Dev</code>. Describes
- * when the alarm should fire. The initial time must be specified by either
- * <var>when</var> or <var>delayInMinutes</var> (but not both). If
- * <var>periodInMinutes</var> is set, the alarm will repeat every
- * <var>periodInMinutes</var> minutes after the initial event. If neither
- * <var>when</var> or <var>delayInMinutes</var> is set for a repeating alarm,
- * <var>periodInMinutes</var> is used as the default for
- * <var>delayInMinutes</var>.
- */
- void (*Create)(PP_Instance instance,
- struct PP_Var name,
- PP_Ext_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_Var</code> whose contents conform to the
- * description of <code>PP_Ext_Alarms_Alarm_Dev</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 (*Get)(PP_Instance instance,
- struct PP_Var name,
- PP_Ext_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_Var</code> whose contents conform to the
- * description of <code>PP_Ext_Alarms_Alarm_Dev_Array</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,
- PP_Ext_Alarms_Alarm_Dev_Array* alarms,
- 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);
-};
-
-typedef struct PPB_Ext_Alarms_Dev_0_1 PPB_Ext_Alarms_Dev;
-/**
- * @}
- */
-
-/**
- * @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 A <code>PP_Var</code> whose contents conform to the
- * description of <code>PP_Ext_Alarms_Alarm_Dev</code>. The alarm that has
- * elapsed.
- */
-typedef void (*PP_Ext_Alarms_OnAlarm_Func_Dev_0_1)(
- uint32_t listener_id,
- void* user_data,
- PP_Ext_Alarms_Alarm_Dev alarm);
-/**
- * @}
- */
-
-PP_INLINE struct PP_Ext_EventListener PP_Ext_Alarms_OnAlarm_Dev_0_1(
- PP_Ext_Alarms_OnAlarm_Func_Dev_0_1 func,
- void* user_data) {
- return PP_Ext_MakeEventListener("alarms.onAlarm;0.1",
- (PP_Ext_GenericFuncType)(func), user_data);
-}
-
-#define PP_Ext_Alarms_OnAlarm_Dev PP_Ext_Alarms_OnAlarm_Dev_0_1
-#endif /* PPAPI_C_EXTENSIONS_DEV_PPB_ALARMS_DEV_H_ */
-
diff --git a/ppapi/c/extensions/dev/ppb_events_dev.h b/ppapi/c/extensions/dev/ppb_events_dev.h
deleted file mode 100644
index 5483dc9..0000000
--- a/ppapi/c/extensions/dev/ppb_events_dev.h
+++ /dev/null
@@ -1,118 +0,0 @@
-/* Copyright (c) 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 extensions/dev/ppb_events_dev.idl modified Sun Mar 10 10:37:48 2013. */
-
-#ifndef PPAPI_C_EXTENSIONS_DEV_PPB_EVENTS_DEV_H_
-#define PPAPI_C_EXTENSIONS_DEV_PPB_EVENTS_DEV_H_
-
-#include "ppapi/c/pp_instance.h"
-#include "ppapi/c/pp_macros.h"
-#include "ppapi/c/pp_stdint.h"
-
-#define PPB_EXT_EVENTS_DEV_INTERFACE_0_1 "PPB_Ext_Events(Dev);0.1"
-#define PPB_EXT_EVENTS_DEV_INTERFACE PPB_EXT_EVENTS_DEV_INTERFACE_0_1
-
-/**
- * @file
- */
-
-
-/**
- * @addtogroup Typedefs
- * @{
- */
-/**
- * Used to represent arbitrary C function pointers. Please note that usually
- * the function that a <code>PP_Ext_GenericFuncType</code> pointer points to
- * has a different signature than <code>void (*)()</code>.
- */
-typedef void (*PP_Ext_GenericFuncType)(void);
-/**
- * @}
- */
-
-/**
- * @addtogroup Structs
- * @{
- */
-/**
- * An event listener that can be registered with the browser and receive
- * notifications via the callback function.
- *
- * A function is defined for each event type to return a properly-filled
- * <code>PP_Ext_EventListener</code> struct, for example,
- * <code>PP_Ext_Alarms_OnAlarm_Dev()</code>.
- */
-struct PP_Ext_EventListener {
- /**
- * The name of the event to register to.
- */
- const char* event_name;
- /**
- * A callback function whose signature is determined by
- * <code>event_name</code>. All calls will happen on the same thread as the
- * one on which <code>AddListener()</code> is called.
- */
- PP_Ext_GenericFuncType func;
- /**
- * An opaque pointer that will be passed to <code>func</code>.
- */
- void* user_data;
-};
-/**
- * @}
- */
-
-/**
- * @addtogroup Interfaces
- * @{
- */
-struct PPB_Ext_Events_Dev_0_1 {
- /**
- * Registers a listener to an event.
- *
- * @param[in] instance A <code>PP_Instance</code> identifying one instance of
- * a module.
- * @param[in] listener A <code>PP_Ext_EventListener</code> struct.
- *
- * @return An listener ID, or 0 if failed.
- */
- uint32_t (*AddListener)(PP_Instance instance,
- struct PP_Ext_EventListener listener);
- /**
- * Deregisters a listener.
- *
- * @param[in] instance A <code>PP_Instance</code> identifying one instance of
- * a module.
- * @param[in] listener_id The ID returned by <code>AddListener()</code>.
- */
- void (*RemoveListener)(PP_Instance instance, uint32_t listener_id);
-};
-
-typedef struct PPB_Ext_Events_Dev_0_1 PPB_Ext_Events_Dev;
-/**
- * @}
- */
-
-/**
- * Creates a <code>PP_Ext_EventListener</code> struct.
- *
- * Usually you should not call it directly. Instead you should call those
- * functions that return a <code>PP_Ext_EventListener</code> struct for a
- * specific event type, for example, <code>PP_Ext_Alarms_OnAlarm_Dev()</code>.
- */
-PP_INLINE struct PP_Ext_EventListener PP_Ext_MakeEventListener(
- const char* event_name,
- PP_Ext_GenericFuncType func,
- void* user_data) {
- struct PP_Ext_EventListener listener;
- listener.event_name = event_name;
- listener.func = func;
- listener.user_data = user_data;
- return listener;
-}
-#endif /* PPAPI_C_EXTENSIONS_DEV_PPB_EVENTS_DEV_H_ */
-