blob: 7b26e9ab9f2508a68b9f2edc5c16dad4215ac6db (
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
|
// 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.
#include "ui/gl/gpu_switching_manager.h"
namespace ui {
// static
GpuSwitchingManager* GpuSwitchingManager::GetInstance() {
return base::Singleton<GpuSwitchingManager>::get();
}
GpuSwitchingManager::GpuSwitchingManager() {}
GpuSwitchingManager::~GpuSwitchingManager() {}
void GpuSwitchingManager::AddObserver(GpuSwitchingObserver* observer) {
base::AutoLock auto_lock(lock_);
observer_list_.AddObserver(observer);
}
void GpuSwitchingManager::RemoveObserver(GpuSwitchingObserver* observer) {
base::AutoLock auto_lock(lock_);
observer_list_.RemoveObserver(observer);
}
void GpuSwitchingManager::NotifyGpuSwitched(
gl::GpuPreference active_gpu_heuristic) {
base::AutoLock auto_lock(lock_);
for (GpuSwitchingObserver& observer : observer_list_)
observer.OnGpuSwitched(active_gpu_heuristic);
}
void GpuSwitchingManager::NotifyDisplayAdded() {
base::AutoLock auto_lock(lock_);
for (GpuSwitchingObserver& observer : observer_list_)
observer.OnDisplayAdded();
}
void GpuSwitchingManager::NotifyDisplayRemoved() {
base::AutoLock auto_lock(lock_);
for (GpuSwitchingObserver& observer : observer_list_)
observer.OnDisplayRemoved();
}
void GpuSwitchingManager::NotifyDisplayMetricsChanged() {
for (GpuSwitchingObserver& observer : observer_list_)
observer.OnDisplayMetricsChanged();
}
} // namespace ui
|