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

Commit 807d809

Browse files
committed
[fuchsia] rename to DefaultSessionConnection
In preparation for #25551, rename SessionConnection to DefaultSessionConnection. The plan is to have SessionConnection be an interface we can create a fake of for testing.
1 parent f5b97d0 commit 807d809

11 files changed

+60
-59
lines changed

shell/platform/fuchsia/flutter/BUILD.gn

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,8 +72,8 @@ template("runner_sources") {
7272
"platform_view.h",
7373
"runner.cc",
7474
"runner.h",
75-
"session_connection.cc",
76-
"session_connection.h",
75+
"default_session_connection.cc",
76+
"default_session_connection.h",
7777
"surface.cc",
7878
"surface.h",
7979
"task_observers.cc",
@@ -512,7 +512,7 @@ executable("flutter_runner_scenic_unittests") {
512512

513513
output_name = "flutter_runner_scenic_tests"
514514

515-
sources = [ "tests/session_connection_unittests.cc" ]
515+
sources = [ "tests/default_session_connection_unittests.cc" ]
516516

517517
# This is needed for //third_party/googletest for linking zircon symbols.
518518
libs = [ "//fuchsia/sdk/$host_os/arch/$target_cpu/sysroot/lib/libzircon.so" ]

shell/platform/fuchsia/flutter/compositor_context.cc

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ class ScopedFrame final : public flutter::CompositorContext::ScopedFrame {
2222
bool instrumentation_enabled,
2323
bool surface_supports_readback,
2424
fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger,
25-
SessionConnection& session_connection,
25+
DefaultSessionConnection& session_connection,
2626
VulkanSurfaceProducer& surface_producer,
2727
std::shared_ptr<flutter::SceneUpdateContext> scene_update_context)
2828
: flutter::CompositorContext::ScopedFrame(context,
@@ -38,7 +38,7 @@ class ScopedFrame final : public flutter::CompositorContext::ScopedFrame {
3838
scene_update_context_(scene_update_context) {}
3939

4040
private:
41-
SessionConnection& session_connection_;
41+
DefaultSessionConnection& session_connection_;
4242
VulkanSurfaceProducer& surface_producer_;
4343
std::shared_ptr<flutter::SceneUpdateContext> scene_update_context_;
4444

@@ -149,7 +149,7 @@ class ScopedFrame final : public flutter::CompositorContext::ScopedFrame {
149149
};
150150

151151
CompositorContext::CompositorContext(
152-
SessionConnection& session_connection,
152+
DefaultSessionConnection& session_connection,
153153
VulkanSurfaceProducer& surface_producer,
154154
std::shared_ptr<flutter::SceneUpdateContext> scene_update_context)
155155
: session_connection_(session_connection),

shell/platform/fuchsia/flutter/compositor_context.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
#include "flutter/flow/scene_update_context.h"
1313
#include "flutter/fml/macros.h"
1414

15-
#include "session_connection.h"
15+
#include "default_session_connection.h"
1616
#include "vulkan_surface_producer.h"
1717

1818
namespace flutter_runner {
@@ -22,14 +22,14 @@ namespace flutter_runner {
2222
class CompositorContext final : public flutter::CompositorContext {
2323
public:
2424
CompositorContext(
25-
SessionConnection& session_connection,
25+
DefaultSessionConnection& session_connection,
2626
VulkanSurfaceProducer& surface_producer,
2727
std::shared_ptr<flutter::SceneUpdateContext> scene_update_context);
2828

2929
~CompositorContext() override;
3030

3131
private:
32-
SessionConnection& session_connection_;
32+
DefaultSessionConnection& session_connection_;
3333
VulkanSurfaceProducer& surface_producer_;
3434
std::shared_ptr<flutter::SceneUpdateContext> scene_update_context_;
3535

shell/platform/fuchsia/flutter/session_connection.cc renamed to shell/platform/fuchsia/flutter/default_session_connection.cc

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#include "session_connection.h"
5+
#include "default_session_connection.h"
66

77
#include "flutter/fml/make_copyable.h"
88
#include "flutter/fml/trace_event.h"
@@ -12,7 +12,7 @@
1212

1313
namespace flutter_runner {
1414

15-
SessionConnection::SessionConnection(
15+
DefaultSessionConnection::DefaultSessionConnection(
1616
std::string debug_label,
1717
fidl::InterfaceHandle<fuchsia::ui::scenic::Session> session,
1818
fml::closure session_error_callback,
@@ -38,7 +38,7 @@ SessionConnection::SessionConnection(
3838
// A frame was presented: Update our |frames_in_flight| to match the
3939
// updated unfinalized present requests.
4040
frames_in_flight_ -= num_presents_handled;
41-
TRACE_EVENT2("gfx", "OnFramePresented", "frames_in_flight",
41+
TRACE_EVENT2("gfx", "DSC::OnFramePresented", "frames_in_flight",
4242
frames_in_flight_, "max_frames_in_flight",
4343
kMaxFramesInFlight);
4444
FML_DCHECK(frames_in_flight_ >= 0);
@@ -78,13 +78,13 @@ SessionConnection::SessionConnection(
7878
});
7979
}
8080

81-
SessionConnection::~SessionConnection() = default;
81+
DefaultSessionConnection::~DefaultSessionConnection() = default;
8282

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

87-
TRACE_FLOW_BEGIN("gfx", "SessionConnection::PresentSession",
87+
TRACE_FLOW_BEGIN("gfx", "DefaultSessionConnection::PresentSession",
8888
next_present_session_trace_id_);
8989
next_present_session_trace_id_++;
9090

@@ -105,7 +105,7 @@ void SessionConnection::Present() {
105105
}
106106
}
107107

108-
fml::TimePoint SessionConnection::CalculateNextLatchPoint(
108+
fml::TimePoint DefaultSessionConnection::CalculateNextLatchPoint(
109109
fml::TimePoint present_requested_time,
110110
fml::TimePoint now,
111111
fml::TimePoint last_latch_point_targeted,
@@ -134,8 +134,8 @@ fml::TimePoint SessionConnection::CalculateNextLatchPoint(
134134
return minimum_latch_point_to_target;
135135
}
136136

137-
void SessionConnection::PresentSession() {
138-
TRACE_EVENT0("gfx", "SessionConnection::PresentSession");
137+
void DefaultSessionConnection::PresentSession() {
138+
TRACE_EVENT0("gfx", "DefaultSessionConnection::PresentSession");
139139

140140
// If we cannot call Present2() because we have no more Scenic frame budget,
141141
// then we must wait until the OnFramePresented() event fires so we can
@@ -148,7 +148,7 @@ void SessionConnection::PresentSession() {
148148
present_session_pending_ = false;
149149

150150
while (processed_present_session_trace_id_ < next_present_session_trace_id_) {
151-
TRACE_FLOW_END("gfx", "SessionConnection::PresentSession",
151+
TRACE_FLOW_END("gfx", "DefaultSessionConnection::PresentSession",
152152
processed_present_session_trace_id_);
153153
processed_present_session_trace_id_++;
154154
}
@@ -197,7 +197,7 @@ void SessionConnection::PresentSession() {
197197
});
198198
}
199199

200-
void SessionConnection::ToggleSignal(zx_handle_t handle, bool set) {
200+
void DefaultSessionConnection::ToggleSignal(zx_handle_t handle, bool set) {
201201
const auto signal = VsyncWaiter::SessionPresentSignal;
202202
auto status = zx_object_signal(handle, // handle
203203
set ? 0 : signal, // clear mask

shell/platform/fuchsia/flutter/session_connection.h renamed to shell/platform/fuchsia/flutter/default_session_connection.h

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// Use of this source code is governed by a BSD-style license that can be
33
// found in the LICENSE file.
44

5-
#ifndef FLUTTER_SHELL_PLATFORM_FUCHSIA_SESSION_CONNECTION_H_
6-
#define FLUTTER_SHELL_PLATFORM_FUCHSIA_SESSION_CONNECTION_H_
5+
#ifndef FLUTTER_SHELL_PLATFORM_FUCHSIA_DEFAULT_SESSION_CONNECTION_H_
6+
#define FLUTTER_SHELL_PLATFORM_FUCHSIA_DEFAULT_SESSION_CONNECTION_H_
77

88
#include <fuchsia/scenic/scheduling/cpp/fidl.h>
99
#include <fuchsia/ui/scenic/cpp/fidl.h>
@@ -21,16 +21,17 @@ using on_frame_presented_event =
2121

2222
// The component residing on the raster thread that is responsible for
2323
// maintaining the Scenic session connection and presenting node updates.
24-
class SessionConnection final : public flutter::SessionWrapper {
24+
class DefaultSessionConnection final : public flutter::SessionWrapper {
2525
public:
26-
SessionConnection(std::string debug_label,
27-
fidl::InterfaceHandle<fuchsia::ui::scenic::Session> session,
28-
fml::closure session_error_callback,
29-
on_frame_presented_event on_frame_presented_callback,
30-
zx_handle_t vsync_event_handle,
31-
uint64_t max_frames_in_flight);
26+
DefaultSessionConnection(
27+
std::string debug_label,
28+
fidl::InterfaceHandle<fuchsia::ui::scenic::Session> session,
29+
fml::closure session_error_callback,
30+
on_frame_presented_event on_frame_presented_callback,
31+
zx_handle_t vsync_event_handle,
32+
uint64_t max_frames_in_flight);
3233

33-
~SessionConnection();
34+
~DefaultSessionConnection();
3435

3536
scenic::Session* get() override { return &session_wrapper_; }
3637
void Present() override;
@@ -83,9 +84,9 @@ class SessionConnection final : public flutter::SessionWrapper {
8384

8485
static void ToggleSignal(zx_handle_t handle, bool raise);
8586

86-
FML_DISALLOW_COPY_AND_ASSIGN(SessionConnection);
87+
FML_DISALLOW_COPY_AND_ASSIGN(DefaultSessionConnection);
8788
};
8889

8990
} // namespace flutter_runner
9091

91-
#endif // FLUTTER_SHELL_PLATFORM_FUCHSIA_SESSION_CONNECTION_H_
92+
#endif // FLUTTER_SHELL_PLATFORM_FUCHSIA_DEFAULT_SESSION_CONNECTION_H_

shell/platform/fuchsia/flutter/engine.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@
2222
#include "flutter/fml/macros.h"
2323
#include "flutter/shell/common/shell.h"
2424

25+
#include "default_session_connection.h"
2526
#include "flutter_runner_product_configuration.h"
2627
#include "fuchsia_external_view_embedder.h"
2728
#include "isolate_configurator.h"
28-
#include "session_connection.h"
2929
#include "thread.h"
3030
#include "vulkan_surface_producer.h"
3131

@@ -74,7 +74,7 @@ class Engine final {
7474
const std::string thread_label_;
7575
std::array<Thread, 3> threads_;
7676

77-
std::optional<SessionConnection> session_connection_;
77+
std::optional<DefaultSessionConnection> session_connection_;
7878
std::optional<VulkanSurfaceProducer> surface_producer_;
7979
std::shared_ptr<FuchsiaExternalViewEmbedder> external_view_embedder_;
8080
#if defined(LEGACY_FUCHSIA_EMBEDDER)

shell/platform/fuchsia/flutter/fuchsia_external_view_embedder.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ FuchsiaExternalViewEmbedder::FuchsiaExternalViewEmbedder(
6464
std::string debug_label,
6565
fuchsia::ui::views::ViewToken view_token,
6666
scenic::ViewRefPair view_ref_pair,
67-
SessionConnection& session,
67+
DefaultSessionConnection& session,
6868
VulkanSurfaceProducer& surface_producer,
6969
bool intercept_all_input)
7070
: session_(session),

shell/platform/fuchsia/flutter/fuchsia_external_view_embedder.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
#include "third_party/skia/include/core/SkSize.h"
2828
#include "third_party/skia/include/gpu/GrDirectContext.h"
2929

30-
#include "session_connection.h"
30+
#include "default_session_connection.h"
3131
#include "vulkan_surface_producer.h"
3232

3333
namespace flutter_runner {
@@ -42,7 +42,7 @@ class FuchsiaExternalViewEmbedder final : public flutter::ExternalViewEmbedder {
4242
FuchsiaExternalViewEmbedder(std::string debug_label,
4343
fuchsia::ui::views::ViewToken view_token,
4444
scenic::ViewRefPair view_ref_pair,
45-
SessionConnection& session,
45+
DefaultSessionConnection& session,
4646
VulkanSurfaceProducer& surface_producer,
4747
bool intercept_all_input = false);
4848
~FuchsiaExternalViewEmbedder();
@@ -147,7 +147,7 @@ class FuchsiaExternalViewEmbedder final : public flutter::ExternalViewEmbedder {
147147
using EmbedderLayerId = std::optional<uint32_t>;
148148
constexpr static EmbedderLayerId kRootLayerId = EmbedderLayerId{};
149149

150-
SessionConnection& session_;
150+
DefaultSessionConnection& session_;
151151
VulkanSurfaceProducer& surface_producer_;
152152

153153
scenic::View root_view_;

0 commit comments

Comments
 (0)