| OLD | NEW |
| 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 #if defined(ENABLE_GPU) | 5 #if defined(ENABLE_GPU) |
| 6 | 6 |
| 7 #include "content/common/gpu/image_transport_surface.h" | 7 #include "content/common/gpu/image_transport_surface.h" |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| (...skipping 165 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 176 | 176 |
| 177 } // namespace anonymous | 177 } // namespace anonymous |
| 178 | 178 |
| 179 // static | 179 // static |
| 180 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( | 180 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateSurface( |
| 181 GpuChannelManager* manager, | 181 GpuChannelManager* manager, |
| 182 GpuCommandBufferStub* stub, | 182 GpuCommandBufferStub* stub, |
| 183 gfx::PluginWindowHandle handle) { | 183 gfx::PluginWindowHandle handle) { |
| 184 scoped_refptr<gfx::GLSurface> surface; | 184 scoped_refptr<gfx::GLSurface> surface; |
| 185 | 185 |
| 186 // Temporarily disabling the image transport surface to test whether it | 186 if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2 && |
| 187 // contributes to memory bloat. | |
| 188 if (false && gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2 && | |
| 189 !CommandLine::ForCurrentProcess()->HasSwitch( | 187 !CommandLine::ForCurrentProcess()->HasSwitch( |
| 190 switches::kDisableImageTransportSurface)) { | 188 switches::kDisableImageTransportSurface)) { |
| 191 const char* extensions = eglQueryString(eglGetDisplay(EGL_DEFAULT_DISPLAY), | 189 const char* extensions = eglQueryString(eglGetDisplay(EGL_DEFAULT_DISPLAY), |
| 192 EGL_EXTENSIONS); | 190 EGL_EXTENSIONS); |
| 193 if (strstr(extensions, "EGL_ANGLE_query_surface_pointer") && | 191 if (strstr(extensions, "EGL_ANGLE_query_surface_pointer") && |
| 194 strstr(extensions, "EGL_ANGLE_surface_d3d_texture_2d_share_handle")) { | 192 strstr(extensions, "EGL_ANGLE_surface_d3d_texture_2d_share_handle")) { |
| 195 surface = new PbufferImageTransportSurface(manager, stub); | 193 surface = new PbufferImageTransportSurface(manager, stub); |
| 196 } | 194 } |
| 197 } | 195 } |
| 198 | 196 |
| 199 if (!surface.get()) { | 197 if (!surface.get()) { |
| 200 surface = gfx::GLSurface::CreateViewGLSurface(false, handle); | 198 surface = gfx::GLSurface::CreateViewGLSurface(false, handle); |
| 201 if (!surface.get()) | 199 if (!surface.get()) |
| 202 return NULL; | 200 return NULL; |
| 203 | 201 |
| 204 surface = new PassThroughImageTransportSurface(manager, | 202 surface = new PassThroughImageTransportSurface(manager, |
| 205 stub, | 203 stub, |
| 206 surface.get()); | 204 surface.get()); |
| 207 } | 205 } |
| 208 | 206 |
| 209 if (surface->Initialize()) | 207 if (surface->Initialize()) |
| 210 return surface; | 208 return surface; |
| 211 else | 209 else |
| 212 return NULL; | 210 return NULL; |
| 213 } | 211 } |
| 214 | 212 |
| 215 #endif // ENABLE_GPU | 213 #endif // ENABLE_GPU |
| OLD | NEW |