Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(359)

Side by Side Diff: ui/gl/gpu_switching_manager.h

Issue 681713002: Update from chromium https://crrev.com/301315 (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gl/gl_surface_win.cc ('k') | ui/gl/gpu_switching_manager.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef UI_GL_GPU_SWITCHING_MANAGER_H_ 5 #ifndef UI_GL_GPU_SWITCHING_MANAGER_H_
6 #define UI_GL_GPU_SWITCHING_MANAGER_H_ 6 #define UI_GL_GPU_SWITCHING_MANAGER_H_
7 7
8 #include <vector> 8 #include <vector>
9 9
10 #include "base/memory/singleton.h" 10 #include "base/memory/singleton.h"
11 #include "base/observer_list.h"
11 #include "ui/gl/gl_export.h" 12 #include "ui/gl/gl_export.h"
12 #include "ui/gl/gpu_preference.h" 13 #include "ui/gl/gpu_preference.h"
14 #include "ui/gl/gpu_switching_observer.h"
13 15
14 #if defined(OS_MACOSX) 16 #if defined(OS_MACOSX)
15 #include <OpenGL/OpenGL.h> 17 #include <OpenGL/OpenGL.h>
16 #endif // OS_MACOSX 18 #endif // OS_MACOSX
17 19
18 namespace ui { 20 namespace ui {
19 21
20 class GL_EXPORT GpuSwitchingManager { 22 class GL_EXPORT GpuSwitchingManager {
21 public: 23 public:
22 // Getter for the singleton. This will return NULL on failure. 24 // Getter for the singleton. This will return NULL on failure.
(...skipping 10 matching lines...) Expand all
33 gfx::GpuPreference AdjustGpuPreference(gfx::GpuPreference gpu_preference); 35 gfx::GpuPreference AdjustGpuPreference(gfx::GpuPreference gpu_preference);
34 36
35 // In the browser process, the value for this flag is computed the first time 37 // In the browser process, the value for this flag is computed the first time
36 // this function is called. 38 // this function is called.
37 // In the GPU process, the value is passed from the browser process using the 39 // In the GPU process, the value is passed from the browser process using the
38 // --supports-dual-gpus commandline switch. 40 // --supports-dual-gpus commandline switch.
39 bool SupportsDualGpus(); 41 bool SupportsDualGpus();
40 42
41 void SetGpuCount(size_t gpu_count); 43 void SetGpuCount(size_t gpu_count);
42 44
45 void AddObserver(GpuSwitchingObserver* observer);
46 void RemoveObserver(GpuSwitchingObserver* observer);
47
48 // Called when a GPU switch is noticed by the system. In the browser process
49 // this is occurs as a result of a system observer. In the GPU process, this
50 // occurs as a result of an IPC from the browser. The system observer is kept
51 // in the browser process only so that any workarounds or blacklisting can
52 // be applied there.
53 void NotifyGpuSwitched();
54
43 private: 55 private:
44 friend struct DefaultSingletonTraits<GpuSwitchingManager>; 56 friend struct DefaultSingletonTraits<GpuSwitchingManager>;
45 57
46 GpuSwitchingManager(); 58 GpuSwitchingManager();
47 virtual ~GpuSwitchingManager(); 59 virtual ~GpuSwitchingManager();
48 60
49 #if defined(OS_MACOSX) 61 #if defined(OS_MACOSX)
50 void SwitchToDiscreteGpuMac(); 62 void SwitchToDiscreteGpuMac();
51 63
52 CGLPixelFormatObj discrete_pixel_format_; 64 CGLPixelFormatObj discrete_pixel_format_;
53 #endif // OS_MACOSX 65 #endif // OS_MACOSX
54 66
55 gfx::GpuPreference gpu_switching_option_; 67 gfx::GpuPreference gpu_switching_option_;
56 bool gpu_switching_option_set_; 68 bool gpu_switching_option_set_;
57 69
58 bool supports_dual_gpus_; 70 bool supports_dual_gpus_;
59 bool supports_dual_gpus_set_; 71 bool supports_dual_gpus_set_;
60 72
61 size_t gpu_count_; 73 size_t gpu_count_;
62 74
75 ObserverList<GpuSwitchingObserver> observer_list_;
76
63 DISALLOW_COPY_AND_ASSIGN(GpuSwitchingManager); 77 DISALLOW_COPY_AND_ASSIGN(GpuSwitchingManager);
64 }; 78 };
65 79
66 } // namespace ui 80 } // namespace ui
67 81
68 #endif // UI_GL_GPU_SWITCHING_MANAGER_H_ 82 #endif // UI_GL_GPU_SWITCHING_MANAGER_H_
OLDNEW
« no previous file with comments | « ui/gl/gl_surface_win.cc ('k') | ui/gl/gpu_switching_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698