1 /* 2 * Copyright 2022 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 skgpu_GlobalCache_DEFINED 9 #define skgpu_GlobalCache_DEFINED 10 11 #include "include/core/SkRefCnt.h" 12 13 class SkShaderCodeDictionary; 14 15 namespace skgpu { 16 17 // TODO: This class needs to be thread safe. In the current version there is no thread safety and 18 // we need to go back and add protection around access to any of its memebers. 19 class GlobalCache : public SkRefCnt { 20 public: 21 GlobalCache(); 22 ~GlobalCache() override; 23 shaderCodeDictionary()24 SkShaderCodeDictionary* shaderCodeDictionary() const { return fShaderCodeDictionary.get(); } 25 26 private: 27 std::unique_ptr<SkShaderCodeDictionary> fShaderCodeDictionary; 28 }; 29 30 } // namespace skgpu 31 32 #endif // skgpu_GlobalCache_DEFINED 33