| 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 "base/metrics/histogram_macros.h" | 9 #include "base/metrics/histogram_macros.h" |
| 10 #include "base/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 else | 49 else |
| 50 vsync_provider.reset(new gl::VSyncProviderWin(surface_handle)); | 50 vsync_provider.reset(new gl::VSyncProviderWin(surface_handle)); |
| 51 | 51 |
| 52 if (gl::GLSurfaceEGL::IsDirectCompositionSupported()) { | 52 if (gl::GLSurfaceEGL::IsDirectCompositionSupported()) { |
| 53 bool overlays_supported = | 53 bool overlays_supported = |
| 54 DirectCompositionSurfaceWin::AreOverlaysSupported(); | 54 DirectCompositionSurfaceWin::AreOverlaysSupported(); |
| 55 UMA_HISTOGRAM_BOOLEAN("GPU.DirectComposition.OverlaysSupported", | 55 UMA_HISTOGRAM_BOOLEAN("GPU.DirectComposition.OverlaysSupported", |
| 56 overlays_supported); | 56 overlays_supported); |
| 57 if (overlays_supported) { | 57 if (overlays_supported) { |
| 58 scoped_refptr<DirectCompositionSurfaceWin> egl_surface = | 58 scoped_refptr<DirectCompositionSurfaceWin> egl_surface = |
| 59 make_scoped_refptr( | 59 make_scoped_refptr(new DirectCompositionSurfaceWin( |
| 60 new DirectCompositionSurfaceWin(delegate, surface_handle)); | 60 std::move(vsync_provider), delegate, surface_handle)); |
| 61 if (!egl_surface->Initialize(std::move(vsync_provider))) | 61 if (!egl_surface->Initialize()) |
| 62 return nullptr; | 62 return nullptr; |
| 63 surface = egl_surface; | 63 surface = egl_surface; |
| 64 } else { | 64 } else { |
| 65 scoped_refptr<ChildWindowSurfaceWin> egl_surface = make_scoped_refptr( | 65 scoped_refptr<ChildWindowSurfaceWin> egl_surface = |
| 66 new ChildWindowSurfaceWin(delegate, surface_handle)); | 66 make_scoped_refptr(new ChildWindowSurfaceWin( |
| 67 if (!egl_surface->Initialize(std::move(vsync_provider))) | 67 std::move(vsync_provider), delegate, surface_handle)); |
| 68 if (!egl_surface->Initialize()) |
| 68 return nullptr; | 69 return nullptr; |
| 69 surface = egl_surface; | 70 surface = egl_surface; |
| 70 } | 71 } |
| 71 } else { | 72 } else { |
| 72 surface = gl::init::CreateNativeViewGLSurfaceEGL( | 73 surface = gl::init::CreateNativeViewGLSurfaceEGL( |
| 73 surface_handle, std::move(vsync_provider)); | 74 surface_handle, std::move(vsync_provider)); |
| 74 if (!surface) | 75 if (!surface) |
| 75 return nullptr; | 76 return nullptr; |
| 76 } | 77 } |
| 77 } else { | 78 } else { |
| 78 surface = gl::init::CreateViewGLSurface(surface_handle); | 79 surface = gl::init::CreateViewGLSurface(surface_handle); |
| 79 if (!surface) | 80 if (!surface) |
| 80 return nullptr; | 81 return nullptr; |
| 81 } | 82 } |
| 82 | 83 |
| 83 return scoped_refptr<gl::GLSurface>( | 84 return scoped_refptr<gl::GLSurface>( |
| 84 new PassThroughImageTransportSurface(delegate, surface.get())); | 85 new PassThroughImageTransportSurface(delegate, surface.get())); |
| 85 } | 86 } |
| 86 | 87 |
| 87 } // namespace gpu | 88 } // namespace gpu |
| OLD | NEW |