Commit c7d66e90 authored by Sean Gilhuly's avatar Sean Gilhuly Committed by Commit Bot

Restrict DisableSwapUntilResize to Windows

This mojo call was added for crbug.com/811945 to fix a Windows-specific
bug. Restrict it to only be enabled on Windows.

Bug: 1042259
Change-Id: I52f1f348e1de52e2d09a376e80852e1b8ae84d23
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2063417Reviewed-by: default avatarKen Buchanan <kenrb@chromium.org>
Reviewed-by: default avatarkylechar <kylechar@chromium.org>
Commit-Queue: Sean Gilhuly <sgilhuly@chromium.org>
Cr-Commit-Position: refs/heads/master@{#742812}
parent 84648e78
...@@ -166,10 +166,12 @@ void RootCompositorFrameSinkImpl::SetDisplayVisible(bool visible) { ...@@ -166,10 +166,12 @@ void RootCompositorFrameSinkImpl::SetDisplayVisible(bool visible) {
display_->SetVisible(visible); display_->SetVisible(visible);
} }
#if defined(OS_WIN)
void RootCompositorFrameSinkImpl::DisableSwapUntilResize( void RootCompositorFrameSinkImpl::DisableSwapUntilResize(
DisableSwapUntilResizeCallback callback) { DisableSwapUntilResizeCallback callback) {
display_->DisableSwapUntilResize(std::move(callback)); display_->DisableSwapUntilResize(std::move(callback));
} }
#endif
void RootCompositorFrameSinkImpl::Resize(const gfx::Size& size) { void RootCompositorFrameSinkImpl::Resize(const gfx::Size& size) {
display_->Resize(size); display_->Resize(size);
......
...@@ -50,7 +50,9 @@ class RootCompositorFrameSinkImpl : public mojom::CompositorFrameSink, ...@@ -50,7 +50,9 @@ class RootCompositorFrameSinkImpl : public mojom::CompositorFrameSink,
// mojom::DisplayPrivate: // mojom::DisplayPrivate:
void SetDisplayVisible(bool visible) override; void SetDisplayVisible(bool visible) override;
#if defined(OS_WIN)
void DisableSwapUntilResize(DisableSwapUntilResizeCallback callback) override; void DisableSwapUntilResize(DisableSwapUntilResizeCallback callback) override;
#endif
void Resize(const gfx::Size& size) override; void Resize(const gfx::Size& size) override;
void SetDisplayColorMatrix(const gfx::Transform& color_matrix) override; void SetDisplayColorMatrix(const gfx::Transform& color_matrix) override;
void SetDisplayColorSpaces( void SetDisplayColorSpaces(
......
...@@ -23,7 +23,8 @@ interface DisplayPrivate { ...@@ -23,7 +23,8 @@ interface DisplayPrivate {
// Attempts to immediately swap a frame with the current size if possible, // Attempts to immediately swap a frame with the current size if possible,
// then will no longer swap until Resize() is called with a non-empty size. // then will no longer swap until Resize() is called with a non-empty size.
[Sync] DisableSwapUntilResize() => (); [EnableIf=is_win, Sync]
DisableSwapUntilResize() => ();
// Resizes the display. // Resizes the display.
Resize(gfx.mojom.Size size); Resize(gfx.mojom.Size size);
......
...@@ -38,7 +38,6 @@ ...@@ -38,7 +38,6 @@
#include "components/viz/common/switches.h" #include "components/viz/common/switches.h"
#include "components/viz/host/host_frame_sink_manager.h" #include "components/viz/host/host_frame_sink_manager.h"
#include "components/viz/host/renderer_settings_creation.h" #include "components/viz/host/renderer_settings_creation.h"
#include "mojo/public/cpp/bindings/sync_call_restrictions.h"
#include "services/viz/privileged/mojom/compositing/display_private.mojom.h" #include "services/viz/privileged/mojom/compositing/display_private.mojom.h"
#include "services/viz/privileged/mojom/compositing/external_begin_frame_controller.mojom.h" #include "services/viz/privileged/mojom/compositing/external_begin_frame_controller.mojom.h"
#include "services/viz/privileged/mojom/compositing/vsync_parameter_observer.mojom.h" #include "services/viz/privileged/mojom/compositing/vsync_parameter_observer.mojom.h"
...@@ -57,6 +56,10 @@ ...@@ -57,6 +56,10 @@
#include "ui/gfx/switches.h" #include "ui/gfx/switches.h"
#include "ui/gl/gl_switches.h" #include "ui/gl/gl_switches.h"
#if defined(OS_WIN)
#include "mojo/public/cpp/bindings/sync_call_restrictions.h"
#endif
namespace ui { namespace ui {
// Used to hold on to IssueExternalBeginFrame arguments if // Used to hold on to IssueExternalBeginFrame arguments if
...@@ -385,6 +388,7 @@ void Compositor::ScheduleRedrawRect(const gfx::Rect& damage_rect) { ...@@ -385,6 +388,7 @@ void Compositor::ScheduleRedrawRect(const gfx::Rect& damage_rect) {
host_->SetNeedsCommit(); host_->SetNeedsCommit();
} }
#if defined(OS_WIN)
void Compositor::DisableSwapUntilResize() { void Compositor::DisableSwapUntilResize() {
if (display_private_) { if (display_private_) {
// Browser needs to block for Viz to receive and process this message. // Browser needs to block for Viz to receive and process this message.
...@@ -403,6 +407,7 @@ void Compositor::ReenableSwap() { ...@@ -403,6 +407,7 @@ void Compositor::ReenableSwap() {
if (display_private_) if (display_private_)
display_private_->Resize(size_); display_private_->Resize(size_);
} }
#endif
void Compositor::SetScaleAndSize( void Compositor::SetScaleAndSize(
float scale, float scale,
......
...@@ -197,10 +197,12 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient, ...@@ -197,10 +197,12 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient,
// from changes to layer properties. // from changes to layer properties.
void ScheduleRedrawRect(const gfx::Rect& damage_rect); void ScheduleRedrawRect(const gfx::Rect& damage_rect);
#if defined(OS_WIN)
// Attempts to immediately swap a frame with the current size if possible, // Attempts to immediately swap a frame with the current size if possible,
// then disables swapping on this surface until it is resized. // then disables swapping on this surface until it is resized.
void DisableSwapUntilResize(); void DisableSwapUntilResize();
void ReenableSwap(); void ReenableSwap();
#endif
// Sets the compositor's device scale factor and size. // Sets the compositor's device scale factor and size.
void SetScaleAndSize( void SetScaleAndSize(
......
...@@ -158,6 +158,7 @@ class InProcessContextFactory::PerCompositorData ...@@ -158,6 +158,7 @@ class InProcessContextFactory::PerCompositorData
display_->SetVisible(visible); display_->SetVisible(visible);
} }
void Resize(const gfx::Size& size) override { display_->Resize(size); } void Resize(const gfx::Size& size) override { display_->Resize(size); }
#if defined(OS_WIN)
bool DisableSwapUntilResize() override { bool DisableSwapUntilResize() override {
display_->DisableSwapUntilResize(base::OnceClosure()); display_->DisableSwapUntilResize(base::OnceClosure());
return true; return true;
...@@ -166,6 +167,7 @@ class InProcessContextFactory::PerCompositorData ...@@ -166,6 +167,7 @@ class InProcessContextFactory::PerCompositorData
DisableSwapUntilResizeCallback callback) override { DisableSwapUntilResizeCallback callback) override {
display_->DisableSwapUntilResize(std::move(callback)); display_->DisableSwapUntilResize(std::move(callback));
} }
#endif
void SetDisplayColorMatrix(const gfx::Transform& matrix) override { void SetDisplayColorMatrix(const gfx::Transform& matrix) override {
output_color_matrix_ = matrix.matrix(); output_color_matrix_ = matrix.matrix();
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment