| OLD | NEW |
| 1 /* |
| 2 * Copyright 2015 Google Inc. |
| 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. |
| 6 */ |
| 7 |
| 1 #ifndef SkMutex_DEFINED | 8 #ifndef SkMutex_DEFINED |
| 2 #define SkMutex_DEFINED | 9 #define SkMutex_DEFINED |
| 3 | 10 |
| 4 // This file is not part of the public Skia API. | 11 // This file is not part of the public Skia API. |
| 5 #include "SkTypes.h" | 12 #include "SkTypes.h" |
| 6 | 13 |
| 7 #if defined(SK_BUILD_FOR_WIN) | 14 #if defined(SK_BUILD_FOR_WIN) |
| 8 #include "../ports/SkMutex_win.h" | 15 #include "../ports/SkMutex_win.h" // IWYU pragma: export |
| 9 #else | 16 #else |
| 10 #include "../ports/SkMutex_pthread.h" | 17 #include "../ports/SkMutex_pthread.h" // IWYU pragma: export |
| 11 #endif | 18 #endif |
| 12 | 19 |
| 13 class SkAutoMutexAcquire : SkNoncopyable { | 20 class SkAutoMutexAcquire : SkNoncopyable { |
| 14 public: | 21 public: |
| 15 explicit SkAutoMutexAcquire(SkBaseMutex& mutex) : fMutex(&mutex) { | 22 explicit SkAutoMutexAcquire(SkBaseMutex& mutex) : fMutex(&mutex) { |
| 16 SkASSERT(fMutex != NULL); | 23 SkASSERT(fMutex != NULL); |
| 17 mutex.acquire(); | 24 mutex.acquire(); |
| 18 } | 25 } |
| 19 | 26 |
| 20 explicit SkAutoMutexAcquire(SkBaseMutex* mutex) : fMutex(mutex) { | 27 explicit SkAutoMutexAcquire(SkBaseMutex* mutex) : fMutex(mutex) { |
| (...skipping 23 matching lines...) Expand all Loading... |
| 44 fMutex->assertHeld(); | 51 fMutex->assertHeld(); |
| 45 } | 52 } |
| 46 | 53 |
| 47 private: | 54 private: |
| 48 SkBaseMutex* fMutex; | 55 SkBaseMutex* fMutex; |
| 49 }; | 56 }; |
| 50 #define SkAutoMutexAcquire(...) SK_REQUIRE_LOCAL_VAR(SkAutoMutexAcquire) | 57 #define SkAutoMutexAcquire(...) SK_REQUIRE_LOCAL_VAR(SkAutoMutexAcquire) |
| 51 | 58 |
| 52 | 59 |
| 53 #endif//SkMutex_DEFINED | 60 #endif//SkMutex_DEFINED |
| OLD | NEW |