| Index: ui/gl/gpu_switching_manager.cc
|
| diff --git a/ui/gl/gpu_switching_manager.cc b/ui/gl/gpu_switching_manager.cc
|
| index f9046291d3a8dbae46a5edb6a92e58d858528d38..020592f20da4356777f4e6a8410844e5eaa8c17e 100644
|
| --- a/ui/gl/gpu_switching_manager.cc
|
| +++ b/ui/gl/gpu_switching_manager.cc
|
| @@ -9,12 +9,19 @@
|
| #include "ui/gl/gl_switches.h"
|
|
|
| #if defined(OS_MACOSX)
|
| +#include <OpenGL/OpenGL.h>
|
| #include "base/mac/mac_util.h"
|
| #include "ui/gl/gl_context_cgl.h"
|
| #endif // OS_MACOSX
|
|
|
| namespace ui {
|
|
|
| +struct GpuSwitchingManager::PlatformSpecific {
|
| +#if defined(OS_MACOSX)
|
| + CGLPixelFormatObj discrete_pixel_format;
|
| +#endif // OS_MACOSX
|
| +};
|
| +
|
| // static
|
| GpuSwitchingManager* GpuSwitchingManager::GetInstance() {
|
| return Singleton<GpuSwitchingManager>::get();
|
| @@ -25,16 +32,17 @@ GpuSwitchingManager::GpuSwitchingManager()
|
| gpu_switching_option_set_(false),
|
| supports_dual_gpus_(false),
|
| supports_dual_gpus_set_(false),
|
| - gpu_count_(0) {
|
| + gpu_count_(0),
|
| + platform_specific_(new PlatformSpecific) {
|
| #if defined(OS_MACOSX)
|
| - discrete_pixel_format_ = NULL;
|
| + platform_specific_->discrete_pixel_format = nullptr;
|
| #endif // OS_MACOSX
|
| }
|
|
|
| GpuSwitchingManager::~GpuSwitchingManager() {
|
| #if defined(OS_MACOSX)
|
| - if (discrete_pixel_format_)
|
| - CGLReleasePixelFormat(discrete_pixel_format_);
|
| + if (platform_specific_->discrete_pixel_format)
|
| + CGLReleasePixelFormat(platform_specific_->discrete_pixel_format);
|
| #endif // OS_MACOSX
|
| }
|
|
|
| @@ -123,12 +131,13 @@ gfx::GpuPreference GpuSwitchingManager::AdjustGpuPreference(
|
|
|
| #if defined(OS_MACOSX)
|
| void GpuSwitchingManager::SwitchToDiscreteGpuMac() {
|
| - if (discrete_pixel_format_)
|
| + if (platform_specific_->discrete_pixel_format)
|
| return;
|
| CGLPixelFormatAttribute attribs[1];
|
| attribs[0] = static_cast<CGLPixelFormatAttribute>(0);
|
| GLint num_pixel_formats = 0;
|
| - CGLChoosePixelFormat(attribs, &discrete_pixel_format_, &num_pixel_formats);
|
| + CGLChoosePixelFormat(attribs, &platform_specific_->discrete_pixel_format,
|
| + &num_pixel_formats);
|
| }
|
| #endif // OS_MACOSX
|
|
|
|
|