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

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

Issue 2422073002: Reduce FOR_EACH_OBSERVER usage in ui/ (Closed)
Patch Set: remove space Created 4 years, 2 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
« no previous file with comments | « ui/gfx/win/singleton_hwnd.cc ('k') | ui/keyboard/keyboard_controller.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 #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 "build/build_config.h" 9 #include "build/build_config.h"
10 #include "ui/gl/gl_switches.h" 10 #include "ui/gl/gl_switches.h"
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 121
122 void GpuSwitchingManager::AddObserver(GpuSwitchingObserver* observer) { 122 void GpuSwitchingManager::AddObserver(GpuSwitchingObserver* observer) {
123 observer_list_.AddObserver(observer); 123 observer_list_.AddObserver(observer);
124 } 124 }
125 125
126 void GpuSwitchingManager::RemoveObserver(GpuSwitchingObserver* observer) { 126 void GpuSwitchingManager::RemoveObserver(GpuSwitchingObserver* observer) {
127 observer_list_.RemoveObserver(observer); 127 observer_list_.RemoveObserver(observer);
128 } 128 }
129 129
130 void GpuSwitchingManager::NotifyGpuSwitched() { 130 void GpuSwitchingManager::NotifyGpuSwitched() {
131 FOR_EACH_OBSERVER(GpuSwitchingObserver, observer_list_, OnGpuSwitched()); 131 for (GpuSwitchingObserver& observer : observer_list_)
132 observer.OnGpuSwitched();
132 } 133 }
133 134
134 gl::GpuPreference GpuSwitchingManager::AdjustGpuPreference( 135 gl::GpuPreference GpuSwitchingManager::AdjustGpuPreference(
135 gl::GpuPreference gpu_preference) { 136 gl::GpuPreference gpu_preference) {
136 if (!gpu_switching_option_set_) 137 if (!gpu_switching_option_set_)
137 return gpu_preference; 138 return gpu_preference;
138 return gpu_switching_option_; 139 return gpu_switching_option_;
139 } 140 }
140 141
141 #if defined(OS_MACOSX) 142 #if defined(OS_MACOSX)
142 void GpuSwitchingManager::SwitchToDiscreteGpuMac() { 143 void GpuSwitchingManager::SwitchToDiscreteGpuMac() {
143 if (platform_specific_->discrete_pixel_format) 144 if (platform_specific_->discrete_pixel_format)
144 return; 145 return;
145 CGLPixelFormatAttribute attribs[1]; 146 CGLPixelFormatAttribute attribs[1];
146 attribs[0] = static_cast<CGLPixelFormatAttribute>(0); 147 attribs[0] = static_cast<CGLPixelFormatAttribute>(0);
147 GLint num_pixel_formats = 0; 148 GLint num_pixel_formats = 0;
148 CGLChoosePixelFormat(attribs, &platform_specific_->discrete_pixel_format, 149 CGLChoosePixelFormat(attribs, &platform_specific_->discrete_pixel_format,
149 &num_pixel_formats); 150 &num_pixel_formats);
150 } 151 }
151 #endif // OS_MACOSX 152 #endif // OS_MACOSX
152 153
153 } // namespace ui 154 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gfx/win/singleton_hwnd.cc ('k') | ui/keyboard/keyboard_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698