Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit 8d165fa

Browse files
authored
Revert multiple display support for embedder API (#21456)
This reverts commits - 67fdd7e. - 854943d. See: flutter/flutter#66829
1 parent 9db9a57 commit 8d165fa

28 files changed

Lines changed: 136 additions & 671 deletions

ci/licenses_golden/licenses_flutter

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -599,9 +599,6 @@ FILE: ../../../flutter/shell/common/animator_unittests.cc
599599
FILE: ../../../flutter/shell/common/canvas_spy.cc
600600
FILE: ../../../flutter/shell/common/canvas_spy.h
601601
FILE: ../../../flutter/shell/common/canvas_spy_unittests.cc
602-
FILE: ../../../flutter/shell/common/display.h
603-
FILE: ../../../flutter/shell/common/display_manager.cc
604-
FILE: ../../../flutter/shell/common/display_manager.h
605602
FILE: ../../../flutter/shell/common/engine.cc
606603
FILE: ../../../flutter/shell/common/engine.h
607604
FILE: ../../../flutter/shell/common/engine_unittests.cc

shell/common/BUILD.gn

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,6 @@ source_set("common") {
6464
"animator.h",
6565
"canvas_spy.cc",
6666
"canvas_spy.h",
67-
"display.h",
68-
"display_manager.cc",
69-
"display_manager.h",
7067
"engine.cc",
7168
"engine.h",
7269
"isolate_configuration.cc",

shell/common/animator.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,10 @@ Animator::Animator(Delegate& delegate,
5353

5454
Animator::~Animator() = default;
5555

56+
float Animator::GetDisplayRefreshRate() const {
57+
return waiter_->GetDisplayRefreshRate();
58+
}
59+
5660
void Animator::Stop() {
5761
paused_ = true;
5862
}

shell/common/animator.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,8 @@ class Animator final {
4747

4848
~Animator();
4949

50+
float GetDisplayRefreshRate() const;
51+
5052
void RequestFrame(bool regenerate_layer_tree = true);
5153

5254
void Render(std::unique_ptr<flutter::LayerTree> layer_tree);

shell/common/display.h

Lines changed: 0 additions & 55 deletions
This file was deleted.

shell/common/display_manager.cc

Lines changed: 0 additions & 49 deletions
This file was deleted.

shell/common/display_manager.h

Lines changed: 0 additions & 59 deletions
This file was deleted.

shell/common/engine.cc

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,10 @@ Engine::Engine(Delegate& delegate,
9797

9898
Engine::~Engine() = default;
9999

100+
float Engine::GetDisplayRefreshRate() const {
101+
return animator_->GetDisplayRefreshRate();
102+
}
103+
100104
fml::WeakPtr<Engine> Engine::GetWeakPtr() const {
101105
return weak_factory_.GetWeakPtr();
102106
}

shell/common/engine.h

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
#include "flutter/runtime/runtime_controller.h"
2525
#include "flutter/runtime/runtime_delegate.h"
2626
#include "flutter/shell/common/animator.h"
27-
#include "flutter/shell/common/display_manager.h"
2827
#include "flutter/shell/common/platform_view.h"
2928
#include "flutter/shell/common/pointer_data_dispatcher.h"
3029
#include "flutter/shell/common/rasterizer.h"
@@ -329,6 +328,30 @@ class Engine final : public RuntimeDelegate,
329328
///
330329
~Engine() override;
331330

331+
//----------------------------------------------------------------------------
332+
/// @brief Gets the refresh rate in frames per second of the vsync waiter
333+
/// used by the animator managed by this engine. This information
334+
/// is purely advisory and is not used by any component. It is
335+
/// only used by the tooling to visualize frame performance.
336+
///
337+
/// @attention The display refresh rate is useless for frame scheduling
338+
/// because it can vary and more accurate frame specific
339+
/// information is given to the engine by the vsync waiter
340+
/// already. However, this call is used by the tooling to ask very
341+
/// high level questions about display refresh rate. For example,
342+
/// "Is the display 60 or 120Hz?". This information is quite
343+
/// unreliable (not available immediately on launch on some
344+
/// platforms), variable and advisory. It must not be used by any
345+
/// component that claims to use it to perform accurate frame
346+
/// scheduling.
347+
///
348+
/// @return The display refresh rate in frames per second. This may change
349+
/// from frame to frame, throughout the lifecycle of the
350+
/// application, and, may not be available immediately upon
351+
/// application launch.
352+
///
353+
float GetDisplayRefreshRate() const;
354+
332355
//----------------------------------------------------------------------------
333356
/// @return The pointer to this instance of the engine. The engine may
334357
/// only be accessed safely on the UI task runner.

shell/common/rasterizer.h

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ class Rasterizer final : public SnapshotDelegate {
6868
///
6969
virtual void OnFrameRasterized(const FrameTiming& frame_timing) = 0;
7070

71-
/// Time limit for a smooth frame.
72-
///
73-
/// See: `DisplayManager::GetMainDisplayRefreshRate`.
71+
/// Time limit for a smooth frame. See `Engine::GetDisplayRefreshRate`.
7472
virtual fml::Milliseconds GetFrameBudget() = 0;
7573

7674
/// Target time for the latest frame. See also `Shell::OnAnimatorBeginFrame`

0 commit comments

Comments
 (0)