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

Commit cd5c494

Browse files
author
Chris Yang
committed
review
1 parent e5c4c5b commit cd5c494

File tree

11 files changed

+19
-20
lines changed

11 files changed

+19
-20
lines changed

shell/common/animator.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,8 +206,8 @@ void Animator::Render(std::unique_ptr<flutter::LayerTree> layer_tree) {
206206
std::move(frame_timings_recorder_));
207207
}
208208

209-
const std::shared_ptr<VsyncWaiter> Animator::GetVsyncWaiter() const {
210-
return waiter_;
209+
const VsyncWaiter& Animator::GetVsyncWaiter() const {
210+
return *waiter_.get();
211211
}
212212

213213
bool Animator::CanReuseLastLayerTree() {

shell/common/animator.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class Animator final {
5454

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

57-
const std::shared_ptr<VsyncWaiter> GetVsyncWaiter() const;
57+
const VsyncWaiter& GetVsyncWaiter() const;
5858

5959
//--------------------------------------------------------------------------
6060
/// @brief Schedule a secondary callback to be executed right after the

shell/common/engine.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -600,7 +600,7 @@ void Engine::LoadDartDeferredLibraryError(intptr_t loading_unit_id,
600600
}
601601
}
602602

603-
const std::shared_ptr<VsyncWaiter> Engine::GetVsyncWaiter() const {
603+
const VsyncWaiter& Engine::GetVsyncWaiter() const {
604604
return animator_->GetVsyncWaiter();
605605
}
606606

shell/common/engine.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -903,7 +903,7 @@ class Engine final : public RuntimeDelegate, PointerDataDispatcher::Delegate {
903903
return runtime_controller_.get();
904904
}
905905

906-
const std::shared_ptr<VsyncWaiter> GetVsyncWaiter() const;
906+
const VsyncWaiter& GetVsyncWaiter() const;
907907

908908
private:
909909
// |RuntimeDelegate|

shell/common/shell.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1872,7 +1872,7 @@ Shell::GetPlatformMessageHandler() const {
18721872
return platform_message_handler_;
18731873
}
18741874

1875-
const std::shared_ptr<VsyncWaiter> Shell::GetVsyncWaiter() const {
1875+
const VsyncWaiter& Shell::GetVsyncWaiter() const {
18761876
return engine_->GetVsyncWaiter();
18771877
}
18781878

shell/common/shell.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@ class Shell final : public PlatformView::Delegate,
401401
const std::shared_ptr<PlatformMessageHandler>& GetPlatformMessageHandler()
402402
const;
403403

404-
const std::shared_ptr<VsyncWaiter> GetVsyncWaiter() const;
404+
const VsyncWaiter& GetVsyncWaiter() const;
405405

406406
private:
407407
using ServiceProtocolHandler =

shell/common/variable_refresh_rate_display.cc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,17 @@ namespace flutter {
99

1010
VariableRefreshRateDisplay::VariableRefreshRateDisplay(
1111
DisplayId display_id,
12-
std::shared_ptr<VariableRefreshRateReporter> refresh_rate_reporter)
13-
: Display(display_id, refresh_rate_reporter->GetRefreshRate()),
12+
const VariableRefreshRateReporter& refresh_rate_reporter)
13+
: Display(display_id, refresh_rate_reporter.GetRefreshRate()),
1414
refresh_rate_reporter_(refresh_rate_reporter) {}
1515

1616
VariableRefreshRateDisplay::VariableRefreshRateDisplay(
17-
std::shared_ptr<VariableRefreshRateReporter> refresh_rate_reporter)
18-
: Display(refresh_rate_reporter->GetRefreshRate()),
17+
const VariableRefreshRateReporter& refresh_rate_reporter)
18+
: Display(refresh_rate_reporter.GetRefreshRate()),
1919
refresh_rate_reporter_(refresh_rate_reporter) {}
2020

2121
double VariableRefreshRateDisplay::GetRefreshRate() const {
22-
return refresh_rate_reporter_->GetRefreshRate();
22+
return refresh_rate_reporter_.GetRefreshRate();
2323
}
2424

2525
} // namespace flutter

shell/common/variable_refresh_rate_display.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@ class VariableRefreshRateDisplay : public Display {
1818
public:
1919
explicit VariableRefreshRateDisplay(
2020
DisplayId display_id,
21-
std::shared_ptr<VariableRefreshRateReporter> refresh_rate_reporter);
21+
const VariableRefreshRateReporter& refresh_rate_reporter);
2222
explicit VariableRefreshRateDisplay(
23-
std::shared_ptr<VariableRefreshRateReporter> refresh_rate_reporter);
23+
const VariableRefreshRateReporter& refresh_rate_reporter);
2424
~VariableRefreshRateDisplay() = default;
2525

2626
// |Display|
2727
double GetRefreshRate() const override;
2828

2929
private:
30-
std::shared_ptr<VariableRefreshRateReporter> refresh_rate_reporter_;
30+
const VariableRefreshRateReporter& refresh_rate_reporter_;
3131

3232
FML_DISALLOW_COPY_AND_ASSIGN(VariableRefreshRateDisplay);
3333
};

shell/common/variable_refresh_rate_display_unittests.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ namespace testing {
1212

1313
TEST(VariableRefreshRateDisplayTest, ReportCorrectInitialRefreshRate) {
1414
auto refresh_rate_reporter = std::make_shared<TestRefreshRateReporter>(60);
15-
auto display = flutter::VariableRefreshRateDisplay(refresh_rate_reporter);
15+
auto display = flutter::VariableRefreshRateDisplay(*refresh_rate_reporter.get());
1616
ASSERT_EQ(display.GetRefreshRate(), 60);
1717
}
1818

1919
TEST(VariableRefreshRateDisplayTest, ReportCorrectRefreshRateWhenUpdated) {
2020
auto refresh_rate_reporter = std::make_shared<TestRefreshRateReporter>(60);
21-
auto display = flutter::VariableRefreshRateDisplay(refresh_rate_reporter);
21+
auto display = flutter::VariableRefreshRateDisplay(*refresh_rate_reporter.get());
2222
refresh_rate_reporter->UpdateRefreshRate(30);
2323
ASSERT_EQ(display.GetRefreshRate(), 30);
2424
}

shell/platform/darwin/ios/framework/Source/FlutterEngine.mm

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,8 +700,7 @@ - (BOOL)createShell:(NSString*)entrypoint
700700
}
701701

702702
- (void)initializeDisplays {
703-
std::shared_ptr<flutter::VsyncWaiterIOS> vsync_waiter_ios =
704-
std::static_pointer_cast<flutter::VsyncWaiterIOS>(_shell->GetVsyncWaiter());
703+
const flutter::VsyncWaiterIOS& vsync_waiter_ios = static_cast<const flutter::VsyncWaiterIOS&>(_shell->GetVsyncWaiter());
705704
std::vector<std::unique_ptr<flutter::Display>> displays;
706705
displays.push_back(std::make_unique<flutter::VariableRefreshRateDisplay>(vsync_waiter_ios));
707706
_shell->OnDisplayUpdates(flutter::DisplayUpdateType::kStartup, std::move(displays));

0 commit comments

Comments
 (0)