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