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

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

Issue 1945353003: Revert of 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
15 class SkMutex { 18 class SkMutex {
16 public: 19 public:
17 constexpr SkMutex() = default; 20 constexpr SkMutex() = default;
18 21
19 SkMutex(const SkMutex&) = delete; 22 SkMutex(const SkMutex&) = delete;
20 SkMutex& operator=(const SkMutex&) = delete; 23 SkMutex& operator=(const SkMutex&) = delete;
21 24
22 void acquire() { 25 void acquire() {
23 fSemaphore.wait(); 26 fSemaphore.wait();
24 SkDEBUGCODE(fOwner = SkGetThreadID();) 27 SkDEBUGCODE(fOwner = SkGetThreadID();)
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
89 Lock &fLock; 92 Lock &fLock;
90 }; 93 };
91 94
92 typedef SkAutoTAcquire<SkMutex> SkAutoMutexAcquire; 95 typedef SkAutoTAcquire<SkMutex> SkAutoMutexAcquire;
93 #define SkAutoMutexAcquire(...) SK_REQUIRE_LOCAL_VAR(SkAutoMutexAcquire) 96 #define SkAutoMutexAcquire(...) SK_REQUIRE_LOCAL_VAR(SkAutoMutexAcquire)
94 97
95 typedef SkAutoTExclusive<SkMutex> SkAutoMutexExclusive; 98 typedef SkAutoTExclusive<SkMutex> SkAutoMutexExclusive;
96 #define SkAutoMutexExclusive(...) SK_REQUIRE_LOCAL_VAR(SkAutoMutexExclusive) 99 #define SkAutoMutexExclusive(...) SK_REQUIRE_LOCAL_VAR(SkAutoMutexExclusive)
97 100
98 #endif//SkMutex_DEFINED 101 #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