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

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

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/gpu_switching_manager.h ('k') | ui/gl/gpu_switching_observer.h » ('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 #include "ui/gl/gpu_switching_manager.h" 5 #include "ui/gl/gpu_switching_manager.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "ui/gl/gl_switches.h" 9 #include "ui/gl/gl_switches.h"
10 10
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 supports_dual_gpus_ = flag; 95 supports_dual_gpus_ = flag;
96 supports_dual_gpus_set_ = true; 96 supports_dual_gpus_set_ = true;
97 } 97 }
98 return supports_dual_gpus_; 98 return supports_dual_gpus_;
99 } 99 }
100 100
101 void GpuSwitchingManager::SetGpuCount(size_t gpu_count) { 101 void GpuSwitchingManager::SetGpuCount(size_t gpu_count) {
102 gpu_count_ = gpu_count; 102 gpu_count_ = gpu_count;
103 } 103 }
104 104
105 void GpuSwitchingManager::AddObserver(GpuSwitchingObserver* observer) {
106 observer_list_.AddObserver(observer);
107 }
108
109 void GpuSwitchingManager::RemoveObserver(GpuSwitchingObserver* observer) {
110 observer_list_.RemoveObserver(observer);
111 }
112
113 void GpuSwitchingManager::NotifyGpuSwitched() {
114 FOR_EACH_OBSERVER(GpuSwitchingObserver, observer_list_, OnGpuSwitched());
115 }
116
105 gfx::GpuPreference GpuSwitchingManager::AdjustGpuPreference( 117 gfx::GpuPreference GpuSwitchingManager::AdjustGpuPreference(
106 gfx::GpuPreference gpu_preference) { 118 gfx::GpuPreference gpu_preference) {
107 if (!gpu_switching_option_set_) 119 if (!gpu_switching_option_set_)
108 return gpu_preference; 120 return gpu_preference;
109 return gpu_switching_option_; 121 return gpu_switching_option_;
110 } 122 }
111 123
112 #if defined(OS_MACOSX) 124 #if defined(OS_MACOSX)
113 void GpuSwitchingManager::SwitchToDiscreteGpuMac() { 125 void GpuSwitchingManager::SwitchToDiscreteGpuMac() {
114 if (discrete_pixel_format_) 126 if (discrete_pixel_format_)
115 return; 127 return;
116 CGLPixelFormatAttribute attribs[1]; 128 CGLPixelFormatAttribute attribs[1];
117 attribs[0] = static_cast<CGLPixelFormatAttribute>(0); 129 attribs[0] = static_cast<CGLPixelFormatAttribute>(0);
118 GLint num_pixel_formats = 0; 130 GLint num_pixel_formats = 0;
119 CGLChoosePixelFormat(attribs, &discrete_pixel_format_, &num_pixel_formats); 131 CGLChoosePixelFormat(attribs, &discrete_pixel_format_, &num_pixel_formats);
120 } 132 }
121 #endif // OS_MACOSX 133 #endif // OS_MACOSX
122 134
123 } // namespace ui 135 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gl/gpu_switching_manager.h ('k') | ui/gl/gpu_switching_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698