diff options
author | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-08 22:33:14 +0000 |
---|---|---|
committer | tfarina@chromium.org <tfarina@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2012-10-08 22:33:14 +0000 |
commit | a2221e853f3804fcff1cba789079dddcdce9e710 (patch) | |
tree | 605837acb599aeed1ccf60f84930d6f4af00fca5 /ui/gl | |
parent | ba05bf1cc2d4cb17de68253ccd63586c86c89f96 (diff) | |
download | chromium_src-a2221e853f3804fcff1cba789079dddcdce9e710.zip chromium_src-a2221e853f3804fcff1cba789079dddcdce9e710.tar.gz chromium_src-a2221e853f3804fcff1cba789079dddcdce9e710.tar.bz2 |
gl: Move GpuSwitchingManager into ui namespace.
BUG=127983
TBR=apatrick@chromium.org
Review URL: https://codereview.chromium.org/11013008
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@160728 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ui/gl')
-rw-r--r-- | ui/gl/gl_context_cgl.cc | 6 | ||||
-rw-r--r-- | ui/gl/gl_surface_cgl.cc | 2 | ||||
-rw-r--r-- | ui/gl/gpu_switching_manager.cc | 19 | ||||
-rw-r--r-- | ui/gl/gpu_switching_manager.h | 9 |
4 files changed, 17 insertions, 19 deletions
diff --git a/ui/gl/gl_context_cgl.cc b/ui/gl/gl_context_cgl.cc index 614ed20..1bd4092 100644 --- a/ui/gl/gl_context_cgl.cc +++ b/ui/gl/gl_context_cgl.cc @@ -28,7 +28,7 @@ bool GLContextCGL::Initialize(GLSurface* compatible_surface, GpuPreference gpu_preference) { DCHECK(compatible_surface); - gpu_preference = GpuSwitchingManager::GetInstance()->AdjustGpuPreference( + gpu_preference = ui::GpuSwitchingManager::GetInstance()->AdjustGpuPreference( gpu_preference); GLContextCGL* share_context = share_group() ? @@ -37,7 +37,7 @@ bool GLContextCGL::Initialize(GLSurface* compatible_surface, std::vector<CGLPixelFormatAttribute> attribs; // If the system supports dual gpus then allow offline renderers for every // context, so that they can all be in the same share group. - if (GpuSwitchingManager::GetInstance()->SupportsDualGpus()) + if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) attribs.push_back(kCGLPFAAllowOfflineRenderers); if (GetGLImplementation() == kGLImplementationAppleGL) { attribs.push_back(kCGLPFARendererID); @@ -61,7 +61,7 @@ bool GLContextCGL::Initialize(GLSurface* compatible_surface, // If using the discrete gpu, create a pixel format requiring it before we // create the context. - if (!GpuSwitchingManager::GetInstance()->SupportsDualGpus() || + if (!ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus() || gpu_preference == PreferDiscreteGpu) { std::vector<CGLPixelFormatAttribute> discrete_attribs; discrete_attribs.push_back((CGLPixelFormatAttribute) 0); diff --git a/ui/gl/gl_surface_cgl.cc b/ui/gl/gl_surface_cgl.cc index 6415d23..c1e0682 100644 --- a/ui/gl/gl_surface_cgl.cc +++ b/ui/gl/gl_surface_cgl.cc @@ -31,7 +31,7 @@ bool GLSurfaceCGL::InitializeOneOff() { // GPU-related stuff is very slow without this, probably because // the sandbox prevents loading graphics drivers or some such. std::vector<CGLPixelFormatAttribute> attribs; - if (gfx::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) { + if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) { // Avoid switching to the discrete GPU just for this pixel // format selection. attribs.push_back(kCGLPFAAllowOfflineRenderers); diff --git a/ui/gl/gpu_switching_manager.cc b/ui/gl/gpu_switching_manager.cc index 9cabb24..e936c79 100644 --- a/ui/gl/gpu_switching_manager.cc +++ b/ui/gl/gpu_switching_manager.cc @@ -67,7 +67,7 @@ bool SupportsOnlineAndOfflineRenderers() { } // namespace anonymous -namespace gfx { +namespace ui { // static GpuSwitchingManager* GpuSwitchingManager::GetInstance() { @@ -75,7 +75,7 @@ GpuSwitchingManager* GpuSwitchingManager::GetInstance() { } GpuSwitchingManager::GpuSwitchingManager() - : gpu_switching_option_(PreferIntegratedGpu), + : gpu_switching_option_(gfx::PreferIntegratedGpu), gpu_switching_option_set_(false), supports_dual_gpus_(false), supports_dual_gpus_set_(false) { @@ -94,9 +94,9 @@ GpuSwitchingManager::~GpuSwitchingManager() { void GpuSwitchingManager::ForceUseOfIntegratedGpu() { DCHECK(SupportsDualGpus()); if (gpu_switching_option_set_) { - DCHECK_EQ(gpu_switching_option_, PreferIntegratedGpu); + DCHECK_EQ(gpu_switching_option_, gfx::PreferIntegratedGpu); } else { - gpu_switching_option_ = PreferIntegratedGpu; + gpu_switching_option_ = gfx::PreferIntegratedGpu; gpu_switching_option_set_ = true; } } @@ -104,9 +104,9 @@ void GpuSwitchingManager::ForceUseOfIntegratedGpu() { void GpuSwitchingManager::ForceUseOfDiscreteGpu() { DCHECK(SupportsDualGpus()); if (gpu_switching_option_set_) { - DCHECK_EQ(gpu_switching_option_, PreferDiscreteGpu); + DCHECK_EQ(gpu_switching_option_, gfx::PreferDiscreteGpu); } else { - gpu_switching_option_ = PreferDiscreteGpu; + gpu_switching_option_ = gfx::PreferDiscreteGpu; gpu_switching_option_set_ = true; #if defined(OS_MACOSX) // Create a pixel format that lasts the lifespan of Chrome, so Chrome @@ -151,8 +151,8 @@ bool GpuSwitchingManager::SupportsDualGpus() { return supports_dual_gpus_; } -GpuPreference GpuSwitchingManager::AdjustGpuPreference( - GpuPreference gpu_preference) { +gfx::GpuPreference GpuSwitchingManager::AdjustGpuPreference( + gfx::GpuPreference gpu_preference) { if (!gpu_switching_option_set_) return gpu_preference; return gpu_switching_option_; @@ -169,5 +169,4 @@ void GpuSwitchingManager::SwitchToDiscreteGpuMac() { } #endif // OS_MACOSX -} // namespace gfx - +} // namespace ui diff --git a/ui/gl/gpu_switching_manager.h b/ui/gl/gpu_switching_manager.h index 5cf87e5..073e7b1 100644 --- a/ui/gl/gpu_switching_manager.h +++ b/ui/gl/gpu_switching_manager.h @@ -15,7 +15,7 @@ #include <OpenGL/OpenGL.h> #endif // OS_MACOSX -namespace gfx { +namespace ui { class GL_EXPORT GpuSwitchingManager { public: @@ -30,7 +30,7 @@ class GL_EXPORT GpuSwitchingManager { // If no GPU is forced, return the original GpuPreference; otherwise, return // the forced GPU. - GpuPreference AdjustGpuPreference(GpuPreference gpu_preference); + gfx::GpuPreference AdjustGpuPreference(gfx::GpuPreference gpu_preference); // In the browser process, the value for this flag is computed the first time // this function is called. @@ -50,7 +50,7 @@ class GL_EXPORT GpuSwitchingManager { CGLPixelFormatObj discrete_pixel_format_; #endif // OS_MACOSX - GpuPreference gpu_switching_option_; + gfx::GpuPreference gpu_switching_option_; bool gpu_switching_option_set_; bool supports_dual_gpus_; @@ -59,7 +59,6 @@ class GL_EXPORT GpuSwitchingManager { DISALLOW_COPY_AND_ASSIGN(GpuSwitchingManager); }; -} // namespace gfx +} // namespace ui #endif // UI_GL_GPU_SWITCHING_MANAGER_H_ - |