| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/browser/compositor/gpu_browser_compositor_output_surface.h" | 5 #include "content/browser/compositor/gpu_browser_compositor_output_surface.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "build/build_config.h" | 9 #include "build/build_config.h" |
| 10 #include "cc/output/compositor_frame.h" | 10 #include "cc/output/compositor_frame.h" |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 120 should_show_frames_state_ = SHOULD_SHOW_FRAMES; | 120 should_show_frames_state_ = SHOULD_SHOW_FRAMES; |
| 121 } | 121 } |
| 122 #endif | 122 #endif |
| 123 } | 123 } |
| 124 | 124 |
| 125 void GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( | 125 void GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted( |
| 126 const std::vector<ui::LatencyInfo>& latency_info, | 126 const std::vector<ui::LatencyInfo>& latency_info, |
| 127 gfx::SwapResult result, | 127 gfx::SwapResult result, |
| 128 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) { | 128 const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) { |
| 129 #if defined(OS_MACOSX) | 129 #if defined(OS_MACOSX) |
| 130 if (!SurfaceIsSuspendForRecycle()) { | 130 if (should_show_frames_state_ == SHOULD_SHOW_FRAMES) { |
| 131 gfx::AcceleratedWidget native_widget = | 131 gfx::AcceleratedWidget native_widget = |
| 132 content::GpuSurfaceTracker::Get()->AcquireNativeWidget( | 132 content::GpuSurfaceTracker::Get()->AcquireNativeWidget( |
| 133 params_mac->surface_handle); | 133 params_mac->surface_handle); |
| 134 ui::AcceleratedWidgetMacGotFrame( | 134 ui::AcceleratedWidgetMacGotFrame( |
| 135 native_widget, params_mac->ca_context_id, | 135 native_widget, params_mac->ca_context_id, |
| 136 params_mac->fullscreen_low_power_ca_context_valid, | 136 params_mac->fullscreen_low_power_ca_context_valid, |
| 137 params_mac->fullscreen_low_power_ca_context_id, params_mac->io_surface, | 137 params_mac->fullscreen_low_power_ca_context_id, params_mac->io_surface, |
| 138 params_mac->pixel_size, params_mac->scale_factor, nullptr, nullptr); | 138 params_mac->pixel_size, params_mac->scale_factor, nullptr, nullptr); |
| 139 } | 139 } |
| 140 #endif | 140 #endif |
| (...skipping 19 matching lines...) Expand all Loading... |
| 160 // the NSView hierarchy (it could flash stale content because the system | 160 // the NSView hierarchy (it could flash stale content because the system |
| 161 // window server is not synchronized with any signals we control or | 161 // window server is not synchronized with any signals we control or |
| 162 // observe). | 162 // observe). |
| 163 if (should_show_frames_state_ == SHOULD_NOT_SHOW_FRAMES_SUSPENDED) { | 163 if (should_show_frames_state_ == SHOULD_NOT_SHOW_FRAMES_SUSPENDED) { |
| 164 DiscardBackbuffer(); | 164 DiscardBackbuffer(); |
| 165 should_show_frames_state_ = | 165 should_show_frames_state_ = |
| 166 SHOULD_NOT_SHOW_FRAMES_NO_SWAP_AFTER_SUSPENDED; | 166 SHOULD_NOT_SHOW_FRAMES_NO_SWAP_AFTER_SUSPENDED; |
| 167 } | 167 } |
| 168 } | 168 } |
| 169 } | 169 } |
| 170 | |
| 171 bool GpuBrowserCompositorOutputSurface:: | |
| 172 SurfaceShouldNotShowFramesAfterSuspendForRecycle() const { | |
| 173 return should_show_frames_state_ != SHOULD_SHOW_FRAMES; | |
| 174 } | |
| 175 #endif | 170 #endif |
| 176 | 171 |
| 177 bool GpuBrowserCompositorOutputSurface::SurfaceIsSuspendForRecycle() const { | 172 bool GpuBrowserCompositorOutputSurface::SurfaceIsSuspendForRecycle() const { |
| 178 #if defined(OS_MACOSX) | 173 #if defined(OS_MACOSX) |
| 179 return should_show_frames_state_ == SHOULD_NOT_SHOW_FRAMES_SUSPENDED; | 174 return should_show_frames_state_ == SHOULD_NOT_SHOW_FRAMES_SUSPENDED; |
| 180 #else | 175 #else |
| 181 return false; | 176 return false; |
| 182 #endif | 177 #endif |
| 183 } | 178 } |
| 184 | 179 |
| 185 } // namespace content | 180 } // namespace content |
| OLD | NEW |