• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2021 Google LLC
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 
8 #ifndef SkSLSharedCompiler_DEFINED
9 #define SkSLSharedCompiler_DEFINED
10 
11 #include "include/private/SkMutex.h"
12 #include "src/sksl/SkSLCompiler.h"
13 
14 #ifdef SK_ENABLE_SKSL
15 
16 namespace SkSL {
17 
18 /** A shared compiler instance for runtime client SkSL that is internally guarded by a mutex. */
19 class SharedCompiler {
20 public:
21     SharedCompiler();
22 
23     SkSL::Compiler* operator->() const;
24 
25 private:
26     SkAutoMutexExclusive fLock;
27 
28     static SkMutex& compiler_mutex();
29 
30     struct Impl;
31     static Impl* gImpl;
32 };
33 
34 }  // namespace SkSL
35 
36 #endif  // SK_ENABLE_SKSL
37 
38 #endif
39