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

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

Issue 1308823002: Move Singleton and related structs to namespace base (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: ToT Created 5 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
« no previous file with comments | « ui/gl/gpu_switching_manager.h ('k') | ui/views/accessibility/ax_aura_obj_cache.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
11 #if defined(OS_MACOSX) 11 #if defined(OS_MACOSX)
12 #include <OpenGL/OpenGL.h> 12 #include <OpenGL/OpenGL.h>
13 #include "base/mac/mac_util.h" 13 #include "base/mac/mac_util.h"
14 #include "ui/gl/gl_context_cgl.h" 14 #include "ui/gl/gl_context_cgl.h"
15 #endif // OS_MACOSX 15 #endif // OS_MACOSX
16 16
17 namespace ui { 17 namespace ui {
18 18
19 struct GpuSwitchingManager::PlatformSpecific { 19 struct GpuSwitchingManager::PlatformSpecific {
20 #if defined(OS_MACOSX) 20 #if defined(OS_MACOSX)
21 CGLPixelFormatObj discrete_pixel_format; 21 CGLPixelFormatObj discrete_pixel_format;
22 #endif // OS_MACOSX 22 #endif // OS_MACOSX
23 }; 23 };
24 24
25 // static 25 // static
26 GpuSwitchingManager* GpuSwitchingManager::GetInstance() { 26 GpuSwitchingManager* GpuSwitchingManager::GetInstance() {
27 return Singleton<GpuSwitchingManager>::get(); 27 return base::Singleton<GpuSwitchingManager>::get();
28 } 28 }
29 29
30 GpuSwitchingManager::GpuSwitchingManager() 30 GpuSwitchingManager::GpuSwitchingManager()
31 : gpu_switching_option_(gfx::PreferIntegratedGpu), 31 : gpu_switching_option_(gfx::PreferIntegratedGpu),
32 gpu_switching_option_set_(false), 32 gpu_switching_option_set_(false),
33 supports_dual_gpus_(false), 33 supports_dual_gpus_(false),
34 supports_dual_gpus_set_(false), 34 supports_dual_gpus_set_(false),
35 platform_specific_(new PlatformSpecific) { 35 platform_specific_(new PlatformSpecific) {
36 #if defined(OS_MACOSX) 36 #if defined(OS_MACOSX)
37 platform_specific_->discrete_pixel_format = nullptr; 37 platform_specific_->discrete_pixel_format = nullptr;
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
147 return; 147 return;
148 CGLPixelFormatAttribute attribs[1]; 148 CGLPixelFormatAttribute attribs[1];
149 attribs[0] = static_cast<CGLPixelFormatAttribute>(0); 149 attribs[0] = static_cast<CGLPixelFormatAttribute>(0);
150 GLint num_pixel_formats = 0; 150 GLint num_pixel_formats = 0;
151 CGLChoosePixelFormat(attribs, &platform_specific_->discrete_pixel_format, 151 CGLChoosePixelFormat(attribs, &platform_specific_->discrete_pixel_format,
152 &num_pixel_formats); 152 &num_pixel_formats);
153 } 153 }
154 #endif // OS_MACOSX 154 #endif // OS_MACOSX
155 155
156 } // namespace ui 156 } // namespace ui
OLDNEW
« no previous file with comments | « ui/gl/gpu_switching_manager.h ('k') | ui/views/accessibility/ax_aura_obj_cache.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698