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

Commit a293b06

Browse files
committed
small formatting fixes and cleanup
1 parent 2f81c7f commit a293b06

File tree

8 files changed

+28
-160
lines changed

8 files changed

+28
-160
lines changed

ci/licenses_golden/licenses_flutter

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1360,6 +1360,7 @@ FILE: ../../../flutter/shell/platform/fuchsia/flutter/runner.cc
13601360
FILE: ../../../flutter/shell/platform/fuchsia/flutter/runner.h
13611361
FILE: ../../../flutter/shell/platform/fuchsia/flutter/runner_tzdata_unittest.cc
13621362
FILE: ../../../flutter/shell/platform/fuchsia/flutter/runner_unittest.cc
1363+
FILE: ../../../flutter/shell/platform/fuchsia/flutter/session_connection.h
13631364
FILE: ../../../flutter/shell/platform/fuchsia/flutter/surface.cc
13641365
FILE: ../../../flutter/shell/platform/fuchsia/flutter/surface.h
13651366
FILE: ../../../flutter/shell/platform/fuchsia/flutter/task_observers.cc

shell/platform/fuchsia/flutter/BUILD.gn

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,10 +454,10 @@ executable("flutter_runner_unittests") {
454454
"platform_view_unittest.cc",
455455
"runner_unittest.cc",
456456
"tests/engine_unittests.cc",
457+
"tests/fake_session_connection.h",
457458
"tests/flutter_runner_product_configuration_unittests.cc",
458459
"tests/vsync_recorder_unittests.cc",
459460
"tests/vsync_waiter_unittests.cc",
460-
"tests/fake_session_connection.h",
461461
]
462462

463463
# This is needed for //third_party/googletest for linking zircon symbols.

