summaryrefslogtreecommitdiff
path: root/chromium/ui/compositor
diff options
context:
space:
mode:
authorAllan Sandfeld Jensen <allan.jensen@qt.io>2021-03-12 09:13:00 +0100
committerAllan Sandfeld Jensen <allan.jensen@qt.io>2021-03-16 09:58:26 +0000
commit03561cae90f1d99b5c54b1ef3be69f10e882b25e (patch)
treecc5f0958e823c044e7ae51cc0117fe51432abe5e /chromium/ui/compositor
parentfa98118a45f7e169f8846086dc2c22c49a8ba310 (diff)
downloadqtwebengine-chromium-03561cae90f1d99b5c54b1ef3be69f10e882b25e.tar.gz
BASELINE: Update Chromium to 88.0.4324.208
Change-Id: I3ae87d23e4eff4b4a469685658740a213600c667 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
Diffstat (limited to 'chromium/ui/compositor')
-rw-r--r--chromium/ui/compositor/BUILD.gn3
-rw-r--r--chromium/ui/compositor/animation_metrics_recorder.cc67
-rw-r--r--chromium/ui/compositor/animation_metrics_recorder.h74
-rw-r--r--chromium/ui/compositor/animation_metrics_reporter.h27
-rw-r--r--chromium/ui/compositor/animation_throughput_reporter.h4
-rw-r--r--chromium/ui/compositor/animation_throughput_reporter_unittest.cc25
-rw-r--r--chromium/ui/compositor/canvas_painter.cc2
-rw-r--r--chromium/ui/compositor/compositor.cc10
-rw-r--r--chromium/ui/compositor/compositor.h6
-rw-r--r--chromium/ui/compositor/compositor_observer.h8
-rw-r--r--chromium/ui/compositor/compositor_unittest.cc20
-rw-r--r--chromium/ui/compositor/layer.cc12
-rw-r--r--chromium/ui/compositor/layer.h4
-rw-r--r--chromium/ui/compositor/layer_animation_element.cc32
-rw-r--r--chromium/ui/compositor/layer_animation_element.h12
-rw-r--r--chromium/ui/compositor/layer_animation_sequence.cc22
-rw-r--r--chromium/ui/compositor/layer_animation_sequence.h6
-rw-r--r--chromium/ui/compositor/layer_animator.cc5
-rw-r--r--chromium/ui/compositor/layer_animator.h7
-rw-r--r--chromium/ui/compositor/layer_animator_unittest.cc179
-rw-r--r--chromium/ui/compositor/layer_unittest.cc30
-rw-r--r--chromium/ui/compositor/recyclable_compositor_mac.cc7
-rw-r--r--chromium/ui/compositor/recyclable_compositor_mac.h5
-rw-r--r--chromium/ui/compositor/scoped_layer_animation_settings.cc6
-rw-r--r--chromium/ui/compositor/scoped_layer_animation_settings.h2
-rw-r--r--chromium/ui/compositor/test/test_compositor_host_ozone.cc6
-rw-r--r--chromium/ui/compositor/throughput_tracker_host.h4
27 files changed, 90 insertions, 495 deletions
diff --git a/chromium/ui/compositor/BUILD.gn b/chromium/ui/compositor/BUILD.gn
index 116f36d96a4..65a978aebaa 100644
--- a/chromium/ui/compositor/BUILD.gn
+++ b/chromium/ui/compositor/BUILD.gn
@@ -7,9 +7,6 @@ import("//testing/test.gni")
component("compositor") {
sources = [
- "animation_metrics_recorder.cc",
- "animation_metrics_recorder.h",
- "animation_metrics_reporter.h",
"animation_throughput_reporter.cc",
"animation_throughput_reporter.h",
"callback_layer_animation_observer.cc",
diff --git a/chromium/ui/compositor/animation_metrics_recorder.cc b/chromium/ui/compositor/animation_metrics_recorder.cc
deleted file mode 100644
index 1b60427856e..00000000000
--- a/chromium/ui/compositor/animation_metrics_recorder.cc
+++ /dev/null
@@ -1,67 +0,0 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#include "ui/compositor/animation_metrics_recorder.h"
-
-#include "base/check_op.h"
-#include "ui/compositor/animation_metrics_reporter.h"
-
-namespace ui {
-
-AnimationMetricsRecorder::AnimationMetricsRecorder(
- AnimationMetricsReporter* reporter)
- : reporter_(reporter) {}
-
-AnimationMetricsRecorder::~AnimationMetricsRecorder() = default;
-
-void AnimationMetricsRecorder::OnAnimatorAttached(
- base::Optional<int> frame_number) {
- DCHECK(frame_number.has_value());
- if (start_frame_number_.has_value() || animator_detached_after_start_)
- return;
-
- start_frame_number_ = frame_number;
-}
-
-void AnimationMetricsRecorder::OnAnimatorDetached() {
- animator_detached_after_start_ = true;
- start_frame_number_.reset();
-}
-
-void AnimationMetricsRecorder::OnAnimationStart(
- base::Optional<int> start_frame_number,
- base::TimeTicks effective_start_time,
- base::TimeDelta duration) {
- start_frame_number_ = start_frame_number;
- effective_start_time_ = effective_start_time;
- duration_ = duration;
- animator_detached_after_start_ = false;
-}
-
-void AnimationMetricsRecorder::OnAnimationEnd(
- base::Optional<int> end_frame_number,
- float refresh_rate) {
- DCHECK(reporter_);
-
- if (duration_.is_zero() || !start_frame_number_.has_value() ||
- !end_frame_number.has_value()) {
- return;
- }
- DCHECK_GE(end_frame_number.value(), start_frame_number_.value());
-
- base::TimeDelta elapsed = base::TimeTicks::Now() - effective_start_time_;
- if (elapsed < duration_)
- return;
-
- int smoothness = 100;
- const float frame_interval =
- base::Time::kMillisecondsPerSecond / refresh_rate;
- const float actual_duration =
- (end_frame_number.value() - start_frame_number_.value()) * frame_interval;
- if (duration_.InMillisecondsF() - actual_duration >= frame_interval)
- smoothness = 100 * (actual_duration / duration_.InMillisecondsF());
- reporter_->Report(smoothness);
-}
-
-} // namespace ui
diff --git a/chromium/ui/compositor/animation_metrics_recorder.h b/chromium/ui/compositor/animation_metrics_recorder.h
deleted file mode 100644
index 75376aa435d..00000000000
--- a/chromium/ui/compositor/animation_metrics_recorder.h
+++ /dev/null
@@ -1,74 +0,0 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef UI_COMPOSITOR_ANIMATION_METRICS_RECORDER_H_
-#define UI_COMPOSITOR_ANIMATION_METRICS_RECORDER_H_
-
-#include "base/optional.h"
-#include "base/time/time.h"
-#include "ui/compositor/compositor_export.h"
-
-namespace ui {
-
-class AnimationMetricsReporter;
-
-// This is the interface to send animation smoothness numbers to a given
-// AnimationMetricsReporter.
-//
-// Classes that run animations (e.g. ui::LayerAnimationSequence,
-// views::CompositorAnimationRunner) should own one of these objects and pass
-// the values required to calculate animation smoothness when an animation
-// starts and ends.
-//
-// To use, when your animation starts:
-// animation_metrics_recorder_->OnAnimationStart(frame, start_time,
-// expected_duration);
-// and when it ends:
-// animation metrics_recorder_->OnAnimationEnd(frame, refresh_rate);
-// and your attached AnimationMetricsReporter will report the calculated
-// smoothness. Note that if the animator is attached or detached during an
-// animation, this class will have to be notified.
-//
-// Unless implementing a complex custom animator, client code should just need
-// to supply an AnimationMetricsReporter to an animations class that already
-// owns an instance of this class.
-class COMPOSITOR_EXPORT AnimationMetricsRecorder {
- public:
- explicit AnimationMetricsRecorder(AnimationMetricsReporter* reporter);
- AnimationMetricsRecorder(const AnimationMetricsRecorder&) = delete;
- AnimationMetricsRecorder& operator=(const AnimationMetricsRecorder&) = delete;
- ~AnimationMetricsRecorder();
-
- // Called when the animator is attached to/detached from a Compositor to
- // update |start_frame_number_|.
- void OnAnimatorAttached(base::Optional<int> frame_number);
- void OnAnimatorDetached();
-
- void OnAnimationStart(base::Optional<int> start_frame_number,
- base::TimeTicks effective_start_time,
- base::TimeDelta duration);
- void OnAnimationEnd(base::Optional<int> end_frame_number, float refresh_rate);
-
- private:
- AnimationMetricsReporter* const reporter_;
-
- // Variables set at the start of an animation which are required to compute
- // the smoothness when the animation ends.
- // |start_frame_number_| is the frame number in relevant Compositor when
- // the animation starts. If not set, it means the animator and its Layer
- // is not attached to a Compositor when the animation starts, or is
- // detached from the Compositor partway through the animation.
- base::Optional<int> start_frame_number_;
- base::TimeTicks effective_start_time_;
- base::TimeDelta duration_;
-
- // Whether animator is detached from Compositor partway through the animation.
- // If it is true, no metrics is reported because the number of frames could
- // not be counted correctly in such case.
- bool animator_detached_after_start_ = false;
-};
-
-} // namespace ui
-
-#endif // UI_COMPOSITOR_ANIMATION_METRICS_RECORDER_H_
diff --git a/chromium/ui/compositor/animation_metrics_reporter.h b/chromium/ui/compositor/animation_metrics_reporter.h
deleted file mode 100644
index d06fe232e70..00000000000
--- a/chromium/ui/compositor/animation_metrics_reporter.h
+++ /dev/null
@@ -1,27 +0,0 @@
-// Copyright 2020 The Chromium Authors. All rights reserved.
-// Use of this source code is governed by a BSD-style license that can be
-// found in the LICENSE file.
-
-#ifndef UI_COMPOSITOR_ANIMATION_METRICS_REPORTER_H_
-#define UI_COMPOSITOR_ANIMATION_METRICS_REPORTER_H_
-
-#include "ui/compositor/compositor_export.h"
-
-namespace ui {
-
-// Override this class and attach it to any class that supports recording
-// animation smoothness (e.g. ui::LayerAnimationSequence,
-// views::CompositorAnimationRunner). When an animation ends, |Report| will be
-// called with the animation smoothness as a percentage.
-class COMPOSITOR_EXPORT AnimationMetricsReporter {
- public:
- virtual ~AnimationMetricsReporter() = default;
- // Called at the end of every animation sequence, if the duration and frames
- // passed meets certain criteria. |value| is the smoothness, measured in
- // percentage of the animation.
- virtual void Report(int value) = 0;
-};
-
-} // namespace ui
-
-#endif // UI_COMPOSITOR_ANIMATION_METRICS_REPORTER_H_
diff --git a/chromium/ui/compositor/animation_throughput_reporter.h b/chromium/ui/compositor/animation_throughput_reporter.h
index 7fb9b665728..334a9eddee4 100644
--- a/chromium/ui/compositor/animation_throughput_reporter.h
+++ b/chromium/ui/compositor/animation_throughput_reporter.h
@@ -35,8 +35,8 @@ class LayerAnimator;
// and none of the layer animation sequences is aborted.
class COMPOSITOR_EXPORT AnimationThroughputReporter {
public:
- using ReportCallback =
- base::RepeatingCallback<void(cc::FrameSequenceMetrics::ThroughputData)>;
+ using ReportCallback = base::RepeatingCallback<void(
+ const cc::FrameSequenceMetrics::CustomReportData&)>;
AnimationThroughputReporter(LayerAnimator* animator,
ReportCallback report_callback);
AnimationThroughputReporter(const AnimationThroughputReporter&) = delete;
diff --git a/chromium/ui/compositor/animation_throughput_reporter_unittest.cc b/chromium/ui/compositor/animation_throughput_reporter_unittest.cc
index 446a57db6bf..d39b01bfdab 100644
--- a/chromium/ui/compositor/animation_throughput_reporter_unittest.cc
+++ b/chromium/ui/compositor/animation_throughput_reporter_unittest.cc
@@ -7,7 +7,7 @@
#include <memory>
#include "base/run_loop.h"
-#include "base/test/bind_test_util.h"
+#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "base/threading/thread_task_runner_handle.h"
#include "base/time/time.h"
@@ -85,7 +85,7 @@ TEST_F(AnimationThroughputReporterTest, ImplicitAnimation) {
LayerAnimator* animator = layer.GetAnimator();
AnimationThroughputReporter reporter(
animator, base::BindLambdaForTesting(
- [&](cc::FrameSequenceMetrics::ThroughputData) {
+ [&](const cc::FrameSequenceMetrics::CustomReportData&) {
run_loop.Quit();
}));
@@ -107,7 +107,7 @@ TEST_F(AnimationThroughputReporterTest, ImplicitAnimationLateAttach) {
LayerAnimator* animator = layer.GetAnimator();
AnimationThroughputReporter reporter(
animator, base::BindLambdaForTesting(
- [&](cc::FrameSequenceMetrics::ThroughputData) {
+ [&](const cc::FrameSequenceMetrics::CustomReportData&) {
run_loop.Quit();
}));
@@ -134,7 +134,7 @@ TEST_F(AnimationThroughputReporterTest, ExplicitAnimation) {
LayerAnimator* animator = layer.GetAnimator();
AnimationThroughputReporter reporter(
animator, base::BindLambdaForTesting(
- [&](cc::FrameSequenceMetrics::ThroughputData) {
+ [&](const cc::FrameSequenceMetrics::CustomReportData&) {
run_loop.Quit();
}));
@@ -159,9 +159,10 @@ TEST_F(AnimationThroughputReporterTest, PersistedAnimation) {
std::unique_ptr<base::RunLoop> run_loop = std::make_unique<base::RunLoop>();
// |reporter| keeps reporting as long as it is alive.
AnimationThroughputReporter reporter(
- animator,
- base::BindLambdaForTesting(
- [&](cc::FrameSequenceMetrics::ThroughputData) { run_loop->Quit(); }));
+ animator, base::BindLambdaForTesting(
+ [&](const cc::FrameSequenceMetrics::CustomReportData&) {
+ run_loop->Quit();
+ }));
// Report data for animation of opacity goes to 1.
layer->SetOpacity(1.0f);
@@ -183,7 +184,7 @@ TEST_F(AnimationThroughputReporterTest, AbortedAnimation) {
LayerAnimator* animator = layer->GetAnimator();
AnimationThroughputReporter reporter(
animator, base::BindLambdaForTesting(
- [&](cc::FrameSequenceMetrics::ThroughputData) {
+ [&](const cc::FrameSequenceMetrics::CustomReportData&) {
ADD_FAILURE() << "No report for aborted animations.";
}));
@@ -213,7 +214,7 @@ TEST_F(AnimationThroughputReporterTest, NoReportOnDetach) {
LayerAnimator* animator = layer->GetAnimator();
AnimationThroughputReporter reporter(
animator, base::BindLambdaForTesting(
- [&](cc::FrameSequenceMetrics::ThroughputData) {
+ [&](const cc::FrameSequenceMetrics::CustomReportData&) {
ADD_FAILURE() << "No report for aborted animations.";
}));
@@ -246,7 +247,7 @@ TEST_F(AnimationThroughputReporterTest, EndDetachedNoReportNoLeak) {
{
AnimationThroughputReporter reporter(
animator, base::BindLambdaForTesting(
- [&](cc::FrameSequenceMetrics::ThroughputData) {
+ [&](const cc::FrameSequenceMetrics::CustomReportData&) {
ADD_FAILURE() << "No report for aborted animations.";
}));
@@ -282,7 +283,7 @@ TEST_F(AnimationThroughputReporterTest, ReportForAnimateToNewTarget) {
{
AnimationThroughputReporter reporter(
animator, base::BindLambdaForTesting(
- [&](cc::FrameSequenceMetrics::ThroughputData) {
+ [&](const cc::FrameSequenceMetrics::CustomReportData&) {
ADD_FAILURE() << "No report for aborted animations.";
}));
@@ -297,7 +298,7 @@ TEST_F(AnimationThroughputReporterTest, ReportForAnimateToNewTarget) {
{
AnimationThroughputReporter reporter(
animator, base::BindLambdaForTesting(
- [&](cc::FrameSequenceMetrics::ThroughputData) {
+ [&](const cc::FrameSequenceMetrics::CustomReportData&) {
run_loop.Quit();
}));
diff --git a/chromium/ui/compositor/canvas_painter.cc b/chromium/ui/compositor/canvas_painter.cc
index 31c4cabdc1f..b5b0b9c7f10 100644
--- a/chromium/ui/compositor/canvas_painter.cc
+++ b/chromium/ui/compositor/canvas_painter.cc
@@ -31,7 +31,7 @@ CanvasPainter::~CanvasPainter() {
if (!output_->tryAllocPixels(info))
return;
- SkCanvas canvas(*output_);
+ SkCanvas canvas(*output_, SkSurfaceProps{});
canvas.clear(clear_color_);
// When pixel canvas is enabled, the recordings and canvas are already scaled
diff --git a/chromium/ui/compositor/compositor.cc b/chromium/ui/compositor/compositor.cc
index 975f7729f93..7d498732553 100644
--- a/chromium/ui/compositor/compositor.cc
+++ b/chromium/ui/compositor/compositor.cc
@@ -674,7 +674,7 @@ Compositor::GetBeginMainFrameMetrics() {
void Compositor::NotifyThroughputTrackerResults(
cc::CustomTrackerResults results) {
for (auto& pair : results)
- ReportThroughputForTracker(pair.first, std::move(pair.second));
+ ReportMetricsForTracker(pair.first, std::move(pair.second));
}
void Compositor::DidReceiveCompositorFrameAck() {
@@ -689,6 +689,8 @@ void Compositor::DidPresentCompositorFrame(
TRACE_EVENT_MARK_WITH_TIMESTAMP1("cc,benchmark", "FramePresented",
feedback.timestamp, "environment",
"browser");
+ for (auto& observer : observer_list_)
+ observer.OnDidPresentCompositorFrame(frame_token, feedback);
}
void Compositor::DidSubmitCompositorFrame() {
@@ -757,14 +759,14 @@ void Compositor::RequestPresentationTimeForNextFrame(
host_->RequestPresentationTimeForNextFrame(std::move(callback));
}
-void Compositor::ReportThroughputForTracker(
+void Compositor::ReportMetricsForTracker(
int tracker_id,
- cc::FrameSequenceMetrics::ThroughputData throughput) {
+ const cc::FrameSequenceMetrics::CustomReportData& data) {
auto it = throughput_tracker_map_.find(tracker_id);
if (it == throughput_tracker_map_.end())
return;
- std::move(it->second).Run(std::move(throughput));
+ std::move(it->second).Run(data);
throughput_tracker_map_.erase(it);
}
diff --git a/chromium/ui/compositor/compositor.h b/chromium/ui/compositor/compositor.h
index 32cdffd116b..dc011fe48e2 100644
--- a/chromium/ui/compositor/compositor.h
+++ b/chromium/ui/compositor/compositor.h
@@ -406,10 +406,10 @@ class COMPOSITOR_EXPORT Compositor : public cc::LayerTreeHostClient,
private:
friend class base::RefCounted<Compositor>;
- // Called when throughput data for the tracker of |tracker_id| is ready.
- void ReportThroughputForTracker(
+ // Called when collected metrics for the tracker of |tracker_id| is ready.
+ void ReportMetricsForTracker(
int tracker_id,
- cc::FrameSequenceMetrics::ThroughputData throughput);
+ const cc::FrameSequenceMetrics::CustomReportData& data);
gfx::Size size_;
diff --git a/chromium/ui/compositor/compositor_observer.h b/chromium/ui/compositor/compositor_observer.h
index a5d845d5870..5855c94b799 100644
--- a/chromium/ui/compositor/compositor_observer.h
+++ b/chromium/ui/compositor/compositor_observer.h
@@ -11,7 +11,8 @@
namespace gfx {
class Size;
-}
+struct PresentationFeedback;
+} // namespace gfx
namespace ui {
@@ -51,6 +52,11 @@ class COMPOSITOR_EXPORT CompositorObserver {
// Called at the top of the compositor's destructor, to give observers a
// chance to remove themselves.
virtual void OnCompositingShuttingDown(Compositor* compositor) {}
+
+ // Called when the presentation feedback was received from the viz.
+ virtual void OnDidPresentCompositorFrame(
+ uint32_t frame_token,
+ const gfx::PresentationFeedback& feedback) {}
};
} // namespace ui
diff --git a/chromium/ui/compositor/compositor_unittest.cc b/chromium/ui/compositor/compositor_unittest.cc
index 469faab2ab2..242a508436d 100644
--- a/chromium/ui/compositor/compositor_unittest.cc
+++ b/chromium/ui/compositor/compositor_unittest.cc
@@ -7,7 +7,7 @@
#include "base/macros.h"
#include "base/run_loop.h"
#include "base/single_thread_task_runner.h"
-#include "base/test/bind_test_util.h"
+#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "base/test/test_mock_time_task_runner.h"
#include "base/threading/thread_task_runner_handle.h"
@@ -177,7 +177,7 @@ TEST_F(CompositorTestWithMessageLoop, MoveThroughputTracker) {
{
auto tracker = compositor()->RequestNewThroughputTracker();
tracker.Start(base::BindLambdaForTesting(
- [&](cc::FrameSequenceMetrics::ThroughputData throughput) {
+ [&](const cc::FrameSequenceMetrics::CustomReportData& data) {
// This should not be called since the tracking is auto canceled.
ADD_FAILURE();
}));
@@ -188,7 +188,7 @@ TEST_F(CompositorTestWithMessageLoop, MoveThroughputTracker) {
{
auto tracker = compositor()->RequestNewThroughputTracker();
tracker.Start(base::BindLambdaForTesting(
- [&](cc::FrameSequenceMetrics::ThroughputData throughput) {
+ [&](const cc::FrameSequenceMetrics::CustomReportData& data) {
// May be called since Stop() is called.
}));
auto moved_tracker = std::move(tracker);
@@ -199,7 +199,7 @@ TEST_F(CompositorTestWithMessageLoop, MoveThroughputTracker) {
{
auto tracker = compositor()->RequestNewThroughputTracker();
tracker.Start(base::BindLambdaForTesting(
- [&](cc::FrameSequenceMetrics::ThroughputData throughput) {
+ [&](const cc::FrameSequenceMetrics::CustomReportData& data) {
// This should not be called since Cancel() is called.
ADD_FAILURE();
}));
@@ -211,7 +211,7 @@ TEST_F(CompositorTestWithMessageLoop, MoveThroughputTracker) {
{
auto tracker = compositor()->RequestNewThroughputTracker();
tracker.Start(base::BindLambdaForTesting(
- [&](cc::FrameSequenceMetrics::ThroughputData throughput) {
+ [&](const cc::FrameSequenceMetrics::CustomReportData& data) {
// May be called since Stop() is called.
}));
tracker.Stop();
@@ -222,7 +222,7 @@ TEST_F(CompositorTestWithMessageLoop, MoveThroughputTracker) {
{
auto tracker = compositor()->RequestNewThroughputTracker();
tracker.Start(base::BindLambdaForTesting(
- [&](cc::FrameSequenceMetrics::ThroughputData throughput) {
+ [&](const cc::FrameSequenceMetrics::CustomReportData& data) {
// This should not be called since Cancel() is called.
ADD_FAILURE();
}));
@@ -245,9 +245,9 @@ TEST_F(CompositorTestWithMessageLoop, ThroughputTracker) {
base::RunLoop run_loop;
tracker.Start(base::BindLambdaForTesting(
- [&](cc::FrameSequenceMetrics::ThroughputData throughput) {
- EXPECT_GT(throughput.frames_expected, 0u);
- EXPECT_GT(throughput.frames_produced, 0u);
+ [&](const cc::FrameSequenceMetrics::CustomReportData& data) {
+ EXPECT_GT(data.frames_expected, 0u);
+ EXPECT_GT(data.frames_produced, 0u);
run_loop.Quit();
}));
@@ -273,7 +273,7 @@ TEST_F(CompositorTestWithMessageLoop, ThroughputTracker) {
TEST_F(CompositorTestWithMessageLoop, ThroughputTrackerOutliveCompositor) {
auto tracker = compositor()->RequestNewThroughputTracker();
tracker.Start(base::BindLambdaForTesting(
- [&](cc::FrameSequenceMetrics::ThroughputData throughput) {
+ [&](const cc::FrameSequenceMetrics::CustomReportData& data) {
ADD_FAILURE() << "No report should happen";
}));
diff --git a/chromium/ui/compositor/layer.cc b/chromium/ui/compositor/layer.cc
index cbba0873e2f..2013423958d 100644
--- a/chromium/ui/compositor/layer.cc
+++ b/chromium/ui/compositor/layer.cc
@@ -281,6 +281,9 @@ std::unique_ptr<Layer> Layer::Clone() const {
clone->SetIsFastRoundedCorner(is_fast_rounded_corner());
clone->SetName(name_);
+ // the |damaged_region_| will be sent to cc later in SendDamagedRects().
+ clone->damaged_region_ = damaged_region_;
+
return clone;
}
@@ -1300,8 +1303,7 @@ gfx::Rect Layer::PaintableRegion() {
return gfx::Rect(size());
}
-scoped_refptr<cc::DisplayItemList> Layer::PaintContentsToDisplayList(
- ContentLayerClient::PaintingControlSetting painting_control) {
+scoped_refptr<cc::DisplayItemList> Layer::PaintContentsToDisplayList() {
TRACE_EVENT1("ui", "Layer::PaintContentsToDisplayList", "name", name_);
gfx::Rect local_bounds(bounds().size());
gfx::Rect invalidation(
@@ -1322,12 +1324,6 @@ scoped_refptr<cc::DisplayItemList> Layer::PaintContentsToDisplayList(
bool Layer::FillsBoundsCompletely() const { return fills_bounds_completely_; }
-size_t Layer::GetApproximateUnsharedMemoryUsage() const {
- // Most of the "picture memory" is shared with the cc::DisplayItemList, so
- // there's nothing significant to report here.
- return 0;
-}
-
bool Layer::PrepareTransferableResource(
cc::SharedBitmapIdRegistrar* bitmap_registar,
viz::TransferableResource* resource,
diff --git a/chromium/ui/compositor/layer.h b/chromium/ui/compositor/layer.h
index 8290f3f7397..62d5959a60a 100644
--- a/chromium/ui/compositor/layer.h
+++ b/chromium/ui/compositor/layer.h
@@ -441,10 +441,8 @@ class COMPOSITOR_EXPORT Layer : public LayerAnimationDelegate,
// ContentLayerClient implementation.
gfx::Rect PaintableRegion() override;
- scoped_refptr<cc::DisplayItemList> PaintContentsToDisplayList(
- ContentLayerClient::PaintingControlSetting painting_control) override;
+ scoped_refptr<cc::DisplayItemList> PaintContentsToDisplayList() override;
bool FillsBoundsCompletely() const override;
- size_t GetApproximateUnsharedMemoryUsage() const override;
cc::MirrorLayer* mirror_layer_for_testing() { return mirror_layer_.get(); }
cc::Layer* cc_layer_for_testing() { return cc_layer_; }
diff --git a/chromium/ui/compositor/layer_animation_element.cc b/chromium/ui/compositor/layer_animation_element.cc
index 3c5207f7c65..c8aac298abb 100644
--- a/chromium/ui/compositor/layer_animation_element.cc
+++ b/chromium/ui/compositor/layer_animation_element.cc
@@ -11,7 +11,6 @@
#include "base/strings/stringprintf.h"
#include "cc/animation/animation_id_provider.h"
#include "cc/animation/keyframe_model.h"
-#include "ui/compositor/animation_metrics_recorder.h"
#include "ui/compositor/float_animation_curve_adapter.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animation_delegate.h"
@@ -597,11 +596,6 @@ void LayerAnimationElement::Start(LayerAnimationDelegate* delegate,
OnStart(delegate);
RequestEffectiveStart(delegate);
first_frame_ = false;
-
- if (animation_metrics_recorder_ && delegate) {
- animation_metrics_recorder_->OnAnimationStart(
- delegate->GetFrameNumber(), effective_start_time_, duration_);
- }
}
bool LayerAnimationElement::Progress(base::TimeTicks now,
@@ -659,11 +653,6 @@ bool LayerAnimationElement::ProgressToEnd(LayerAnimationDelegate* delegate) {
base::WeakPtr<LayerAnimationElement> alive(weak_ptr_factory_.GetWeakPtr());
bool need_draw = OnProgress(1.0, delegate);
- if (animation_metrics_recorder_ && delegate) {
- animation_metrics_recorder_->OnAnimationEnd(delegate->GetFrameNumber(),
- delegate->GetRefreshRate());
- }
-
if (!alive)
return need_draw;
last_progressed_fraction_ = 1.0;
@@ -675,27 +664,6 @@ void LayerAnimationElement::GetTargetValue(TargetValue* target) const {
OnGetTarget(target);
}
-void LayerAnimationElement::SetAnimationMetricsReporter(
- AnimationMetricsReporter* reporter) {
- if (reporter) {
- animation_metrics_recorder_ =
- std::make_unique<AnimationMetricsRecorder>(reporter);
- } else {
- animation_metrics_recorder_.reset();
- }
-}
-
-void LayerAnimationElement::OnAnimatorAttached(
- LayerAnimationDelegate* delegate) {
- if (animation_metrics_recorder_)
- animation_metrics_recorder_->OnAnimatorAttached(delegate->GetFrameNumber());
-}
-
-void LayerAnimationElement::OnAnimatorDetached() {
- if (animation_metrics_recorder_)
- animation_metrics_recorder_->OnAnimatorDetached();
-}
-
bool LayerAnimationElement::IsThreaded(LayerAnimationDelegate* delegate) const {
return false;
}
diff --git a/chromium/ui/compositor/layer_animation_element.h b/chromium/ui/compositor/layer_animation_element.h
index 016a98fbd51..13ff9577ec2 100644
--- a/chromium/ui/compositor/layer_animation_element.h
+++ b/chromium/ui/compositor/layer_animation_element.h
@@ -24,8 +24,6 @@
namespace ui {
-class AnimationMetricsReporter;
-class AnimationMetricsRecorder;
class InterpolatedTransform;
class LayerAnimationDelegate;
@@ -196,14 +194,6 @@ class COMPOSITOR_EXPORT LayerAnimationElement {
// Assigns the target value to |target|.
void GetTargetValue(TargetValue* target) const;
- // Sets the reporter to report animation metrics if |reporter| is not null.
- // Otherwise, cancels the metric reporting.
- void SetAnimationMetricsReporter(AnimationMetricsReporter* reporter);
-
- // Called when the animator is attached to/detached from a Compositor.
- void OnAnimatorAttached(LayerAnimationDelegate* delegate);
- void OnAnimatorDetached();
-
// The properties that the element modifies.
AnimatableProperties properties() const { return properties_; }
@@ -263,8 +253,6 @@ class COMPOSITOR_EXPORT LayerAnimationElement {
double last_progressed_fraction_;
- std::unique_ptr<AnimationMetricsRecorder> animation_metrics_recorder_;
-
base::WeakPtrFactory<LayerAnimationElement> weak_ptr_factory_{this};
DISALLOW_ASSIGN(LayerAnimationElement);
diff --git a/chromium/ui/compositor/layer_animation_sequence.cc b/chromium/ui/compositor/layer_animation_sequence.cc
index e25e1c34541..25d73903cb8 100644
--- a/chromium/ui/compositor/layer_animation_sequence.cc
+++ b/chromium/ui/compositor/layer_animation_sequence.cc
@@ -22,8 +22,7 @@ LayerAnimationSequence::LayerAnimationSequence()
last_element_(0),
waiting_for_group_start_(false),
animation_group_id_(0),
- last_progressed_fraction_(0.0),
- animation_metrics_reporter_(nullptr) {}
+ last_progressed_fraction_(0.0) {}
LayerAnimationSequence::LayerAnimationSequence(
std::unique_ptr<LayerAnimationElement> element)
@@ -32,8 +31,7 @@ LayerAnimationSequence::LayerAnimationSequence(
last_element_(0),
waiting_for_group_start_(false),
animation_group_id_(0),
- last_progressed_fraction_(0.0),
- animation_metrics_reporter_(nullptr) {
+ last_progressed_fraction_(0.0) {
AddElement(std::move(element));
}
@@ -186,7 +184,6 @@ void LayerAnimationSequence::Abort(LayerAnimationDelegate* delegate) {
void LayerAnimationSequence::AddElement(
std::unique_ptr<LayerAnimationElement> element) {
properties_ |= element->properties();
- element->SetAnimationMetricsReporter(animation_metrics_reporter_);
elements_.push_back(std::move(element));
}
@@ -247,35 +244,22 @@ void LayerAnimationSequence::OnAnimatorDestroyed() {
void LayerAnimationSequence::OnAnimatorAttached(
LayerAnimationDelegate* delegate) {
- for (auto& element : elements_)
- element->OnAnimatorAttached(delegate);
-
for (LayerAnimationObserver& observer : observers_)
observer.OnAnimatorAttachedToTimeline();
}
void LayerAnimationSequence::OnAnimatorDetached() {
- for (auto& element : elements_)
- element->OnAnimatorDetached();
-
for (LayerAnimationObserver& observer : observers_)
observer.OnAnimatorDetachedFromTimeline();
}
-void LayerAnimationSequence::SetAnimationMetricsReporter(
- AnimationMetricsReporter* reporter) {
- animation_metrics_reporter_ = reporter;
- for (auto& element : elements_)
- element->SetAnimationMetricsReporter(animation_metrics_reporter_);
-}
-
size_t LayerAnimationSequence::size() const {
return elements_.size();
}
LayerAnimationElement* LayerAnimationSequence::FirstElement() const {
if (elements_.empty()) {
- return NULL;
+ return nullptr;
}
return elements_[0].get();
diff --git a/chromium/ui/compositor/layer_animation_sequence.h b/chromium/ui/compositor/layer_animation_sequence.h
index 89f575d3162..88208f1e4e7 100644
--- a/chromium/ui/compositor/layer_animation_sequence.h
+++ b/chromium/ui/compositor/layer_animation_sequence.h
@@ -131,9 +131,6 @@ class COMPOSITOR_EXPORT LayerAnimationSequence
void OnAnimatorAttached(LayerAnimationDelegate* delegate);
void OnAnimatorDetached();
- // Sets |animation_metrics_reporter_| and passes it to all |elements_|.
- void SetAnimationMetricsReporter(AnimationMetricsReporter* reporter);
-
// The last_progressed_fraction of the element most recently progressed by
// by this sequence. Returns 0.0 if no elements have been progressed.
double last_progressed_fraction() const { return last_progressed_fraction_; }
@@ -202,9 +199,6 @@ class COMPOSITOR_EXPORT LayerAnimationSequence
// element.
double last_progressed_fraction_;
- // Used to tag animation elements to obtain metrics of animation performance.
- AnimationMetricsReporter* animation_metrics_reporter_;
-
DISALLOW_COPY_AND_ASSIGN(LayerAnimationSequence);
};
diff --git a/chromium/ui/compositor/layer_animator.cc b/chromium/ui/compositor/layer_animator.cc
index a9db6922b89..c200f61ebe0 100644
--- a/chromium/ui/compositor/layer_animator.cc
+++ b/chromium/ui/compositor/layer_animator.cc
@@ -53,8 +53,7 @@ LayerAnimator::LayerAnimator(base::TimeDelta transition_duration)
tween_type_(gfx::Tween::LINEAR),
is_started_(false),
disable_timer_for_test_(false),
- adding_animations_(false),
- animation_metrics_reporter_(nullptr) {
+ adding_animations_(false) {
animation_ =
cc::Animation::Create(cc::AnimationIdProvider::NextAnimationId());
}
@@ -214,8 +213,6 @@ cc::Animation* LayerAnimator::GetAnimationForTesting() const {
void LayerAnimator::StartAnimation(LayerAnimationSequence* animation) {
scoped_refptr<LayerAnimator> retain(this);
- if (animation_metrics_reporter_)
- animation->SetAnimationMetricsReporter(animation_metrics_reporter_);
OnScheduled(animation);
if (!StartSequenceImmediately(animation)) {
// Attempt to preempt a running animation.
diff --git a/chromium/ui/compositor/layer_animator.h b/chromium/ui/compositor/layer_animator.h
index fe4cb76be33..8c02356a38a 100644
--- a/chromium/ui/compositor/layer_animator.h
+++ b/chromium/ui/compositor/layer_animator.h
@@ -387,10 +387,6 @@ class COMPOSITOR_EXPORT LayerAnimator : public base::RefCounted<LayerAnimator>,
void AttachLayerToAnimation(int layer_id);
void DetachLayerFromAnimation();
- void set_animation_metrics_reporter(AnimationMetricsReporter* reporter) {
- animation_metrics_reporter_ = reporter;
- }
-
// This is the queue of animations to run.
AnimationQueue animation_queue_;
@@ -430,9 +426,6 @@ class COMPOSITOR_EXPORT LayerAnimator : public base::RefCounted<LayerAnimator>,
// with preemption strategies that discard previous animations.
bool adding_animations_;
- // Helper to output UMA performance metrics.
- AnimationMetricsReporter* animation_metrics_reporter_;
-
// Observers are notified when layer animations end, are scheduled or are
// aborted.
base::ObserverList<LayerAnimationObserver>::Unchecked observers_;
diff --git a/chromium/ui/compositor/layer_animator_unittest.cc b/chromium/ui/compositor/layer_animator_unittest.cc
index 1aa26315d36..3e86fb5ac66 100644
--- a/chromium/ui/compositor/layer_animator_unittest.cc
+++ b/chromium/ui/compositor/layer_animator_unittest.cc
@@ -20,7 +20,6 @@
#include "cc/trees/layer_tree_host.h"
#include "cc/trees/mutator_host.h"
#include "testing/gtest/include/gtest/gtest.h"
-#include "ui/compositor/animation_metrics_reporter.h"
#include "ui/compositor/layer.h"
#include "ui/compositor/layer_animation_delegate.h"
#include "ui/compositor/layer_animation_element.h"
@@ -3371,184 +3370,6 @@ TEST(LayerAnimatorTest, ThreadedAnimationSurvivesIfLayerRemovedAdded) {
host.reset();
}
-// A simple AnimationMetricsReporter class that remembers smoothness metric
-// when animation completes.
-class TestMetricsReporter : public ui::AnimationMetricsReporter {
- public:
- TestMetricsReporter() {}
- ~TestMetricsReporter() override {}
-
- bool report_called() { return report_called_; }
- int value() const { return value_; }
-
- protected:
- void Report(int value) override {
- value_ = value;
- report_called_ = true;
- }
-
- private:
- bool report_called_ = false;
- int value_ = -1;
-
- DISALLOW_COPY_AND_ASSIGN(TestMetricsReporter);
-};
-
-// Starts an animation and tests that incrementing compositor frame count can
-// be used to report animation smoothness metrics. This verifies that when an
-// animation is smooth (frame count matches refresh rate) that we receive a
-// smoothness value of 100.
-TEST(LayerAnimatorTest, ReportMetricsSmooth) {
- base::ScopedMockClockOverride mock_clock_;
- const base::TimeDelta kAnimationDuration =
- base::TimeDelta::FromMilliseconds(100);
-
- std::unique_ptr<Layer> root(new Layer(LAYER_SOLID_COLOR));
- TestLayerAnimationDelegate delegate;
- scoped_refptr<LayerAnimator> animator(CreateImplicitTestAnimator(&delegate));
-
- // Simulates that Layer has attached to a Compositor.
- delegate.SetFrameNumber(0);
-
- std::unique_ptr<ui::LayerAnimationElement> animation_element =
- ui::LayerAnimationElement::CreateColorElement(SK_ColorRED,
- kAnimationDuration);
- ui::LayerAnimationSequence* animation_sequence =
- new ui::LayerAnimationSequence(std::move(animation_element));
- TestMetricsReporter reporter;
-
- animation_sequence->SetAnimationMetricsReporter(&reporter);
- animator->StartAnimation(animation_sequence);
- // Advances the frame count, simulating having produced 6 frames, and received
- // an ack for each one. This implicitly simulates calling LayerAnimator::Step
- // with an increased clock 6 times.
- delegate.SetFrameNumber(6);
-
- // Advancing the clock does not implicitly advance frame count. It allows the
- // next call of LayerAnimator::Step to detect that the animation is finished,
- // thus triggering the processing of metrics reporting.
- mock_clock_.Advance(kAnimationDuration);
- animator->Step(mock_clock_.NowTicks());
-
- CHECK(reporter.report_called());
- // With the clock being controlled, the animations should be smooth regardless
- // of the test bots. Smoothness is based on a calculated duration of the
- // animation when compared to the requested duration, as an integer
- // percentage. With 100 being 100%. When the number of frames match the
- // refresh rate, reporter should be notified of a smoothness of 100.
- EXPECT_EQ(reporter.value(), 100);
-}
-
-// Starts an animation and tests that incrementing compositor frame count can
-// be used to report animation smoothness metrics. This verifies that when an
-// animation is not smooth (frame count doesn't match refresh rate) that we
-// receive a smoothness value that is not 100.
-TEST(LayerAnimatorTest, ReportMetricsNotSmooth) {
- base::ScopedMockClockOverride mock_clock_;
- const base::TimeDelta kAnimationDuration =
- base::TimeDelta::FromMilliseconds(100);
-
- std::unique_ptr<Layer> root(new Layer(LAYER_SOLID_COLOR));
- TestLayerAnimationDelegate delegate;
- scoped_refptr<LayerAnimator> animator(CreateImplicitTestAnimator(&delegate));
-
- // Simulates that Layer has attached to a Compositor.
- delegate.SetFrameNumber(0);
-
- std::unique_ptr<ui::LayerAnimationElement> animation_element =
- ui::LayerAnimationElement::CreateColorElement(SK_ColorRED,
- kAnimationDuration);
- ui::LayerAnimationSequence* animation_sequence =
- new ui::LayerAnimationSequence(std::move(animation_element));
- TestMetricsReporter reporter;
-
- animation_sequence->SetAnimationMetricsReporter(&reporter);
- animator->StartAnimation(animation_sequence);
- // Advances the frame count, simulating having produced 1 frame, and received
- // an ack for it. This implicitly simulates calling LayerAnimator::Step with
- // an increased clock 1 time.
- delegate.SetFrameNumber(1);
-
- // Advancing the clock does not implicitly advance frame count. It allows the
- // next call of LayerAnimator::Step to detect that the animation is finished,
- // thus triggering the processing of metrics reporting.
- mock_clock_.Advance(kAnimationDuration);
- animator->Step(mock_clock_.NowTicks());
-
- CHECK(reporter.report_called());
- // With the clock being controlled, we have direct control of the smoothness
- // regardless of the test bots. Smoothness is based on a calculated duration
- // of the animation when compared to the requested duration, as an integer
- // percentage. With 100 being 100%. With a single frame being generated over
- // 100ms, the reporter should be notified of a smoothness matching the
- // interval between refreshes.
- int expected = base::Time::kMillisecondsPerSecond / delegate.GetRefreshRate();
- EXPECT_EQ(reporter.value(), expected);
-}
-
-// Tests that metrics is reported correctly as not smooth when animation starts
-// before Layer is attached to a Compositor.
-TEST(LayerAnimatorTest,
- ReportMetricsNotSmoothForAnimationStartsBeforeAttached) {
- base::test::TaskEnvironment task_environment_(
- base::test::TaskEnvironment::MainThreadType::UI);
- const bool enable_pixel_output = false;
- TestContextFactories context_factories(enable_pixel_output);
- const gfx::Rect bounds(10, 10, 100, 100);
- std::unique_ptr<TestCompositorHost> host(TestCompositorHost::Create(
- bounds, context_factories.GetContextFactory()));
- host->Show();
-
- Compositor* compositor = host->GetCompositor();
- Layer root;
- compositor->SetRootLayer(&root);
-
- constexpr auto kAnimationDuration = base::TimeDelta::FromMilliseconds(50);
-
- // Draw enough frames so that missing the start frame number would cause the
- // reporter to always report 100% smoothness. 4 times of the expected
- // animation frames because somehow the refresh rate changes from 60fps to
- // 200fps when reporting.
- const int kStartFrameNumber =
- base::ClampFloor(kAnimationDuration.InSecondsF() *
- compositor->refresh_rate()) *
- 4;
- while (compositor->activated_frame_count() < kStartFrameNumber) {
- compositor->ScheduleFullRedraw();
- EXPECT_TRUE(ui::WaitForNextFrameToBePresented(compositor));
- }
-
- Layer layer;
- layer.SetBounds(gfx::Rect(0, 0, 5, 5));
-
- TestImplicitAnimationObserver waiter(false);
- TestMetricsReporter reporter;
- {
- // Starts an animation before |layer| is attached.
- ScopedLayerAnimationSettings settings(layer.GetAnimator());
- settings.SetAnimationMetricsReporter(&reporter);
- settings.AddObserver(&waiter);
- settings.SetTransitionDuration(kAnimationDuration);
- layer.SetBounds(gfx::Rect(0, 0, 50, 50));
- }
-
- // Attaches |layer|.
- root.Add(&layer);
-
- // Blocks UI thread for kAnimationDuration to make animation not smooth.
- base::TimeTicks start = base::TimeTicks::Now();
- do {
- base::PlatformThread::Sleep(kAnimationDuration);
- } while (base::TimeTicks::Now() - start < kAnimationDuration);
-
- // Waits for the animation to finish.
- waiter.Wait();
-
- // Metrics should be reported as not smooth.
- EXPECT_TRUE(reporter.report_called());
- EXPECT_LT(reporter.value(), 100);
-}
-
class LayerOwnerAnimationObserver : public LayerAnimationObserver {
public:
explicit LayerOwnerAnimationObserver(LayerAnimator* animator)
diff --git a/chromium/ui/compositor/layer_unittest.cc b/chromium/ui/compositor/layer_unittest.cc
index fc21b32d1f3..b4db7e46388 100644
--- a/chromium/ui/compositor/layer_unittest.cc
+++ b/chromium/ui/compositor/layer_unittest.cc
@@ -22,7 +22,7 @@
#include "base/strings/string_util.h"
#include "base/strings/stringprintf.h"
#include "base/strings/utf_string_conversions.h"
-#include "base/test/bind_test_util.h"
+#include "base/test/bind.h"
#include "base/test/task_environment.h"
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
@@ -841,6 +841,25 @@ TEST_F(LayerWithDelegateTest, Cloning) {
EXPECT_EQ(SK_ColorGREEN, clone->background_color());
}
+TEST_F(LayerWithDelegateTest, CloneDamagedRegion) {
+ std::unique_ptr<Layer> layer = CreateLayer(LAYER_TEXTURED);
+ // Set a delegate so that the damage region is accumulated.
+ DrawTreeLayerDelegate delegate(gfx::Rect(0, 0, 10, 10));
+ layer->set_delegate(&delegate);
+
+ cc::Region damaged_region;
+ damaged_region.Union(gfx::Rect(10, 10, 5, 5));
+ damaged_region.Union(gfx::Rect(20, 20, 7, 7));
+
+ for (auto rect : damaged_region)
+ layer->SchedulePaint(rect);
+
+ ASSERT_EQ(damaged_region, layer->damaged_region());
+
+ auto clone = layer->Clone();
+ EXPECT_EQ(damaged_region, clone->damaged_region());
+}
+
TEST_F(LayerWithDelegateTest, Mirroring) {
std::unique_ptr<Layer> root = CreateNoTextureLayer(gfx::Rect(0, 0, 100, 100));
std::unique_ptr<Layer> child = CreateLayer(LAYER_TEXTURED);
@@ -1431,8 +1450,7 @@ TEST_F(LayerWithNullDelegateTest, UpdateDamageInDeferredPaint) {
EXPECT_EQ(bound1, root->damaged_region_for_testing());
root->SendDamagedRects();
EXPECT_EQ(gfx::Rect(), root->cc_layer_for_testing()->update_rect());
- root->PaintContentsToDisplayList(
- cc::ContentLayerClient::PAINTING_BEHAVIOR_NORMAL);
+ root->PaintContentsToDisplayList();
EXPECT_EQ(gfx::Rect(), LastInvalidation());
// During deferring paint request, a new invalid_rect will be accumulated.
@@ -1443,8 +1461,7 @@ TEST_F(LayerWithNullDelegateTest, UpdateDamageInDeferredPaint) {
EXPECT_EQ(bound_union, root->damaged_region_for_testing().bounds());
root->SendDamagedRects();
EXPECT_EQ(gfx::Rect(), root->cc_layer_for_testing()->update_rect());
- root->PaintContentsToDisplayList(
- cc::ContentLayerClient::PAINTING_BEHAVIOR_NORMAL);
+ root->PaintContentsToDisplayList();
EXPECT_EQ(gfx::Rect(), LastInvalidation());
// Remove deferring paint request.
@@ -1454,8 +1471,7 @@ TEST_F(LayerWithNullDelegateTest, UpdateDamageInDeferredPaint) {
// paint, i.e. union of bound1 and bound2.
root->SendDamagedRects();
EXPECT_EQ(bound_union, root->cc_layer_for_testing()->update_rect());
- root->PaintContentsToDisplayList(
- cc::ContentLayerClient::PAINTING_BEHAVIOR_NORMAL);
+ root->PaintContentsToDisplayList();
EXPECT_EQ(bound_union, LastInvalidation());
}
diff --git a/chromium/ui/compositor/recyclable_compositor_mac.cc b/chromium/ui/compositor/recyclable_compositor_mac.cc
index 35bd88b8e13..131c7d809f7 100644
--- a/chromium/ui/compositor/recyclable_compositor_mac.cc
+++ b/chromium/ui/compositor/recyclable_compositor_mac.cc
@@ -130,6 +130,8 @@ void RecyclableCompositorMacFactory::RecycleCompositor(
if (recycling_disabled_)
return;
+ // Invalidate the surface before suspending it.
+ compositor->InvalidateSurface();
compositor->accelerated_widget_mac_->SetSuspended(true);
// Make this RecyclableCompositorMac recyclable for future instances.
@@ -154,7 +156,10 @@ void RecyclableCompositorMacFactory::RecycleCompositor(
}
RecyclableCompositorMacFactory::RecyclableCompositorMacFactory()
- : weak_factory_(this) {}
+ : weak_factory_(this) {
+ if (features::IsUsingSkiaRenderer())
+ recycling_disabled_ = true;
+}
RecyclableCompositorMacFactory::~RecyclableCompositorMacFactory() = default;
diff --git a/chromium/ui/compositor/recyclable_compositor_mac.h b/chromium/ui/compositor/recyclable_compositor_mac.h
index 4c3bba1b534..fef44162753 100644
--- a/chromium/ui/compositor/recyclable_compositor_mac.h
+++ b/chromium/ui/compositor/recyclable_compositor_mac.h
@@ -43,12 +43,13 @@ class COMPOSITOR_EXPORT RecyclableCompositorMac
void UpdateSurface(const gfx::Size& size_pixels,
float scale_factor,
const gfx::DisplayColorSpaces& display_color_spaces);
- // Invalidate the compositor's surface information.
- void InvalidateSurface();
private:
friend class RecyclableCompositorMacFactory;
+ // Invalidate the compositor's surface information.
+ void InvalidateSurface();
+
// ui::CompositorObserver implementation:
void OnCompositingDidCommit(ui::Compositor* compositor) override;
diff --git a/chromium/ui/compositor/scoped_layer_animation_settings.cc b/chromium/ui/compositor/scoped_layer_animation_settings.cc
index 085b15f6a24..2fc1b18f2c6 100644
--- a/chromium/ui/compositor/scoped_layer_animation_settings.cc
+++ b/chromium/ui/compositor/scoped_layer_animation_settings.cc
@@ -120,7 +120,6 @@ ScopedLayerAnimationSettings::ScopedLayerAnimationSettings(
}
ScopedLayerAnimationSettings::~ScopedLayerAnimationSettings() {
- animator_->set_animation_metrics_reporter(nullptr);
animator_->is_transition_duration_locked_ =
old_is_transition_duration_locked_;
animator_->SetTransitionDuration(old_transition_duration_);
@@ -143,11 +142,6 @@ void ScopedLayerAnimationSettings::AddObserver(
animator_->AddObserver(observer);
}
-void ScopedLayerAnimationSettings::SetAnimationMetricsReporter(
- AnimationMetricsReporter* reporter) {
- animator_->set_animation_metrics_reporter(reporter);
-}
-
void ScopedLayerAnimationSettings::SetTransitionDuration(
base::TimeDelta duration) {
animator_->SetTransitionDuration(duration);
diff --git a/chromium/ui/compositor/scoped_layer_animation_settings.h b/chromium/ui/compositor/scoped_layer_animation_settings.h
index 6b08ebe5833..47e4cd6e57a 100644
--- a/chromium/ui/compositor/scoped_layer_animation_settings.h
+++ b/chromium/ui/compositor/scoped_layer_animation_settings.h
@@ -29,8 +29,6 @@ class COMPOSITOR_EXPORT ScopedLayerAnimationSettings {
void AddObserver(ImplicitAnimationObserver* observer);
- void SetAnimationMetricsReporter(AnimationMetricsReporter* reporter);
-
void SetTransitionDuration(base::TimeDelta duration);
base::TimeDelta GetTransitionDuration() const;
diff --git a/chromium/ui/compositor/test/test_compositor_host_ozone.cc b/chromium/ui/compositor/test/test_compositor_host_ozone.cc
index 5b2c4752932..9ebb06b5da0 100644
--- a/chromium/ui/compositor/test/test_compositor_host_ozone.cc
+++ b/chromium/ui/compositor/test/test_compositor_host_ozone.cc
@@ -67,7 +67,11 @@ TestCompositorHostOzone::TestCompositorHostOzone(
context_factory,
base::ThreadTaskRunnerHandle::Get(),
false /* enable_pixel_canvas */),
- window_delegate_(std::make_unique<StubPlatformWindowDelegate>()) {}
+ window_delegate_(std::make_unique<StubPlatformWindowDelegate>()) {
+#if defined(OS_FUCHSIA)
+ ui::PlatformWindowInitProperties::allow_null_view_token_for_test = true;
+#endif
+}
TestCompositorHostOzone::~TestCompositorHostOzone() {
// |window_| should be destroyed earlier than |window_delegate_| as it refers
diff --git a/chromium/ui/compositor/throughput_tracker_host.h b/chromium/ui/compositor/throughput_tracker_host.h
index 9082d00c4c1..d763516edb3 100644
--- a/chromium/ui/compositor/throughput_tracker_host.h
+++ b/chromium/ui/compositor/throughput_tracker_host.h
@@ -19,9 +19,9 @@ class COMPOSITOR_EXPORT ThroughputTrackerHost {
virtual ~ThroughputTrackerHost() = default;
// Starts the tracking for the given tracker id. |callback| is invoked after
- // the tracker is stopped and the throughput data is collected.
+ // the tracker is stopped and the metrics data is collected.
using ReportCallback = base::OnceCallback<void(
- const cc::FrameSequenceMetrics::ThroughputData throughput)>;
+ const cc::FrameSequenceMetrics::CustomReportData& data)>;
virtual void StartThroughputTracker(TrackerId tracker_id,
ReportCallback callback) = 0;