Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions ci/licenses_golden/licenses_flutter
Original file line number Diff line number Diff line change
Expand Up @@ -1315,6 +1315,8 @@ FILE: ../../../flutter/shell/platform/fuchsia/flutter/component.h
FILE: ../../../flutter/shell/platform/fuchsia/flutter/component_unittest.cc
FILE: ../../../flutter/shell/platform/fuchsia/flutter/compositor_context.cc
FILE: ../../../flutter/shell/platform/fuchsia/flutter/compositor_context.h
FILE: ../../../flutter/shell/platform/fuchsia/flutter/default_session_connection.cc
FILE: ../../../flutter/shell/platform/fuchsia/flutter/default_session_connection.h
FILE: ../../../flutter/shell/platform/fuchsia/flutter/engine.cc
FILE: ../../../flutter/shell/platform/fuchsia/flutter/engine.h
FILE: ../../../flutter/shell/platform/fuchsia/flutter/flutter_runner_fakes.h
Expand Down Expand Up @@ -1355,8 +1357,6 @@ FILE: ../../../flutter/shell/platform/fuchsia/flutter/runner.cc
FILE: ../../../flutter/shell/platform/fuchsia/flutter/runner.h
FILE: ../../../flutter/shell/platform/fuchsia/flutter/runner_tzdata_unittest.cc
FILE: ../../../flutter/shell/platform/fuchsia/flutter/runner_unittest.cc
FILE: ../../../flutter/shell/platform/fuchsia/flutter/session_connection.cc
FILE: ../../../flutter/shell/platform/fuchsia/flutter/session_connection.h
FILE: ../../../flutter/shell/platform/fuchsia/flutter/surface.cc
FILE: ../../../flutter/shell/platform/fuchsia/flutter/surface.h
FILE: ../../../flutter/shell/platform/fuchsia/flutter/task_observers.cc
Expand Down
6 changes: 3 additions & 3 deletions shell/platform/fuchsia/flutter/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ template("runner_sources") {
"accessibility_bridge.h",
"component.cc",
"component.h",
"default_session_connection.cc",
"default_session_connection.h",
"engine.cc",
"engine.h",
"flutter_runner_product_configuration.cc",
Expand All @@ -72,8 +74,6 @@ template("runner_sources") {
"platform_view.h",
"runner.cc",
"runner.h",
"session_connection.cc",
"session_connection.h",
"surface.cc",
"surface.h",
"task_observers.cc",
Expand Down Expand Up @@ -512,7 +512,7 @@ executable("flutter_runner_scenic_unittests") {

output_name = "flutter_runner_scenic_tests"

sources = [ "tests/session_connection_unittests.cc" ]
sources = [ "tests/default_session_connection_unittests.cc" ]

# This is needed for //third_party/googletest for linking zircon symbols.
libs = [ "//fuchsia/sdk/$host_os/arch/$target_cpu/sysroot/lib/libzircon.so" ]
Expand Down
6 changes: 3 additions & 3 deletions shell/platform/fuchsia/flutter/compositor_context.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ class ScopedFrame final : public flutter::CompositorContext::ScopedFrame {
bool instrumentation_enabled,
bool surface_supports_readback,
fml::RefPtr<fml::RasterThreadMerger> raster_thread_merger,
SessionConnection& session_connection,
DefaultSessionConnection& session_connection,
VulkanSurfaceProducer& surface_producer,
std::shared_ptr<flutter::SceneUpdateContext> scene_update_context)
: flutter::CompositorContext::ScopedFrame(context,
Expand All @@ -38,7 +38,7 @@ class ScopedFrame final : public flutter::CompositorContext::ScopedFrame {
scene_update_context_(scene_update_context) {}

private:
SessionConnection& session_connection_;
DefaultSessionConnection& session_connection_;
VulkanSurfaceProducer& surface_producer_;
std::shared_ptr<flutter::SceneUpdateContext> scene_update_context_;

Expand Down Expand Up @@ -149,7 +149,7 @@ class ScopedFrame final : public flutter::CompositorContext::ScopedFrame {
};

CompositorContext::CompositorContext(
SessionConnection& session_connection,
DefaultSessionConnection& session_connection,
VulkanSurfaceProducer& surface_producer,
std::shared_ptr<flutter::SceneUpdateContext> scene_update_context)
: session_connection_(session_connection),
Expand Down
6 changes: 3 additions & 3 deletions shell/platform/fuchsia/flutter/compositor_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include "flutter/flow/scene_update_context.h"
#include "flutter/fml/macros.h"

#include "session_connection.h"
#include "default_session_connection.h"
#include "vulkan_surface_producer.h"

namespace flutter_runner {
Expand All @@ -22,14 +22,14 @@ namespace flutter_runner {
class CompositorContext final : public flutter::CompositorContext {
public:
CompositorContext(
SessionConnection& session_connection,
DefaultSessionConnection& session_connection,
VulkanSurfaceProducer& surface_producer,
std::shared_ptr<flutter::SceneUpdateContext> scene_update_context);

~CompositorContext() override;

private:
SessionConnection& session_connection_;
DefaultSessionConnection& session_connection_;
VulkanSurfaceProducer& surface_producer_;
std::shared_ptr<flutter::SceneUpdateContext> scene_update_context_;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "session_connection.h"
#include "default_session_connection.h"

#include "flutter/fml/make_copyable.h"
#include "flutter/fml/trace_event.h"
Expand All @@ -12,7 +12,7 @@

namespace flutter_runner {

SessionConnection::SessionConnection(
DefaultSessionConnection::DefaultSessionConnection(
std::string debug_label,
fidl::InterfaceHandle<fuchsia::ui::scenic::Session> session,
fml::closure session_error_callback,
Expand All @@ -38,7 +38,7 @@ SessionConnection::SessionConnection(
// A frame was presented: Update our |frames_in_flight| to match the
// updated unfinalized present requests.
frames_in_flight_ -= num_presents_handled;
TRACE_EVENT2("gfx", "OnFramePresented", "frames_in_flight",
TRACE_EVENT2("gfx", "DSC::OnFramePresented", "frames_in_flight",
frames_in_flight_, "max_frames_in_flight",
kMaxFramesInFlight);
FML_DCHECK(frames_in_flight_ >= 0);
Expand Down Expand Up @@ -78,13 +78,13 @@ SessionConnection::SessionConnection(
});
}

SessionConnection::~SessionConnection() = default;
DefaultSessionConnection::~DefaultSessionConnection() = default;

void SessionConnection::Present() {
TRACE_EVENT2("gfx", "SessionConnection::Present", "frames_in_flight",
void DefaultSessionConnection::Present() {
TRACE_EVENT2("gfx", "DefaultSessionConnection::Present", "frames_in_flight",
frames_in_flight_, "max_frames_in_flight", kMaxFramesInFlight);

TRACE_FLOW_BEGIN("gfx", "SessionConnection::PresentSession",
TRACE_FLOW_BEGIN("gfx", "DefaultSessionConnection::PresentSession",
next_present_session_trace_id_);
next_present_session_trace_id_++;

Expand All @@ -105,7 +105,7 @@ void SessionConnection::Present() {
}
}

fml::TimePoint SessionConnection::CalculateNextLatchPoint(
fml::TimePoint DefaultSessionConnection::CalculateNextLatchPoint(
fml::TimePoint present_requested_time,
fml::TimePoint now,
fml::TimePoint last_latch_point_targeted,
Expand Down Expand Up @@ -134,8 +134,8 @@ fml::TimePoint SessionConnection::CalculateNextLatchPoint(
return minimum_latch_point_to_target;
}

void SessionConnection::PresentSession() {
TRACE_EVENT0("gfx", "SessionConnection::PresentSession");
void DefaultSessionConnection::PresentSession() {
TRACE_EVENT0("gfx", "DefaultSessionConnection::PresentSession");

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

while (processed_present_session_trace_id_ < next_present_session_trace_id_) {
TRACE_FLOW_END("gfx", "SessionConnection::PresentSession",
TRACE_FLOW_END("gfx", "DefaultSessionConnection::PresentSession",
processed_present_session_trace_id_);
processed_present_session_trace_id_++;
}
Expand Down Expand Up @@ -197,7 +197,7 @@ void SessionConnection::PresentSession() {
});
}

void SessionConnection::ToggleSignal(zx_handle_t handle, bool set) {
void DefaultSessionConnection::ToggleSignal(zx_handle_t handle, bool set) {
const auto signal = VsyncWaiter::SessionPresentSignal;
auto status = zx_object_signal(handle, // handle
set ? 0 : signal, // clear mask
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef FLUTTER_SHELL_PLATFORM_FUCHSIA_SESSION_CONNECTION_H_
#define FLUTTER_SHELL_PLATFORM_FUCHSIA_SESSION_CONNECTION_H_
#ifndef FLUTTER_SHELL_PLATFORM_FUCHSIA_DEFAULT_SESSION_CONNECTION_H_
#define FLUTTER_SHELL_PLATFORM_FUCHSIA_DEFAULT_SESSION_CONNECTION_H_

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

// The component residing on the raster thread that is responsible for
// maintaining the Scenic session connection and presenting node updates.
class SessionConnection final : public flutter::SessionWrapper {
class DefaultSessionConnection final : public flutter::SessionWrapper {
public:
SessionConnection(std::string debug_label,
fidl::InterfaceHandle<fuchsia::ui::scenic::Session> session,
fml::closure session_error_callback,
on_frame_presented_event on_frame_presented_callback,
zx_handle_t vsync_event_handle,
uint64_t max_frames_in_flight);
DefaultSessionConnection(
std::string debug_label,
fidl::InterfaceHandle<fuchsia::ui::scenic::Session> session,
fml::closure session_error_callback,
on_frame_presented_event on_frame_presented_callback,
zx_handle_t vsync_event_handle,
uint64_t max_frames_in_flight);

~SessionConnection();
~DefaultSessionConnection();

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

static void ToggleSignal(zx_handle_t handle, bool raise);

FML_DISALLOW_COPY_AND_ASSIGN(SessionConnection);
FML_DISALLOW_COPY_AND_ASSIGN(DefaultSessionConnection);
};

} // namespace flutter_runner

#endif // FLUTTER_SHELL_PLATFORM_FUCHSIA_SESSION_CONNECTION_H_
#endif // FLUTTER_SHELL_PLATFORM_FUCHSIA_DEFAULT_SESSION_CONNECTION_H_
4 changes: 2 additions & 2 deletions shell/platform/fuchsia/flutter/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,10 @@
#include "flutter/fml/macros.h"
#include "flutter/shell/common/shell.h"

#include "default_session_connection.h"
#include "flutter_runner_product_configuration.h"
#include "fuchsia_external_view_embedder.h"
#include "isolate_configurator.h"
#include "session_connection.h"
#include "thread.h"
#include "vulkan_surface_producer.h"

Expand Down Expand Up @@ -74,7 +74,7 @@ class Engine final {
const std::string thread_label_;
std::array<Thread, 3> threads_;

std::optional<SessionConnection> session_connection_;
std::optional<DefaultSessionConnection> session_connection_;
std::optional<VulkanSurfaceProducer> surface_producer_;
std::shared_ptr<FuchsiaExternalViewEmbedder> external_view_embedder_;
#if defined(LEGACY_FUCHSIA_EMBEDDER)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ FuchsiaExternalViewEmbedder::FuchsiaExternalViewEmbedder(
std::string debug_label,
fuchsia::ui::views::ViewToken view_token,
scenic::ViewRefPair view_ref_pair,
SessionConnection& session,
DefaultSessionConnection& session,
VulkanSurfaceProducer& surface_producer,
bool intercept_all_input)
: session_(session),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
#include "third_party/skia/include/core/SkSize.h"
#include "third_party/skia/include/gpu/GrDirectContext.h"

#include "session_connection.h"
#include "default_session_connection.h"
#include "vulkan_surface_producer.h"

namespace flutter_runner {
Expand All @@ -42,7 +42,7 @@ class FuchsiaExternalViewEmbedder final : public flutter::ExternalViewEmbedder {
FuchsiaExternalViewEmbedder(std::string debug_label,
fuchsia::ui::views::ViewToken view_token,
scenic::ViewRefPair view_ref_pair,
SessionConnection& session,
DefaultSessionConnection& session,
VulkanSurfaceProducer& surface_producer,
bool intercept_all_input = false);
~FuchsiaExternalViewEmbedder();
Expand Down Expand Up @@ -147,7 +147,7 @@ class FuchsiaExternalViewEmbedder final : public flutter::ExternalViewEmbedder {
using EmbedderLayerId = std::optional<uint32_t>;
constexpr static EmbedderLayerId kRootLayerId = EmbedderLayerId{};

SessionConnection& session_;
DefaultSessionConnection& session_;
VulkanSurfaceProducer& surface_producer_;

scenic::View root_view_;
Expand Down
Loading