| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2006 The Android Open Source Project | 2 * Copyright 2006 The Android Open Source Project |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 | 8 |
| 9 #include "SkEventSink.h" | 9 #include "SkEventSink.h" |
| 10 #include "SkMutex.h" | 10 #include "SkMutex.h" |
| (...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 250 | 250 |
| 251 ////////////////////////////////////////////////////////////////////////////////
//////// | 251 ////////////////////////////////////////////////////////////////////////////////
//////// |
| 252 ////////////////////////////////////////////////////////////////////////////////
//////// | 252 ////////////////////////////////////////////////////////////////////////////////
//////// |
| 253 | 253 |
| 254 #if 0 // experimental, not tested | 254 #if 0 // experimental, not tested |
| 255 | 255 |
| 256 #include "SkMutex.h" | 256 #include "SkMutex.h" |
| 257 #include "SkTDict.h" | 257 #include "SkTDict.h" |
| 258 | 258 |
| 259 #define kMinStringBufferSize 128 | 259 #define kMinStringBufferSize 128 |
| 260 SK_DECLARE_STATIC_MUTEX(gNamedSinkMutex); | 260 static SkMutex gNamedSinkMutex; |
| 261 static SkTDict<SkEventSinkID> gNamedSinkIDs(kMinStringBufferSize); | 261 static SkTDict<SkEventSinkID> gNamedSinkIDs(kMinStringBufferSize); |
| 262 | 262 |
| 263 /** Register a name/id pair with the system. If the name already exists, | 263 /** Register a name/id pair with the system. If the name already exists, |
| 264 replace its ID with the new id. This pair will persist until UnregisterNamed
Sink() | 264 replace its ID with the new id. This pair will persist until UnregisterNamed
Sink() |
| 265 is called. | 265 is called. |
| 266 */ | 266 */ |
| 267 void SkEventSink::RegisterNamedSinkID(const char name[], SkEventSinkID id) | 267 void SkEventSink::RegisterNamedSinkID(const char name[], SkEventSinkID id) |
| 268 { | 268 { |
| 269 if (id && name && *name) | 269 if (id && name && *name) |
| 270 { | 270 { |
| (...skipping 20 matching lines...) Expand all Loading... |
| 291 /** Remove all name/id pairs from the system. This is call internally | 291 /** Remove all name/id pairs from the system. This is call internally |
| 292 on shutdown, to ensure no memory leaks. It should not be called | 292 on shutdown, to ensure no memory leaks. It should not be called |
| 293 before shutdown. | 293 before shutdown. |
| 294 */ | 294 */ |
| 295 void SkEventSink::RemoveAllNamedSinkIDs() | 295 void SkEventSink::RemoveAllNamedSinkIDs() |
| 296 { | 296 { |
| 297 SkAutoMutexAcquire ac(gNamedSinkMutex); | 297 SkAutoMutexAcquire ac(gNamedSinkMutex); |
| 298 (void)gNamedSinkIDs.reset(); | 298 (void)gNamedSinkIDs.reset(); |
| 299 } | 299 } |
| 300 #endif | 300 #endif |
| OLD | NEW |