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
gpu / config / device_perf_info.cc [blame]
// Copyright 2020 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "gpu/config/device_perf_info.h"
#include "base/no_destructor.h"
#include "base/synchronization/lock.h"
namespace gpu {
namespace {
// Global instance in browser process.
std::optional<DevicePerfInfo> g_device_perf_info;
base::Lock& GetLock() {
static base::NoDestructor<base::Lock> lock;
return *lock;
}
} // namespace
std::optional<DevicePerfInfo> GetDevicePerfInfo() {
base::AutoLock lock(GetLock());
return g_device_perf_info;
}
void SetDevicePerfInfo(const DevicePerfInfo& device_perf_info) {
base::AutoLock lock(GetLock());
g_device_perf_info = device_perf_info;
}
} // namespace gpu