| 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/win/windows_version.h" | 10 #include "base/win/windows_version.h" |
| 10 #include "gpu/ipc/service/child_window_surface_win.h" | 11 #include "gpu/ipc/service/child_window_surface_win.h" |
| 11 #include "gpu/ipc/service/direct_composition_surface_win.h" | 12 #include "gpu/ipc/service/direct_composition_surface_win.h" |
| 12 #include "gpu/ipc/service/gpu_vsync_provider_win.h" | 13 #include "gpu/ipc/service/gpu_vsync_provider_win.h" |
| 13 #include "gpu/ipc/service/pass_through_image_transport_surface.h" | 14 #include "gpu/ipc/service/pass_through_image_transport_surface.h" |
| 14 #include "gpu/ipc/service/switches.h" | 15 #include "gpu/ipc/service/switches.h" |
| 15 #include "ui/gfx/native_widget_types.h" | 16 #include "ui/gfx/native_widget_types.h" |
| 16 #include "ui/gl/gl_bindings.h" | 17 #include "ui/gl/gl_bindings.h" |
| 17 #include "ui/gl/gl_implementation.h" | 18 #include "ui/gl/gl_implementation.h" |
| 18 #include "ui/gl/gl_surface_egl.h" | 19 #include "ui/gl/gl_surface_egl.h" |
| (...skipping 23 matching lines...) Expand all Loading... |
| 42 scoped_refptr<gl::GLSurface> surface; | 43 scoped_refptr<gl::GLSurface> surface; |
| 43 if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2) { | 44 if (gl::GetGLImplementation() == gl::kGLImplementationEGLGLES2) { |
| 44 std::unique_ptr<gfx::VSyncProvider> vsync_provider; | 45 std::unique_ptr<gfx::VSyncProvider> vsync_provider; |
| 45 | 46 |
| 46 if (IsGpuVSyncSignalSupported()) | 47 if (IsGpuVSyncSignalSupported()) |
| 47 vsync_provider.reset(new GpuVSyncProviderWin(delegate, surface_handle)); | 48 vsync_provider.reset(new GpuVSyncProviderWin(delegate, surface_handle)); |
| 48 else | 49 else |
| 49 vsync_provider.reset(new gl::VSyncProviderWin(surface_handle)); | 50 vsync_provider.reset(new gl::VSyncProviderWin(surface_handle)); |
| 50 | 51 |
| 51 if (gl::GLSurfaceEGL::IsDirectCompositionSupported()) { | 52 if (gl::GLSurfaceEGL::IsDirectCompositionSupported()) { |
| 52 if (DirectCompositionSurfaceWin::AreOverlaysSupported()) { | 53 bool overlays_supported = |
| 54 DirectCompositionSurfaceWin::AreOverlaysSupported(); |
| 55 UMA_HISTOGRAM_BOOLEAN("GPU.DirectComposition.OverlaysSupported", |
| 56 overlays_supported); |
| 57 if (overlays_supported) { |
| 53 scoped_refptr<DirectCompositionSurfaceWin> egl_surface = | 58 scoped_refptr<DirectCompositionSurfaceWin> egl_surface = |
| 54 make_scoped_refptr( | 59 make_scoped_refptr( |
| 55 new DirectCompositionSurfaceWin(delegate, surface_handle)); | 60 new DirectCompositionSurfaceWin(delegate, surface_handle)); |
| 56 if (!egl_surface->Initialize(std::move(vsync_provider))) | 61 if (!egl_surface->Initialize(std::move(vsync_provider))) |
| 57 return nullptr; | 62 return nullptr; |
| 58 surface = egl_surface; | 63 surface = egl_surface; |
| 59 } else { | 64 } else { |
| 60 scoped_refptr<ChildWindowSurfaceWin> egl_surface = make_scoped_refptr( | 65 scoped_refptr<ChildWindowSurfaceWin> egl_surface = make_scoped_refptr( |
| 61 new ChildWindowSurfaceWin(delegate, surface_handle)); | 66 new ChildWindowSurfaceWin(delegate, surface_handle)); |
| 62 if (!egl_surface->Initialize(std::move(vsync_provider))) | 67 if (!egl_surface->Initialize(std::move(vsync_provider))) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 73 surface = gl::init::CreateViewGLSurface(surface_handle); | 78 surface = gl::init::CreateViewGLSurface(surface_handle); |
| 74 if (!surface) | 79 if (!surface) |
| 75 return nullptr; | 80 return nullptr; |
| 76 } | 81 } |
| 77 | 82 |
| 78 return scoped_refptr<gl::GLSurface>( | 83 return scoped_refptr<gl::GLSurface>( |
| 79 new PassThroughImageTransportSurface(delegate, surface.get())); | 84 new PassThroughImageTransportSurface(delegate, surface.get())); |
| 80 } | 85 } |
| 81 | 86 |
| 82 } // namespace gpu | 87 } // namespace gpu |
| OLD | NEW |