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

Side by Side Diff: include/private/GrSingleOwner.h

Issue 1566703003: Add additional assert to GrSingleOwner (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 11 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 | « no previous file | no next file » | 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 * Copyright 2016 Google Inc. 2 * Copyright 2016 Google Inc.
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 #ifndef GrSingleOwner_DEFINED 8 #ifndef GrSingleOwner_DEFINED
9 #define GrSingleOwner_DEFINED 9 #define GrSingleOwner_DEFINED
10 10
(...skipping 19 matching lines...) Expand all
30 void enter() { 30 void enter() {
31 SkAutoMutexAcquire lock(fMutex); 31 SkAutoMutexAcquire lock(fMutex);
32 SkThreadID self = SkGetThreadID(); 32 SkThreadID self = SkGetThreadID();
33 SkASSERT(fOwner == self || fOwner == kIllegalThreadID); 33 SkASSERT(fOwner == self || fOwner == kIllegalThreadID);
34 fReentranceCount++; 34 fReentranceCount++;
35 fOwner = self; 35 fOwner = self;
36 } 36 }
37 37
38 void exit() { 38 void exit() {
39 SkAutoMutexAcquire lock(fMutex); 39 SkAutoMutexAcquire lock(fMutex);
40 SkASSERT(fOwner == SkGetThreadID());
40 fReentranceCount--; 41 fReentranceCount--;
41 if (fReentranceCount == 0) { 42 if (fReentranceCount == 0) {
42 fOwner = kIllegalThreadID; 43 fOwner = kIllegalThreadID;
43 } 44 }
44 } 45 }
45 46
46 SkMutex fMutex; 47 SkMutex fMutex;
47 SkThreadID fOwner; // guarded by fMutex 48 SkThreadID fOwner; // guarded by fMutex
48 int fReentranceCount; // guarded by fMutex 49 int fReentranceCount; // guarded by fMutex
49 }; 50 };
50 #endif 51 #endif
51 52
52 #endif 53 #endif
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698