OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2006 The Android Open Source Project | 3 * Copyright 2006 The Android Open Source Project |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 #include "SkEventSink.h" | 10 #include "SkEventSink.h" |
11 #include "SkMutex.h" | |
12 #include "SkTagList.h" | 11 #include "SkTagList.h" |
| 12 #include "SkThread.h" |
| 13 |
| 14 #include "SkThread.h" |
13 #include "SkTime.h" | 15 #include "SkTime.h" |
14 | 16 |
15 class SkEventSink_Globals { | 17 class SkEventSink_Globals { |
16 public: | 18 public: |
17 SkEventSink_Globals() { | 19 SkEventSink_Globals() { |
18 fNextSinkID = 0; | 20 fNextSinkID = 0; |
19 fSinkHead = NULL; | 21 fSinkHead = NULL; |
20 } | 22 } |
21 | 23 |
22 SkMutex fSinkMutex; | 24 SkMutex fSinkMutex; |
(...skipping 224 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
247 sink = sink->fNextSink; | 249 sink = sink->fNextSink; |
248 } | 250 } |
249 return NULL; | 251 return NULL; |
250 } | 252 } |
251 | 253 |
252 ////////////////////////////////////////////////////////////////////////////////
//////// | 254 ////////////////////////////////////////////////////////////////////////////////
//////// |
253 ////////////////////////////////////////////////////////////////////////////////
//////// | 255 ////////////////////////////////////////////////////////////////////////////////
//////// |
254 | 256 |
255 #if 0 // experimental, not tested | 257 #if 0 // experimental, not tested |
256 | 258 |
257 #include "SkMutex.h" | 259 #include "SkThread.h" |
258 #include "SkTDict.h" | 260 #include "SkTDict.h" |
259 | 261 |
260 #define kMinStringBufferSize 128 | 262 #define kMinStringBufferSize 128 |
261 SK_DECLARE_STATIC_MUTEX(gNamedSinkMutex); | 263 SK_DECLARE_STATIC_MUTEX(gNamedSinkMutex); |
262 static SkTDict<SkEventSinkID> gNamedSinkIDs(kMinStringBufferSize); | 264 static SkTDict<SkEventSinkID> gNamedSinkIDs(kMinStringBufferSize); |
263 | 265 |
264 /** Register a name/id pair with the system. If the name already exists, | 266 /** Register a name/id pair with the system. If the name already exists, |
265 replace its ID with the new id. This pair will persist until UnregisterNamed
Sink() | 267 replace its ID with the new id. This pair will persist until UnregisterNamed
Sink() |
266 is called. | 268 is called. |
267 */ | 269 */ |
(...skipping 24 matching lines...) Expand all Loading... |
292 /** Remove all name/id pairs from the system. This is call internally | 294 /** Remove all name/id pairs from the system. This is call internally |
293 on shutdown, to ensure no memory leaks. It should not be called | 295 on shutdown, to ensure no memory leaks. It should not be called |
294 before shutdown. | 296 before shutdown. |
295 */ | 297 */ |
296 void SkEventSink::RemoveAllNamedSinkIDs() | 298 void SkEventSink::RemoveAllNamedSinkIDs() |
297 { | 299 { |
298 SkAutoMutexAcquire ac(gNamedSinkMutex); | 300 SkAutoMutexAcquire ac(gNamedSinkMutex); |
299 (void)gNamedSinkIDs.reset(); | 301 (void)gNamedSinkIDs.reset(); |
300 } | 302 } |
301 #endif | 303 #endif |
OLD | NEW |