| 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" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 gl::GLSurface::Format format) { | 25 gl::GLSurface::Format format) { |
| 26 DCHECK_NE(surface_handle, kNullSurfaceHandle); | 26 DCHECK_NE(surface_handle, kNullSurfaceHandle); |
| 27 | 27 |
| 28 scoped_refptr<gl::GLSurface> surface; | 28 scoped_refptr<gl::GLSurface> surface; |
| 29 if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2 && | 29 if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2 && |
| 30 gl::GLSurfaceEGL::IsDirectCompositionSupported()) { | 30 gl::GLSurfaceEGL::IsDirectCompositionSupported()) { |
| 31 scoped_refptr<ChildWindowSurfaceWin> egl_surface( | 31 scoped_refptr<ChildWindowSurfaceWin> egl_surface( |
| 32 new ChildWindowSurfaceWin(manager, surface_handle)); | 32 new ChildWindowSurfaceWin(manager, surface_handle)); |
| 33 surface = egl_surface; | 33 surface = egl_surface; |
| 34 | 34 |
| 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 // Use DWM based gl::VSyncProviderWin provider only if sync control |
| 37 new gl::VSyncProviderWin(surface_handle)); | 37 // extension isn't supported. Otherwise the Initialize call below should |
| 38 // assign a default VSyncProvider. |
| 39 if (!ChildWindowSurfaceWin::HasEGLExtension("EGL_CHROMIUM_sync_control")) { |
| 40 vsync_provider.reset(new gl::VSyncProviderWin(surface_handle)); |
| 41 } |
| 42 |
| 38 if (!egl_surface->Initialize(std::move(vsync_provider))) | 43 if (!egl_surface->Initialize(std::move(vsync_provider))) |
| 39 return nullptr; | 44 return nullptr; |
| 40 } else { | 45 } else { |
| 41 surface = gl::init::CreateViewGLSurface(surface_handle); | 46 surface = gl::init::CreateViewGLSurface(surface_handle); |
| 42 if (!surface) | 47 if (!surface) |
| 43 return nullptr; | 48 return nullptr; |
| 44 } | 49 } |
| 45 | 50 |
| 46 return scoped_refptr<gl::GLSurface>( | 51 return scoped_refptr<gl::GLSurface>( |
| 47 new PassThroughImageTransportSurface(manager, stub, surface.get())); | 52 new PassThroughImageTransportSurface(manager, stub, surface.get())); |
| 48 } | 53 } |
| 49 | 54 |
| 50 } // namespace gpu | 55 } // namespace gpu |
| OLD | NEW |