summaryrefslogtreecommitdiffstats
path: root/content/public/browser/gpu_data_manager.h
blob: 68b5173c466b7d3a83ac81fb1ef02d9d80561dc6 (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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
// Copyright (c) 2012 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 CONTENT_PUBLIC_BROWSER_GPU_DATA_MANAGER_H_
#define CONTENT_PUBLIC_BROWSER_GPU_DATA_MANAGER_H_

#include "content/common/content_export.h"
#include "content/public/common/gpu_feature_type.h"

class FilePath;

namespace base {
class ListValue;
}

namespace content {

class GpuDataManagerObserver;
struct GPUInfo;

// This class lives on the UI thread. Only methods that explicitly state that
// they can be called on other threads are thread-safe.
class GpuDataManager {
 public:
  // Getter for the singleton.
  CONTENT_EXPORT static GpuDataManager* GetInstance();

  // Can be called on any thread.
  virtual GpuFeatureType GetGpuFeatureType() = 0;

  // Gives the new feature flags.  This is always called on the UI thread.
  virtual void SetGpuFeatureType(GpuFeatureType feature_type) = 0;

  virtual GPUInfo GetGPUInfo() const = 0;

  // This indicator might change because we could collect more GPU info or
  // because the GPU blacklist could be updated.
  // If this returns false, any further GPU access, including launching GPU
  // process, establish GPU channel, and GPU info collection, should be
  // blocked.
  // Can be called on any thread.
  virtual bool GpuAccessAllowed() = 0;

  // Requests complete GPUinfo if it has not already been requested
  virtual void RequestCompleteGpuInfoIfNeeded() = 0;

  virtual bool IsCompleteGPUInfoAvailable() const = 0;

  // Returns true if the software rendering should currently be used.
  virtual bool ShouldUseSoftwareRendering() = 0;

  // Register a path to the SwiftShader software renderer.
  virtual void RegisterSwiftShaderPath(const FilePath& path) = 0;

  virtual const base::ListValue& GetLogMessages() const = 0;

  // Registers/unregister |observer|.
  virtual void AddObserver(GpuDataManagerObserver* observer) = 0;
  virtual void RemoveObserver(GpuDataManagerObserver* observer) = 0;

 protected:
  virtual ~GpuDataManager() {}
};

};  // namespace content

#endif  // CONTENT_PUBLIC_BROWSER_GPU_DATA_MANAGER_H_