GPU workaround to simulate Out of Memory errors with large textures
[chromium-blink-merge.git] / content / common / gpu / image_transport_surface_linux.cc
blobdb36efea1354052ee54e603626f6e31484aea11b
1 // Copyright 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "content/common/gpu/image_transport_surface.h"
7 namespace content {
9 // static
10 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateNativeSurface(
11 GpuChannelManager* manager,
12 GpuCommandBufferStub* stub,
13 const gfx::GLSurfaceHandle& handle) {
14 DCHECK(handle.handle);
15 DCHECK(handle.transport_type == gfx::NATIVE_DIRECT);
16 scoped_refptr<gfx::GLSurface> surface;
17 #if defined(USE_OZONE)
18 surface = gfx::GLSurface::CreateSurfacelessViewGLSurface(handle.handle);
19 #endif
20 if (!surface)
21 surface = gfx::GLSurface::CreateViewGLSurface(handle.handle);
22 if (!surface)
23 return surface;
24 return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface(
25 manager, stub, surface.get()));
28 } // namespace content