shell/platform/fuchsia/flutter/default_session_connection.cc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -80,8 +80,8 @@ DefaultSessionConnection::DefaultSessionConnection(
8080
DefaultSessionConnection::~DefaultSessionConnection() = default;
8181

8282
void DefaultSessionConnection::Present() {
83-
TRACE_EVENT2("gfx", "DefaultSessionConnection::Present", "frames_in_flight",
84-
frames_in_flight_, "max_frames_in_flight", kMaxFramesInFlight);
83+
TRACE_DURATION("gfx", "DefaultSessionConnection::Present", "frames_in_flight",
84+
frames_in_flight_, "max_frames_in_flight", kMaxFramesInFlight);
8585

8686
TRACE_FLOW_BEGIN("gfx", "DefaultSessionConnection::PresentSession",
8787
next_present_session_trace_id_);
@@ -133,7 +133,7 @@ fml::TimePoint DefaultSessionConnection::CalculateNextLatchPoint(
133133
}
134134

135135
void DefaultSessionConnection::PresentSession() {
136-
TRACE_EVENT0("gfx", "DefaultSessionConnection::PresentSession");
136+
TRACE_DURATION("gfx", "DefaultSessionConnection::PresentSession");
137137

138138
// If we cannot call Present2() because we have no more Scenic frame budget,
139139
// then we must wait until the OnFramePresented() event fires so we can
@@ -197,7 +197,7 @@ void DefaultSessionConnection::PresentSession() {
197197

198198
void DefaultSessionConnection::InitializeVsyncWaiterCallback(
199199
VsyncWaiterCallback callback) {
200-
FML_CHECK(!vsync_waiter_initialized_);
200+
FML_DCHECK(!vsync_waiter_initialized_);
201201

202202
vsync_waiter_callback_ = callback;
203203
vsync_waiter_initialized_ = true;

shell/platform/fuchsia/flutter/default_session_connection.h

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,15 @@ class DefaultSessionConnection final
2727
: public flutter::SessionWrapper,
2828
public flutter_runner::SessionConnection {
2929
public:
30+
static fml::TimePoint CalculateNextLatchPoint(
31+
fml::TimePoint present_requested_time,
32+
fml::TimePoint now,
33+
fml::TimePoint last_latch_point_targeted,
34+
fml::TimeDelta flutter_frame_build_time,
35+
fml::TimeDelta vsync_interval,
36+
std::deque<std::pair<fml::TimePoint, fml::TimePoint>>&
37+
future_presentation_infos);
38+
3039
DefaultSessionConnection(
3140
std::string debug_label,
3241
fidl::InterfaceHandle<fuchsia::ui::scenic::Session> session,
@@ -36,20 +45,16 @@ class DefaultSessionConnection final
3645

3746
~DefaultSessionConnection();
3847

48+
// |SessionWrapper|
3949
scenic::Session* get() override { return &session_wrapper_; }
40-
void Present() override;
4150

42-
static fml::TimePoint CalculateNextLatchPoint(
43-
fml::TimePoint present_requested_time,
44-
fml::TimePoint now,
45-
fml::TimePoint last_latch_point_targeted,
46-
fml::TimeDelta flutter_frame_build_time,
47-
fml::TimeDelta vsync_interval,
48-
std::deque<std::pair<fml::TimePoint, fml::TimePoint>>&
49-
future_presentation_infos);
51+
// |SessionWrapper|
52+
void Present() override;
5053

54+
// |SessionConnection|
5155
void InitializeVsyncWaiterCallback(VsyncWaiterCallback callback) override;
5256

57+
// |SessionConnection|
5358
bool CanRequestNewFrames() override {
5459
return frames_in_flight_ < kMaxFramesInFlight;
5560
}

shell/platform/fuchsia/flutter/engine.cc

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,6 @@ Engine::Engine(Delegate& delegate,
135135
view_ref_pair = std::move(view_ref_pair),
136136
max_frames_in_flight = product_config.get_max_frames_in_flight(),
137137
&view_embedder_latch]() mutable {
138-
FML_LOG(INFO) << "FELIPE: made shared";
139138
session_connection_ = std::make_shared<DefaultSessionConnection>(
140139
thread_label_, std::move(session),
141140
std::move(session_error_callback), [](auto) {},

shell/platform/fuchsia/flutter/tests/fake_session_connection.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ class FakeSessionConnection : public flutter_runner::SessionConnection {
2020

2121
bool CanRequestNewFrames() override { return can_request_new_frames_; }
2222

23-
void FireVsyncWaiterCallbackForTest() { callback_(); }
23+
void FireVsyncWaiterCallback() { callback_(); }
2424

25-
void SetCanRequestNewFramesForTest(bool new_bool) {
25+
void SetCanRequestNewFrames(bool new_bool) {
2626
can_request_new_frames_ = new_bool;
2727
}
2828

shell/platform/fuchsia/flutter/tests/vsync_waiter_unittests.cc

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ TEST_F(VsyncWaiterTest, SimpleVsyncCallback) {
8282
bool flag = false;
8383
vsync_waiter->AsyncWaitForVsync([&flag](auto) { flag = true; });
8484

85-
session_connection->FireVsyncWaiterCallbackForTest();
85+
session_connection->FireVsyncWaiterCallback();
8686

8787
std::this_thread::sleep_for(std::chrono::milliseconds(100));
8888

@@ -93,7 +93,7 @@ TEST_F(VsyncWaiterTest, EnsureBackPressure) {
9393
auto vsync_waiter = get_vsync_waiter();
9494
auto session_connection = get_session_connection();
9595

96-
session_connection->SetCanRequestNewFramesForTest(false);
96+
session_connection->SetCanRequestNewFrames(false);
9797
bool flag = false;
9898
vsync_waiter->AsyncWaitForVsync([&flag](auto) { flag = true; });
9999

@@ -106,16 +106,16 @@ TEST_F(VsyncWaiterTest, BackPressureRelief) {
106106
auto vsync_waiter = get_vsync_waiter();
107107
auto session_connection = get_session_connection();
108108

109-
session_connection->SetCanRequestNewFramesForTest(false);
109+
session_connection->SetCanRequestNewFrames(false);
110110
bool flag = false;
111111
vsync_waiter->AsyncWaitForVsync([&flag](auto) { flag = true; });
112112

113113
std::this_thread::sleep_for(std::chrono::milliseconds(100));
114114

115115
EXPECT_FALSE(flag);
116116

117-
session_connection->SetCanRequestNewFramesForTest(true);
118-
session_connection->FireVsyncWaiterCallbackForTest();
117+
session_connection->SetCanRequestNewFrames(true);
118+
session_connection->FireVsyncWaiterCallback();
119119

120120
std::this_thread::sleep_for(std::chrono::milliseconds(100));
121121

@@ -126,7 +126,7 @@ TEST_F(VsyncWaiterTest, SteadyStateBehavior) {
126126
auto vsync_waiter = get_vsync_waiter();
127127
auto session_connection = get_session_connection();
128128

129-
session_connection->SetCanRequestNewFramesForTest(true);
129+
session_connection->SetCanRequestNewFrames(true);
130130

131131
int count = 0;
132132
const int expected_iterations = 100;

shell/platform/fuchsia/flutter/vsync_waiter_unittests.cc

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

0 commit comments

Comments
 (0)