Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(20)

Unified Diff: content/browser/compositor/gpu_browser_compositor_output_surface.cc

Issue 2018603002: Mac: Clean up ifdefs in output surface (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Incorporate review feedback Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: content/browser/compositor/gpu_browser_compositor_output_surface.cc
diff --git a/content/browser/compositor/gpu_browser_compositor_output_surface.cc b/content/browser/compositor/gpu_browser_compositor_output_surface.cc
index c3ab12dde70788915a2bb1938dba22f4c0c54fb4..ab2597ac9f92302446ba7d32996d29669fe4ea56 100644
--- a/content/browser/compositor/gpu_browser_compositor_output_surface.cc
+++ b/content/browser/compositor/gpu_browser_compositor_output_surface.cc
@@ -17,12 +17,6 @@
#include "gpu/command_buffer/client/context_support.h"
#include "gpu/ipc/client/command_buffer_proxy_impl.h"
-#if defined(OS_MACOSX)
-#include "content/browser/gpu/gpu_surface_tracker.h"
-#include "gpu/ipc/client/gpu_process_hosted_ca_layer_tree_params.h"
-#include "ui/accelerated_widget_mac/accelerated_widget_mac.h"
-#endif
-
namespace content {
GpuBrowserCompositorOutputSurface::GpuBrowserCompositorOutputSurface(
@@ -35,9 +29,6 @@ GpuBrowserCompositorOutputSurface::GpuBrowserCompositorOutputSurface(
std::move(vsync_manager),
task_runner,
std::move(overlay_candidate_validator)),
-#if defined(OS_MACOSX)
- should_show_frames_state_(SHOULD_SHOW_FRAMES),
-#endif
swap_buffers_completion_callback_(base::Bind(
&GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted,
base::Unretained(this))),
@@ -111,68 +102,19 @@ void GpuBrowserCompositorOutputSurface::SwapBuffers(
}
client_->DidSwapBuffers();
-
-#if defined(OS_MACOSX)
- if (should_show_frames_state_ ==
- SHOULD_NOT_SHOW_FRAMES_NO_SWAP_AFTER_SUSPENDED) {
- should_show_frames_state_ = SHOULD_SHOW_FRAMES;
- }
-#endif
}
void GpuBrowserCompositorOutputSurface::OnGpuSwapBuffersCompleted(
const std::vector<ui::LatencyInfo>& latency_info,
gfx::SwapResult result,
const gpu::GpuProcessHostedCALayerTreeParamsMac* params_mac) {
-#if defined(OS_MACOSX)
- if (should_show_frames_state_ == SHOULD_SHOW_FRAMES) {
- gfx::AcceleratedWidget native_widget =
- content::GpuSurfaceTracker::Get()->AcquireNativeWidget(
- params_mac->surface_handle);
- ui::AcceleratedWidgetMacGotFrame(
- native_widget, params_mac->ca_context_id,
- params_mac->fullscreen_low_power_ca_context_valid,
- params_mac->fullscreen_low_power_ca_context_id, params_mac->io_surface,
- params_mac->pixel_size, params_mac->scale_factor, nullptr, nullptr);
- }
-#endif
RenderWidgetHostImpl::CompositorFrameDrawn(latency_info);
OnSwapBuffersComplete();
}
#if defined(OS_MACOSX)
void GpuBrowserCompositorOutputSurface::SetSurfaceSuspendedForRecycle(
- bool suspended) {
- if (suspended) {
- // It may be that there are frames in-flight from the GPU process back to
- // the browser. Make sure that these frames are not displayed by ignoring
- // them in GpuProcessHostUIShim, until the browser issues a SwapBuffers for
- // the new content.
- should_show_frames_state_ = SHOULD_NOT_SHOW_FRAMES_SUSPENDED;
- } else {
- // Discard the backbuffer before drawing the new frame. This is necessary
- // only when using a ImageTransportSurfaceFBO with a
- // CALayerStorageProvider. Discarding the backbuffer results in the next
- // frame using a new CALayer and CAContext, which guarantees that the
- // browser will not flash stale content when adding the remote CALayer to
- // the NSView hierarchy (it could flash stale content because the system
- // window server is not synchronized with any signals we control or
- // observe).
- if (should_show_frames_state_ == SHOULD_NOT_SHOW_FRAMES_SUSPENDED) {
- DiscardBackbuffer();
- should_show_frames_state_ =
- SHOULD_NOT_SHOW_FRAMES_NO_SWAP_AFTER_SUSPENDED;
- }
- }
-}
+ bool suspended) {}
#endif
-bool GpuBrowserCompositorOutputSurface::SurfaceIsSuspendForRecycle() const {
-#if defined(OS_MACOSX)
- return should_show_frames_state_ == SHOULD_NOT_SHOW_FRAMES_SUSPENDED;
-#else
- return false;
-#endif
-}
-
} // namespace content

Powered by Google App Engine
This is Rietveld 408576698