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

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

Issue 10959050: Honor --gpu-switching=force_discrete to always stay on discrete GPU. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 8 years, 3 months 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 | Annotate | Revision Log
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 #if defined(OS_MACOSX)
12 #include "ui/gl/gl_context_cgl.h"
13 #endif // OS_MACOSX
11 #include "ui/gl/gl_export.h" 14 #include "ui/gl/gl_export.h"
12 #include "ui/gl/gpu_preference.h" 15 #include "ui/gl/gpu_preference.h"
13 16
14 namespace gfx { 17 namespace gfx {
15 18
16 class GL_EXPORT GpuSwitchingManager { 19 class GL_EXPORT GpuSwitchingManager {
17 public: 20 public:
18 // Getter for the singleton. This will return NULL on failure. 21 // Getter for the singleton. This will return NULL on failure.
19 static GpuSwitchingManager* GetInstance(); 22 static GpuSwitchingManager* GetInstance();
20 23
21 // Set the switching option, but don't take any actions until later 24 // Set the switching option, but don't take any actions until later
22 // we access GPU. 25 // we access GPU.
23 void ForceUseOfIntegratedGpu(); 26 void ForceUseOfIntegratedGpu();
24 void ForceUseOfDiscreteGpu(); 27 void ForceUseOfDiscreteGpu();
25 28
26 // Adjust GpuPreference based on the current switching option. 29 // On Mac:
27 // If none is set, return the original GpuPreference. 30 // If no GPU is forced, return the original GpuPreference.
31 // Otherwise, always return PreferIntegratedGpu.
Ken Russell (switch to Gerrit) 2012/09/21 23:00:29 I understand why you're returning PreferIntegrated
Zhenyao Mo 2012/09/21 23:08:09 Done.
32 // If forcing discrete GPU, we set up a pixel format, which keeps
33 // Chrome on the discrete GPU throughout the rest of Chrome's lifetime.
34 // On other platforms:
35 // Return the original GpuPreference.
28 GpuPreference AdjustGpuPreference(GpuPreference gpu_preference); 36 GpuPreference AdjustGpuPreference(GpuPreference gpu_preference);
29 37
30 private: 38 private:
31 friend struct DefaultSingletonTraits<GpuSwitchingManager>; 39 friend struct DefaultSingletonTraits<GpuSwitchingManager>;
32 40
33 GpuSwitchingManager(); 41 GpuSwitchingManager();
34 virtual ~GpuSwitchingManager(); 42 virtual ~GpuSwitchingManager();
35 43
36 std::vector<GpuPreference> gpu_switching_option_; 44 std::vector<GpuPreference> gpu_switching_option_;
37 45
38 DISALLOW_COPY_AND_ASSIGN(GpuSwitchingManager); 46 DISALLOW_COPY_AND_ASSIGN(GpuSwitchingManager);
39 }; 47 };
40 48
41 } // namespace gfx 49 } // namespace gfx
42 50
43 #endif // UI_GL_GPU_SWITCHING_MANAGER_H_ 51 #endif // UI_GL_GPU_SWITCHING_MANAGER_H_
44 52
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698