| 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 #include "content/common/gpu/image_transport_surface.h" | 5 #include "content/common/gpu/image_transport_surface.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/common/gpu/gpu_command_buffer_stub.h" | 8 #include "content/common/gpu/gpu_command_buffer_stub.h" |
| 9 #include "content/common/gpu/gpu_surface_lookup.h" | 9 #include "content/common/gpu/gpu_surface_lookup.h" |
| 10 #include "ui/gl/gl_surface_egl.h" | 10 #include "ui/gl/gl_surface_egl.h" |
| 11 | 11 |
| 12 namespace content { | 12 namespace content { |
| 13 | 13 |
| 14 // static | 14 // static |
| 15 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateNativeSurface( | 15 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateNativeSurface( |
| 16 GpuChannelManager* manager, | 16 GpuChannelManager* manager, |
| 17 GpuCommandBufferStub* stub, | 17 GpuCommandBufferStub* stub, |
| 18 const gfx::GLSurfaceHandle& handle) { | 18 const gfx::GLSurfaceHandle& handle) { |
| 19 DCHECK(GpuSurfaceLookup::GetInstance()); | 19 DCHECK(GpuSurfaceLookup::GetInstance()); |
| 20 DCHECK_EQ(handle.transport_type, gfx::NATIVE_DIRECT); | 20 DCHECK_EQ(handle.transport_type, gfx::NATIVE_DIRECT); |
| 21 ANativeWindow* window = | 21 ANativeWindow* window = |
| 22 GpuSurfaceLookup::GetInstance()->AcquireNativeWidget( | 22 GpuSurfaceLookup::GetInstance()->AcquireNativeWidget( |
| 23 stub->surface_id()); | 23 stub->surface_id()); |
| 24 scoped_refptr<gfx::GLSurface> surface = | 24 scoped_refptr<gfx::GLSurface> surface = |
| 25 new gfx::NativeViewGLSurfaceEGL(false, window); | 25 new gfx::NativeViewGLSurfaceEGL(window); |
| 26 bool initialize_success = surface->Initialize(); | 26 bool initialize_success = surface->Initialize(); |
| 27 if (window) | 27 if (window) |
| 28 ANativeWindow_release(window); | 28 ANativeWindow_release(window); |
| 29 if (!initialize_success) | 29 if (!initialize_success) |
| 30 return scoped_refptr<gfx::GLSurface>(); | 30 return scoped_refptr<gfx::GLSurface>(); |
| 31 | 31 |
| 32 return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface( | 32 return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface( |
| 33 manager, stub, surface.get(), false)); | 33 manager, stub, surface.get(), false)); |
| 34 } | 34 } |
| 35 | 35 |
| 36 } // namespace content | 36 } // namespace content |
| OLD | NEW |