Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 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 | |
| 5 | |
| 6 #ifndef PPAPI_SIMPLE_PPAPI_EVENT_H_ | |
| 7 #define PPAPI_SIMPLE_PPAPI_EVENT_H_ | |
| 8 | |
| 9 #include "ppapi/c/pp_bool.h" | |
| 10 #include "ppapi/c/pp_resource.h" | |
| 11 #include "ppapi/c/pp_var.h" | |
| 12 | |
| 13 #include "utils/macros.h" | |
| 14 | |
| 15 EXTERN_C_BEGIN | |
| 16 | |
| 17 | |
| 18 | |
| 19 /** | |
| 20 * PSEvent | |
| 21 * | |
| 22 * The PSEvent system provides a lock-less in-order event processing mechanism. | |
|
nfullagar1
2013/05/23 21:58:36
remove lock-less
noelallen1
2013/05/24 18:08:31
Done.
| |
| 23 * As Pepper events such as input, or focus and view changes arive on the, | |
|
binji
2013/05/23 18:06:49
sp: arrive
binji
2013/05/23 18:06:49
remove , after the
noelallen1
2013/05/23 22:01:24
Done.
noelallen1
2013/05/23 22:01:24
Done.
| |
| 24 * main pepper thread, they are placed on various FIFOs based on event type. | |
| 25 * For any given event type, only a single thread will process those events. | |
| 26 * | |
| 27 * By default, the "EventThread" will receive all messages. However any thread | |
| 28 * can call PSRequestEventsType to request that all new events of that type | |
| 29 * are placed on that particular thread's Q. | |
|
binji
2013/05/23 18:06:49
s/Q/queue/
noelallen1
2013/05/23 22:01:24
Done.
| |
| 30 * | |
| 31 * This allows the developer to choose which threads handle which event types | |
| 32 * while keeping all events belonging to a particular thread in order. This | |
| 33 * is useful, for example, in the case of graphics to synchronize the size | |
| 34 * of the graphics context, with mouse clicks to correctly interpret location. | |
| 35 */ | |
| 36 | |
| 37 | |
| 38 typedef enum { | |
| 39 PS_NO_EVENTS = 0, // Mask off all events | |
| 40 PS_MESSAGE_EVENT = 1, // From HandleMessage, contains a PP_Var | |
| 41 PS_VIEW_EVENT = 2, // From DidChangeView, contains a view resource | |
| 42 PS_INPUT_EVENT = 4, // From HandleInputEvent, conatins an input resource | |
| 43 PS_FOCUS_EVENT = 8, // Focus change, contains a PP_Bool | |
| 44 PS_LOST_EVENT = 16, // When the 3D context is lost, no resource. | |
|
binji
2013/05/23 18:06:49
PS_LOST_EVENT is a bit generic, maybe PS_3D_LOST_E
noelallen1
2013/05/23 22:01:24
Done.
| |
| 45 PS_LOCK_EVENT = 32, // When the mouse lock is lost. | |
|
binji
2013/05/23 18:06:49
same, maybe PS_MOUSELOCK_LOST_EVENT?
noelallen1
2013/05/23 22:01:24
Done.
| |
| 46 PS_ALL_EVENTS = -1, // Enable all events | |
| 47 } PSEventType; | |
| 48 | |
| 49 | |
| 50 // Generic Event | |
| 51 typedef struct { | |
| 52 PSEventType type_; | |
|
binji
2013/05/23 18:06:49
event type is a bitmask, but are we ensured that t
noelallen1
2013/05/23 22:01:24
The PostEvent functions verify that type_ is an ex
| |
| 53 union { | |
| 54 PP_Bool bool_; | |
|
binji
2013/05/23 18:06:49
which union members are matched to which event typ
noelallen1
2013/05/23 22:01:24
In the comments above by the event type enum. See
| |
| 55 PP_Resource resource_; | |
| 56 struct PP_Var var_; | |
| 57 }; | |
| 58 } PSEvent; | |
| 59 | |
| 60 | |
| 61 /** | |
| 62 * Function for queuing, acquiring, and releasing events. | |
| 63 */ | |
| 64 PSEvent* PSCreateEvent(); | |
| 65 PSEvent* PSAcquireEvent(int block); | |
| 66 void PSReleaseEvent(PSEvent* event); | |
| 67 void PSSetEventFilter(uint32_t); | |
| 68 | |
| 69 /** | |
| 70 * PSPostEvent | |
| 71 * | |
| 72 * Creates and adds an event of the specified type to the event queue if | |
| 73 * that event type is not currently filtered. | |
| 74 */ | |
| 75 void PSPostEvent(PSEventType type); | |
| 76 void PSPostBoolEvent(PSEventType type, PP_Bool state); | |
| 77 void PSPostVarEvent(PSEventType type, struct PP_Var var); | |
| 78 void PSPostResourceEvent(PSEventType type, PP_Resource resource); | |
| 79 | |
| 80 EXTERN_C_END | |
| 81 | |
| 82 #endif // PPAPI_SIMPLE_PPAPI_EVENT_H_ | |
| 83 | |
| OLD | NEW |