reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 1 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 2 | * Copyright 2006 The Android Open Source Project |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 3 | * |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 4 | * Use of this source code is governed by a BSD-style license that can be |
| 5 | * found in the LICENSE file. |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 6 | */ |
| 7 | |
| 8 | #ifndef SkEvent_DEFINED |
| 9 | #define SkEvent_DEFINED |
| 10 | |
| 11 | #include "SkDOM.h" |
| 12 | #include "SkMetaData.h" |
| 13 | #include "SkString.h" |
| 14 | |
halcanary | 4dbbd04 | 2016-06-07 17:21:10 -0700 | [diff] [blame] | 15 | #include "../private/SkLeanWindows.h" |
| 16 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 17 | /** Unique 32bit id used to identify an instance of SkEventSink. When events are |
| 18 | posted, they are posted to a specific sinkID. When it is time to dispatch the |
| 19 | event, the sinkID is used to find the specific SkEventSink object. If it is found, |
| 20 | its doEvent() method is called with the event. |
| 21 | */ |
| 22 | typedef uint32_t SkEventSinkID; |
| 23 | |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 24 | /** |
| 25 | * \class SkEvent |
| 26 | * |
| 27 | * When an event is dispatched from the event queue, it is either sent to |
| 28 | * the eventsink matching the target ID (if not 0), or the target proc is |
| 29 | * called (if not NULL). |
| 30 | */ |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 31 | class SkEvent { |
| 32 | public: |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 33 | /** |
| 34 | * Function pointer that takes an event, returns true if it "handled" it. |
| 35 | */ |
| 36 | typedef bool (*Proc)(const SkEvent& evt); |
| 37 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 38 | SkEvent(); |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 39 | explicit SkEvent(const SkString& type, SkEventSinkID = 0); |
| 40 | explicit SkEvent(const char type[], SkEventSinkID = 0); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 41 | SkEvent(const SkEvent& src); |
| 42 | ~SkEvent(); |
| 43 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 44 | /** Copy the event's type into the specified SkString parameter */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 45 | void getType(SkString* str) const; |
| 46 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 47 | /** Returns true if the event's type matches exactly the specified type (case sensitive) */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 48 | bool isType(const SkString& str) const; |
| 49 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 50 | /** Returns true if the event's type matches exactly the specified type (case sensitive) */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 51 | bool isType(const char type[], size_t len = 0) const; |
| 52 | |
| 53 | /** |
| 54 | * Set the event's type to the specified string. |
| 55 | */ |
| 56 | void setType(const SkString&); |
| 57 | |
| 58 | /** |
| 59 | * Set the event's type to the specified string. |
| 60 | */ |
| 61 | void setType(const char type[], size_t len = 0); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 62 | |
reed@google.com | c514dde | 2011-08-03 19:41:24 +0000 | [diff] [blame] | 63 | /** |
| 64 | * Return the target ID, or 0 if there is none. |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 65 | * |
| 66 | * When an event is dispatched from the event queue, it is either sent to |
| 67 | * the eventsink matching the targetID (if not 0), or the target proc is |
| 68 | * called (if not NULL). |
reed@google.com | c514dde | 2011-08-03 19:41:24 +0000 | [diff] [blame] | 69 | */ |
| 70 | SkEventSinkID getTargetID() const { return fTargetID; } |
| 71 | |
| 72 | /** |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 73 | * Set the target ID for this event. 0 means none. Calling this will |
| 74 | * automatically clear the targetProc to null. |
| 75 | * |
| 76 | * When an event is dispatched from the event queue, it is either sent to |
| 77 | * the eventsink matching the targetID (if not 0), or the target proc is |
| 78 | * called (if not NULL). |
reed@google.com | c514dde | 2011-08-03 19:41:24 +0000 | [diff] [blame] | 79 | */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 80 | SkEvent* setTargetID(SkEventSinkID targetID) { |
| 81 | fTargetProc = NULL; |
| 82 | fTargetID = targetID; |
| 83 | return this; |
| 84 | } |
reed@google.com | c514dde | 2011-08-03 19:41:24 +0000 | [diff] [blame] | 85 | |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 86 | /** |
| 87 | * Return the target proc, or NULL if it has none. |
| 88 | * |
| 89 | * When an event is dispatched from the event queue, it is either sent to |
| 90 | * the eventsink matching the targetID (if not 0), or the target proc is |
| 91 | * called (if not NULL). |
| 92 | */ |
| 93 | Proc getTargetProc() const { return fTargetProc; } |
| 94 | |
| 95 | /** |
| 96 | * Set the target ID for this event. NULL means none. Calling this will |
| 97 | * automatically clear the targetID to 0. |
| 98 | * |
| 99 | * When an event is dispatched from the event queue, it is either sent to |
| 100 | * the eventsink matching the targetID (if not 0), or the target proc is |
| 101 | * called (if not NULL). |
| 102 | */ |
| 103 | SkEvent* setTargetProc(Proc proc) { |
| 104 | fTargetID = 0; |
| 105 | fTargetProc = proc; |
| 106 | return this; |
| 107 | } |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 108 | |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 109 | /** |
| 110 | * Return the event's unnamed 32bit field. Default value is 0 |
| 111 | */ |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 112 | uint32_t getFast32() const { return f32; } |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 113 | |
| 114 | /** |
| 115 | * Set the event's unnamed 32bit field. |
| 116 | */ |
| 117 | void setFast32(uint32_t x) { f32 = x; } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 118 | |
| 119 | /** Return true if the event contains the named 32bit field, and return the field |
| 120 | in value (if value is non-null). If there is no matching named field, return false |
| 121 | and ignore the value parameter. |
| 122 | */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 123 | bool findS32(const char name[], int32_t* value = NULL) const { return fMeta.findS32(name, value); } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 124 | /** Return true if the event contains the named SkScalar field, and return the field |
| 125 | in value (if value is non-null). If there is no matching named field, return false |
| 126 | and ignore the value parameter. |
| 127 | */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 128 | bool findScalar(const char name[], SkScalar* value = NULL) const { return fMeta.findScalar(name, value); } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 129 | /** Return true if the event contains the named SkScalar field, and return the fields |
| 130 | in value[] (if value is non-null), and return the number of SkScalars in count (if count is non-null). |
| 131 | If there is no matching named field, return false and ignore the value and count parameters. |
| 132 | */ |
| 133 | const SkScalar* findScalars(const char name[], int* count, SkScalar values[] = NULL) const { return fMeta.findScalars(name, count, values); } |
| 134 | /** Return the value of the named string field, or if no matching named field exists, return null. |
| 135 | */ |
| 136 | const char* findString(const char name[]) const { return fMeta.findString(name); } |
| 137 | /** Return true if the event contains the named pointer field, and return the field |
| 138 | in value (if value is non-null). If there is no matching named field, return false |
| 139 | and ignore the value parameter. |
| 140 | */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 141 | bool findPtr(const char name[], void** value) const { return fMeta.findPtr(name, value); } |
| 142 | bool findBool(const char name[], bool* value) const { return fMeta.findBool(name, value); } |
reed@android.com | f2b98d6 | 2010-12-20 18:26:13 +0000 | [diff] [blame] | 143 | const void* findData(const char name[], size_t* byteCount = NULL) const { |
| 144 | return fMeta.findData(name, byteCount); |
| 145 | } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 146 | |
| 147 | /** Returns true if ethe event contains the named 32bit field, and if it equals the specified value */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 148 | bool hasS32(const char name[], int32_t value) const { return fMeta.hasS32(name, value); } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 149 | /** Returns true if ethe event contains the named SkScalar field, and if it equals the specified value */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 150 | bool hasScalar(const char name[], SkScalar value) const { return fMeta.hasScalar(name, value); } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 151 | /** Returns true if ethe event contains the named string field, and if it equals (using strcmp) the specified value */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 152 | bool hasString(const char name[], const char value[]) const { return fMeta.hasString(name, value); } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 153 | /** Returns true if ethe event contains the named pointer field, and if it equals the specified value */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 154 | bool hasPtr(const char name[], void* value) const { return fMeta.hasPtr(name, value); } |
| 155 | bool hasBool(const char name[], bool value) const { return fMeta.hasBool(name, value); } |
reed@android.com | f2b98d6 | 2010-12-20 18:26:13 +0000 | [diff] [blame] | 156 | bool hasData(const char name[], const void* data, size_t byteCount) const { |
| 157 | return fMeta.hasData(name, data, byteCount); |
| 158 | } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 159 | |
| 160 | /** Add/replace the named 32bit field to the event. In XML use the subelement <data name=... s32=... /> */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 161 | void setS32(const char name[], int32_t value) { fMeta.setS32(name, value); } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 162 | /** Add/replace the named SkScalar field to the event. In XML use the subelement <data name=... scalar=... /> */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 163 | void setScalar(const char name[], SkScalar value) { fMeta.setScalar(name, value); } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 164 | /** Add/replace the named SkScalar[] field to the event. */ |
| 165 | SkScalar* setScalars(const char name[], int count, const SkScalar values[] = NULL) { return fMeta.setScalars(name, count, values); } |
| 166 | /** Add/replace the named string field to the event. In XML use the subelement <data name=... string=... */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 167 | void setString(const char name[], const SkString& value) { fMeta.setString(name, value.c_str()); } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 168 | /** Add/replace the named string field to the event. In XML use the subelement <data name=... string=... */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 169 | void setString(const char name[], const char value[]) { fMeta.setString(name, value); } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 170 | /** Add/replace the named pointer field to the event. There is no XML equivalent for this call */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 171 | void setPtr(const char name[], void* value) { fMeta.setPtr(name, value); } |
| 172 | void setBool(const char name[], bool value) { fMeta.setBool(name, value); } |
reed@android.com | f2b98d6 | 2010-12-20 18:26:13 +0000 | [diff] [blame] | 173 | void setData(const char name[], const void* data, size_t byteCount) { |
| 174 | fMeta.setData(name, data, byteCount); |
| 175 | } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 176 | |
| 177 | /** Return the underlying metadata object */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 178 | SkMetaData& getMetaData() { return fMeta; } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 179 | /** Return the underlying metadata object */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 180 | const SkMetaData& getMetaData() const { return fMeta; } |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 181 | |
| 182 | /** Call this to initialize the event from the specified XML node */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 183 | void inflate(const SkDOM&, const SkDOM::Node*); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 184 | |
| 185 | SkDEBUGCODE(void dump(const char title[] = NULL);) |
| 186 | |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 187 | /////////////////////////////////////////////////////////////////////////// |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 188 | |
reed@google.com | c514dde | 2011-08-03 19:41:24 +0000 | [diff] [blame] | 189 | /** |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 190 | * Post to the event queue using the event's targetID or target-proc. |
| 191 | * |
| 192 | * The event must be dynamically allocated, as ownership is transferred to |
| 193 | * the event queue. It cannot be allocated on the stack or in a global. |
reed@google.com | c514dde | 2011-08-03 19:41:24 +0000 | [diff] [blame] | 194 | */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 195 | void post() { |
reed@google.com | c514dde | 2011-08-03 19:41:24 +0000 | [diff] [blame] | 196 | return this->postDelay(0); |
| 197 | } |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 198 | |
reed@google.com | c514dde | 2011-08-03 19:41:24 +0000 | [diff] [blame] | 199 | /** |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 200 | * Post to the event queue using the event's targetID or target-proc and |
| 201 | * the specifed millisecond delay. |
| 202 | * |
| 203 | * The event must be dynamically allocated, as ownership is transferred to |
| 204 | * the event queue. It cannot be allocated on the stack or in a global. |
reed@google.com | c514dde | 2011-08-03 19:41:24 +0000 | [diff] [blame] | 205 | */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 206 | void postDelay(SkMSec delay); |
rmistry@google.com | fbfcd56 | 2012-08-23 18:09:54 +0000 | [diff] [blame] | 207 | |
reed@google.com | c514dde | 2011-08-03 19:41:24 +0000 | [diff] [blame] | 208 | /** |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 209 | * Post to the event queue using the event's targetID or target-proc. |
| 210 | * The event will be delivered no sooner than the specified millisecond |
benjaminwagner | ec4d4d7 | 2016-03-25 12:59:53 -0700 | [diff] [blame] | 211 | * time, as measured by GetMSecsSinceStartup(). |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 212 | * |
| 213 | * The event must be dynamically allocated, as ownership is transferred to |
| 214 | * the event queue. It cannot be allocated on the stack or in a global. |
reed@google.com | c514dde | 2011-08-03 19:41:24 +0000 | [diff] [blame] | 215 | */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 216 | void postTime(SkMSec time); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 217 | |
benjaminwagner | ec4d4d7 | 2016-03-25 12:59:53 -0700 | [diff] [blame] | 218 | /** |
| 219 | * Returns ~zero the first time it's called, then returns the number of |
| 220 | * milliseconds since the first call. Behavior is undefined if the program |
| 221 | * runs more than ~25 days. |
| 222 | */ |
| 223 | static SkMSec GetMSecsSinceStartup(); |
| 224 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 225 | /////////////////////////////////////////////// |
| 226 | /** Porting layer must call these functions **/ |
| 227 | /////////////////////////////////////////////// |
| 228 | |
| 229 | /** Global initialization function for the SkEvent system. Should be called exactly |
| 230 | once before any other event method is called, and should be called after the |
| 231 | call to SkGraphics::Init(). |
| 232 | */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 233 | static void Init(); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 234 | /** Global cleanup function for the SkEvent system. Should be called exactly once after |
mtklein | fe81e2d | 2015-09-09 07:35:42 -0700 | [diff] [blame] | 235 | all event methods have been called. |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 236 | */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 237 | static void Term(); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 238 | |
| 239 | /** Call this to process one event from the queue. If it returns true, there are more events |
| 240 | to process. |
| 241 | */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 242 | static bool ProcessEvent(); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 243 | /** Call this whenever the requested timer has expired (requested by a call to SetQueueTimer). |
| 244 | It will post any delayed events whose time as "expired" onto the event queue. |
| 245 | It may also call SignalQueueTimer() and SignalNonEmptyQueue(). |
| 246 | */ |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 247 | static void ServiceQueueTimer(); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 248 | |
reed@android.com | f2b98d6 | 2010-12-20 18:26:13 +0000 | [diff] [blame] | 249 | /** Return the number of queued events. note that this value may be obsolete |
| 250 | upon return, since another thread may have called ProcessEvent() or |
| 251 | Post() after the count was made. |
| 252 | */ |
| 253 | static int CountEventsOnQueue(); |
| 254 | |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 255 | //////////////////////////////////////////////////// |
| 256 | /** Porting layer must implement these functions **/ |
| 257 | //////////////////////////////////////////////////// |
| 258 | |
| 259 | /** Called whenever an SkEvent is posted to an empty queue, so that the OS |
| 260 | can be told to later call Dequeue(). |
| 261 | */ |
| 262 | static void SignalNonEmptyQueue(); |
| 263 | /** Called whenever the delay until the next delayed event changes. If zero is |
| 264 | passed, then there are no more queued delay events. |
| 265 | */ |
| 266 | static void SignalQueueTimer(SkMSec delay); |
| 267 | |
tfarina@chromium.org | 887760f | 2012-10-01 16:14:21 +0000 | [diff] [blame] | 268 | #if defined(SK_BUILD_FOR_WIN) |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 269 | static bool WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 270 | #endif |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 271 | |
| 272 | private: |
| 273 | SkMetaData fMeta; |
| 274 | mutable char* fType; // may be characters with low bit set to know that it is not a pointer |
| 275 | uint32_t f32; |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 276 | |
| 277 | // 'there can be only one' (non-zero) between target-id and target-proc |
reed@google.com | c514dde | 2011-08-03 19:41:24 +0000 | [diff] [blame] | 278 | SkEventSinkID fTargetID; |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 279 | Proc fTargetProc; |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 280 | |
| 281 | // these are for our implementation of the event queue |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 282 | SkMSec fTime; |
| 283 | SkEvent* fNextEvent; // either in the delay or normal event queue |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 284 | |
| 285 | void initialize(const char* type, size_t typeLen, SkEventSinkID); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 286 | |
| 287 | static bool Enqueue(SkEvent* evt); |
| 288 | static SkMSec EnqueueTime(SkEvent* evt, SkMSec time); |
reed@google.com | 87fac4a | 2011-08-04 13:50:17 +0000 | [diff] [blame] | 289 | static SkEvent* Dequeue(); |
reed@android.com | 8a1c16f | 2008-12-17 15:59:43 +0000 | [diff] [blame] | 290 | static bool QHasEvents(); |
| 291 | }; |
| 292 | |
| 293 | #endif |