cc: Added inline to Tile::IsReadyToDraw
[chromium-blink-merge.git] / ppapi / api / extensions / dev / ppb_ext_events_dev.idl
blobcfcc809c7cc4f5670fcfe64910cdae404d2b3f28
1 /* Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file.
4 */
6 label Chrome {
7 M27 = 0.1
8 };
10 /**
11 * Used to represent arbitrary C function pointers. Please note that usually
12 * the function that a <code>PP_Ext_GenericFuncType</code> pointer points to
13 * has a different signature than <code>void (*)()</code>.
15 typedef void PP_Ext_GenericFuncType();
17 /**
18 * An event listener that can be registered with the browser and receive
19 * notifications via the callback function.
21 * A function is defined for each event type to return a properly-filled
22 * <code>PP_Ext_EventListener</code> struct, for example,
23 * <code>PP_Ext_Alarms_OnAlarm_Dev()</code>.
25 [passByValue]
26 struct PP_Ext_EventListener {
27 /**
28 * The name of the event to register to.
30 cstr_t event_name;
31 /**
32 * A callback function whose signature is determined by
33 * <code>event_name</code>. All calls will happen on the same thread as the
34 * one on which <code>AddListener()</code> is called.
36 PP_Ext_GenericFuncType func;
37 /**
38 * An opaque pointer that will be passed to <code>func</code>.
40 mem_t user_data;
43 interface PPB_Ext_Events_Dev {
44 /**
45 * Registers a listener to an event.
47 * @param[in] instance A <code>PP_Instance</code> identifying one instance of
48 * a module.
49 * @param[in] listener A <code>PP_Ext_EventListener</code> struct.
51 * @return An listener ID, or 0 if failed.
53 uint32_t AddListener(
54 [in] PP_Instance instance,
55 [in] PP_Ext_EventListener listener);
57 /**
58 * Deregisters a listener.
60 * @param[in] instance A <code>PP_Instance</code> identifying one instance of
61 * a module.
62 * @param[in] listener_id The ID returned by <code>AddListener()</code>.
64 void RemoveListener(
65 [in] PP_Instance instance,
66 [in] uint32_t listener_id);
69 #inline c
70 /**
71 * Creates a <code>PP_Ext_EventListener</code> struct.
73 * Usually you should not call it directly. Instead you should call those
74 * functions that return a <code>PP_Ext_EventListener</code> struct for a
75 * specific event type, for example, <code>PP_Ext_Alarms_OnAlarm_Dev()</code>.
77 PP_INLINE struct PP_Ext_EventListener PP_Ext_MakeEventListener(
78 const char* event_name,
79 PP_Ext_GenericFuncType func,
80 void* user_data) {
81 struct PP_Ext_EventListener listener;
82 listener.event_name = event_name;
83 listener.func = func;
84 listener.user_data = user_data;
85 return listener;
87 #endinl