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

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

Issue 1948193002: SK_DECLARE_STATIC_MUTEX -> static SkMutex (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 4 years, 7 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 | « dm/DMJsonWriter.cpp ('k') | src/core/SkDeviceProfile.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 * Copyright 2015 Google Inc. 2 * Copyright 2015 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 SkMutex_DEFINED 8 #ifndef SkMutex_DEFINED
9 #define SkMutex_DEFINED 9 #define SkMutex_DEFINED
10 10
11 #include "../private/SkSemaphore.h" 11 #include "../private/SkSemaphore.h"
12 #include "../private/SkThreadID.h" 12 #include "../private/SkThreadID.h"
13 #include "SkTypes.h" 13 #include "SkTypes.h"
14 14
15 // TODO: no need for this anymore.
16 #define SK_DECLARE_STATIC_MUTEX(name) static SkMutex name;
17
18 class SkMutex { 15 class SkMutex {
19 public: 16 public:
20 constexpr SkMutex() = default; 17 constexpr SkMutex() = default;
21 18
22 SkMutex(const SkMutex&) = delete; 19 SkMutex(const SkMutex&) = delete;
23 SkMutex& operator=(const SkMutex&) = delete; 20 SkMutex& operator=(const SkMutex&) = delete;
24 21
25 void acquire() { 22 void acquire() {
26 fSemaphore.wait(); 23 fSemaphore.wait();
27 SkDEBUGCODE(fOwner = SkGetThreadID();) 24 SkDEBUGCODE(fOwner = SkGetThreadID();)
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
92 Lock &fLock; 89 Lock &fLock;
93 }; 90 };
94 91
95 typedef SkAutoTAcquire<SkMutex> SkAutoMutexAcquire; 92 typedef SkAutoTAcquire<SkMutex> SkAutoMutexAcquire;
96 #define SkAutoMutexAcquire(...) SK_REQUIRE_LOCAL_VAR(SkAutoMutexAcquire) 93 #define SkAutoMutexAcquire(...) SK_REQUIRE_LOCAL_VAR(SkAutoMutexAcquire)
97 94
98 typedef SkAutoTExclusive<SkMutex> SkAutoMutexExclusive; 95 typedef SkAutoTExclusive<SkMutex> SkAutoMutexExclusive;
99 #define SkAutoMutexExclusive(...) SK_REQUIRE_LOCAL_VAR(SkAutoMutexExclusive) 96 #define SkAutoMutexExclusive(...) SK_REQUIRE_LOCAL_VAR(SkAutoMutexExclusive)
100 97
101 #endif//SkMutex_DEFINED 98 #endif//SkMutex_DEFINED
OLDNEW
« no previous file with comments | « dm/DMJsonWriter.cpp ('k') | src/core/SkDeviceProfile.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698