Skip to content

Commit 060503e

Browse files
johnstiles-googleSkia Commit-Bot
authored andcommitted
Use SkMutex in SkSL.
Change-Id: I1b14e4c8de0ca60a0ebbdbc225befc5074e8de22 Bug: skia:10862 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/329177 Commit-Queue: John Stiles <johnstiles@google.com> Commit-Queue: Brian Osman <brianosman@google.com> Auto-Submit: John Stiles <johnstiles@google.com> Reviewed-by: Brian Osman <brianosman@google.com>
1 parent cdeae8c commit 060503e

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

BUILD.gn

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -558,6 +558,8 @@ if (skia_compile_processors || skia_compile_sksl_tests) {
558558
sources = [
559559
"src/core/SkMalloc.cpp",
560560
"src/core/SkMath.cpp",
561+
"src/core/SkSemaphore.cpp",
562+
"src/core/SkThreadID.cpp",
561563
"src/ports/SkMemory_malloc.cpp",
562564
"src/sksl/SkSLMain.cpp",
563565
]

src/sksl/SkSLCPPUniformCTypes.cpp

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,12 @@
66
*/
77

88
#include "src/sksl/SkSLCPPUniformCTypes.h"
9+
10+
#include "include/private/SkMutex.h"
911
#include "src/sksl/SkSLHCodeGenerator.h"
1012
#include "src/sksl/SkSLStringStream.h"
1113

1214
#include <map>
13-
#include <mutex>
1415
#include <vector>
1516

1617
#if defined(SKSL_STANDALONE) || GR_TEST_UTILS
@@ -145,8 +146,8 @@ UniformCTypeMapper::UniformCTypeMapper(
145146
, fSaveStateTemplate(saveStateFormat) {}
146147

147148
const UniformCTypeMapper* UniformCTypeMapper::arrayMapper(int count) const {
148-
static std::mutex mutex;
149-
std::lock_guard<std::mutex> guard(mutex);
149+
static SkMutex& mutex = *(new SkMutex);
150+
SkAutoMutexExclusive guard(mutex);
150151
using Key = std::pair<const UniformCTypeMapper*, int>;
151152
static std::map<Key, UniformCTypeMapper> registered;
152153
Key key(this, count);

0 commit comments

Comments
 (0)