| 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 "gpu/ipc/service/image_transport_surface.h" | 5 #include "gpu/ipc/service/image_transport_surface.h" | 
| 6 | 6 | 
| 7 #include <memory> | 7 #include <memory> | 
| 8 | 8 | 
| 9 #include "gpu/ipc/service/child_window_surface_win.h" | 9 #include "gpu/ipc/service/child_window_surface_win.h" | 
| 10 #include "gpu/ipc/service/pass_through_image_transport_surface.h" | 10 #include "gpu/ipc/service/pass_through_image_transport_surface.h" | 
| 11 #include "ui/gfx/native_widget_types.h" | 11 #include "ui/gfx/native_widget_types.h" | 
| 12 #include "ui/gl/gl_bindings.h" | 12 #include "ui/gl/gl_bindings.h" | 
| 13 #include "ui/gl/gl_implementation.h" | 13 #include "ui/gl/gl_implementation.h" | 
| 14 #include "ui/gl/gl_surface_egl.h" | 14 #include "ui/gl/gl_surface_egl.h" | 
|  | 15 #include "ui/gl/init/gl_factory.h" | 
| 15 #include "ui/gl/vsync_provider_win.h" | 16 #include "ui/gl/vsync_provider_win.h" | 
| 16 | 17 | 
| 17 namespace gpu { | 18 namespace gpu { | 
| 18 | 19 | 
| 19 // static | 20 // static | 
| 20 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateNativeSurface( | 21 scoped_refptr<gfx::GLSurface> ImageTransportSurface::CreateNativeSurface( | 
| 21     GpuChannelManager* manager, | 22     GpuChannelManager* manager, | 
| 22     GpuCommandBufferStub* stub, | 23     GpuCommandBufferStub* stub, | 
| 23     SurfaceHandle surface_handle, | 24     SurfaceHandle surface_handle, | 
| 24     gfx::GLSurface::Format format) { | 25     gfx::GLSurface::Format format) { | 
| 25   DCHECK_NE(surface_handle, kNullSurfaceHandle); | 26   DCHECK_NE(surface_handle, kNullSurfaceHandle); | 
| 26 | 27 | 
| 27   scoped_refptr<gfx::GLSurface> surface; | 28   scoped_refptr<gfx::GLSurface> surface; | 
| 28   if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2 && | 29   if (gfx::GetGLImplementation() == gfx::kGLImplementationEGLGLES2 && | 
| 29       gfx::GLSurfaceEGL::IsDirectCompositionSupported()) { | 30       gfx::GLSurfaceEGL::IsDirectCompositionSupported()) { | 
| 30     scoped_refptr<ChildWindowSurfaceWin> egl_surface( | 31     scoped_refptr<ChildWindowSurfaceWin> egl_surface( | 
| 31         new ChildWindowSurfaceWin(manager, surface_handle)); | 32         new ChildWindowSurfaceWin(manager, surface_handle)); | 
| 32     surface = egl_surface; | 33     surface = egl_surface; | 
| 33 | 34 | 
| 34     // TODO(jbauman): Get frame statistics from DirectComposition | 35     // TODO(jbauman): Get frame statistics from DirectComposition | 
| 35     std::unique_ptr<gfx::VSyncProvider> vsync_provider( | 36     std::unique_ptr<gfx::VSyncProvider> vsync_provider( | 
| 36         new gfx::VSyncProviderWin(surface_handle)); | 37         new gfx::VSyncProviderWin(surface_handle)); | 
| 37     if (!egl_surface->Initialize(std::move(vsync_provider))) | 38     if (!egl_surface->Initialize(std::move(vsync_provider))) | 
| 38       return nullptr; | 39       return nullptr; | 
| 39   } else { | 40   } else { | 
| 40     surface = gfx::GLSurface::CreateViewGLSurface(surface_handle); | 41     surface = gl::init::CreateViewGLSurface(surface_handle); | 
| 41     if (!surface) | 42     if (!surface) | 
| 42       return nullptr; | 43       return nullptr; | 
| 43   } | 44   } | 
| 44 | 45 | 
| 45   return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface( | 46   return scoped_refptr<gfx::GLSurface>(new PassThroughImageTransportSurface( | 
| 46       manager, stub, surface.get())); | 47       manager, stub, surface.get())); | 
| 47 } | 48 } | 
| 48 | 49 | 
| 49 }  // namespace gpu | 50 }  // namespace gpu | 
| OLD | NEW | 
|---|