shader_tracking.h 989 B

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright (c) 2019 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #ifndef UI_GL_SHADER_TRACKING_H_
  5. #define UI_GL_SHADER_TRACKING_H_
  6. #include <string>
  7. #include "base/no_destructor.h"
  8. #include "base/synchronization/lock.h"
  9. #include "build/build_config.h"
  10. #include "ui/gl/gl_export.h"
  11. namespace gl {
  12. class GL_EXPORT ShaderTracking {
  13. public:
  14. static ShaderTracking* GetInstance();
  15. ShaderTracking(const ShaderTracking&) = delete;
  16. ShaderTracking& operator=(const ShaderTracking&) = delete;
  17. static const size_t kMaxShaderSize = 1024;
  18. void GetShaders(std::string* shader0, std::string* shader1);
  19. void SetShaders(const char* shader0, const char* shader1);
  20. private:
  21. friend base::NoDestructor<ShaderTracking>;
  22. ShaderTracking() {}
  23. ~ShaderTracking() {}
  24. mutable base::Lock lock_;
  25. std::string shaders_[2];
  26. };
  27. } // namespace gl
  28. #endif // UI_GL_SHADER_TRACKING_H_