Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(499)

Side by Side Diff: src/core/SkPixelRef.cpp

Issue 313823004: Add assertHeld() to SkMutex. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: more Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « src/core/SkPaint.cpp ('k') | src/core/SkScaledImageCache.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 1
2 /* 2 /*
3 * Copyright 2011 Google Inc. 3 * Copyright 2011 Google Inc.
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 #include "SkPixelRef.h" 8 #include "SkPixelRef.h"
9 #include "SkReadBuffer.h" 9 #include "SkReadBuffer.h"
10 #include "SkWriteBuffer.h" 10 #include "SkWriteBuffer.h"
11 #include "SkThread.h" 11 #include "SkThread.h"
12 12
13 #ifdef SK_USE_POSIX_THREADS 13 #ifdef SK_USE_POSIX_THREADS
14 14
15 static SkBaseMutex gPixelRefMutexRing[] = { 15 static SkBaseMutex gPixelRefMutexRing[] = {
16 { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, 16 SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT,
17 { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, 17 SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT,
18 { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, 18 SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT,
19 { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, 19 SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT,
20 20
21 { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, 21 SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT,
22 { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, 22 SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT,
23 { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, 23 SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT,
24 { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, 24 SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT,
25 25
26 { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, 26 SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT,
27 { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, 27 SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT,
28 { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, 28 SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT,
29 { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, 29 SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT,
30 30
31 { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, 31 SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT,
32 { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, 32 SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT,
33 { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, 33 SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT,
34 { PTHREAD_MUTEX_INITIALIZER }, { PTHREAD_MUTEX_INITIALIZER }, 34 SK_BASE_MUTEX_INIT, SK_BASE_MUTEX_INIT,
35 }; 35 };
36 36
37 // must be a power-of-2. undef to just use 1 mutex 37 // must be a power-of-2. undef to just use 1 mutex
38 #define PIXELREF_MUTEX_RING_COUNT SK_ARRAY_COUNT(gPixelRefMutexRing) 38 #define PIXELREF_MUTEX_RING_COUNT SK_ARRAY_COUNT(gPixelRefMutexRing)
39 39
40 #else // not pthreads 40 #else // not pthreads
41 41
42 // must be a power-of-2. undef to just use 1 mutex 42 // must be a power-of-2. undef to just use 1 mutex
43 #define PIXELREF_MUTEX_RING_COUNT 32 43 #define PIXELREF_MUTEX_RING_COUNT 32
44 static SkBaseMutex gPixelRefMutexRing[PIXELREF_MUTEX_RING_COUNT]; 44 static SkBaseMutex gPixelRefMutexRing[PIXELREF_MUTEX_RING_COUNT];
(...skipping 248 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 293
294 #ifdef SK_BUILD_FOR_ANDROID 294 #ifdef SK_BUILD_FOR_ANDROID
295 void SkPixelRef::globalRef(void* data) { 295 void SkPixelRef::globalRef(void* data) {
296 this->ref(); 296 this->ref();
297 } 297 }
298 298
299 void SkPixelRef::globalUnref() { 299 void SkPixelRef::globalUnref() {
300 this->unref(); 300 this->unref();
301 } 301 }
302 #endif 302 #endif
OLDNEW
« no previous file with comments | « src/core/SkPaint.cpp ('k') | src/core/SkScaledImageCache.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698