Index: ui/gl/gl_surface_mac.cc |
diff --git a/ui/gl/gl_surface_mac.cc b/ui/gl/gl_surface_mac.cc |
index d4ccaef3371c738d2bd3004a4e1c6a77ccc0bc8c..f38f6dc64538d7e7ec3f84751d1516f778a56e97 100644 |
--- a/ui/gl/gl_surface_mac.cc |
+++ b/ui/gl/gl_surface_mac.cc |
@@ -4,8 +4,6 @@ |
#include "ui/gl/gl_surface.h" |
-#include <OpenGL/CGLRenderers.h> |
- |
#include <memory> |
#include "base/logging.h" |
@@ -17,7 +15,6 @@ |
#include "ui/gl/gl_implementation.h" |
#include "ui/gl/gl_surface_osmesa.h" |
#include "ui/gl/gl_surface_stub.h" |
-#include "ui/gl/gpu_switching_manager.h" |
namespace gl { |
namespace { |
@@ -52,64 +49,8 @@ class GL_EXPORT NoOpGLSurface : public GLSurface { |
DISALLOW_COPY_AND_ASSIGN(NoOpGLSurface); |
}; |
-// static |
-bool InitializeOneOffForSandbox() { |
- static bool initialized = false; |
- if (initialized) |
- return true; |
- |
- // This is called from the sandbox warmup code on Mac OS X. |
- // GPU-related stuff is very slow without this, probably because |
- // the sandbox prevents loading graphics drivers or some such. |
- std::vector<CGLPixelFormatAttribute> attribs; |
- if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) { |
- // Avoid switching to the discrete GPU just for this pixel |
- // format selection. |
- attribs.push_back(kCGLPFAAllowOfflineRenderers); |
- } |
- if (GetGLImplementation() == kGLImplementationAppleGL) { |
- attribs.push_back(kCGLPFARendererID); |
- attribs.push_back(static_cast<CGLPixelFormatAttribute>( |
- kCGLRendererGenericFloatID)); |
- } |
- attribs.push_back(static_cast<CGLPixelFormatAttribute>(0)); |
- |
- CGLPixelFormatObj format; |
- GLint num_pixel_formats; |
- if (CGLChoosePixelFormat(&attribs.front(), |
- &format, |
- &num_pixel_formats) != kCGLNoError) { |
- LOG(ERROR) << "Error choosing pixel format."; |
- return false; |
- } |
- if (!format) { |
- LOG(ERROR) << "format == 0."; |
- return false; |
- } |
- CGLReleasePixelFormat(format); |
- DCHECK_NE(num_pixel_formats, 0); |
- initialized = true; |
- return true; |
-} |
- |
} // namespace |
-bool GLSurface::InitializeOneOffInternal() { |
- switch (GetGLImplementation()) { |
- case kGLImplementationDesktopGL: |
- case kGLImplementationDesktopGLCoreProfile: |
- case kGLImplementationAppleGL: |
- if (!InitializeOneOffForSandbox()) { |
- LOG(ERROR) << "GLSurfaceCGL::InitializeOneOff failed."; |
- return false; |
- } |
- break; |
- default: |
- break; |
- } |
- return true; |
-} |
- |
scoped_refptr<GLSurface> GLSurface::CreateViewGLSurface( |
gfx::AcceleratedWidget window) { |
TRACE_EVENT0("gpu", "GLSurface::CreateViewGLSurface"); |