summaryrefslogtreecommitdiff
path: root/chromium/ui/gl/shader_tracking.h
blob: 7fb7b58a26990a765238e8a56d4a46c627628b61 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
// Copyright (c) 2019 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef UI_GL_SHADER_TRACKING_H_
#define UI_GL_SHADER_TRACKING_H_

#include <string>

#include "base/macros.h"
#include "base/no_destructor.h"
#include "base/synchronization/lock.h"
#include "build/build_config.h"
#include "ui/gl/gl_export.h"

namespace gl {

class GL_EXPORT ShaderTracking {
 public:
  static ShaderTracking* GetInstance();

  static const size_t kMaxShaderSize = 1024;

  void GetShaders(std::string* shader0, std::string* shader1);

  void SetShaders(const char* shader0, const char* shader1);

 private:
  friend base::NoDestructor<ShaderTracking>;

  ShaderTracking() {}
  ~ShaderTracking() {}

  mutable base::Lock lock_;
  std::string shaders_[2];

  DISALLOW_COPY_AND_ASSIGN(ShaderTracking);
};

}  // namespace gl

#endif  // UI_GL_SHADER_TRACKING_H_