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
Show all changes
106 commits
Select commit Hold shift + click to select a range
d36a55d
Rebase
dkwingsmt Jun 30, 2023
3812621
Rename vars and fix fuchsia compile
dkwingsmt Jun 30, 2023
b1b68eb
Revert window metric changes
dkwingsmt Jul 5, 2023
5e036d8
Apply suggestions from code review
dkwingsmt Jul 6, 2023
ba42c07
Merge remote-tracking branch 'origin/main' into mv-window-metrics
dkwingsmt Jul 6, 2023
fba2c7c
Doc enable_implicit_view
dkwingsmt Jul 6, 2023
d7c6510
Better platConfig structure for adding window
dkwingsmt Jul 6, 2023
968c7e9
Merge remote-tracking branch 'origin/main' into mv-window-metrics
dkwingsmt Jul 10, 2023
752a0a4
Merge remote-tracking branch 'origin/main' into mv-window-metrics
dkwingsmt Jul 10, 2023
c912775
Merge remote-tracking branch 'origin/main' into mv-window-metrics
dkwingsmt Jul 20, 2023
2a87664
Fix compile
dkwingsmt Jul 23, 2023
adf5b8f
Doc for implicit view
dkwingsmt Jul 23, 2023
f1a497b
Two tests
dkwingsmt Jul 24, 2023
f31f60c
Remove platform data view metrics
dkwingsmt Jul 24, 2023
9d68f3c
Extract function
dkwingsmt Jul 24, 2023
7af9496
Docs and address comments
dkwingsmt Jul 24, 2023
2e539c6
One more sentence
dkwingsmt Jul 24, 2023
d20363e
Merge remote-tracking branch 'origin/main' into mv-window-metrics
dkwingsmt Jul 24, 2023
3d5a190
AddRemoveView test
dkwingsmt Jul 25, 2023
ba845c7
Merge remote-tracking branch 'origin/main' into mv-window-metrics
dkwingsmt Jul 25, 2023
4fc4922
Remove expected size on removal
dkwingsmt Jul 25, 2023
db9a99c
More docs
dkwingsmt Jul 25, 2023
a098175
Merge remote-tracking branch 'origin/main' into mv-window-metrics
dkwingsmt Jul 25, 2023
2128688
Assign viewId not bool. Move viewId to settings.h.
dkwingsmt Jul 25, 2023
4f049cd
Remove more implicit view ID
dkwingsmt Jul 25, 2023
c795035
Fix compile, prefix view id with flutter
dkwingsmt Jul 25, 2023
03520e2
Address many comments
dkwingsmt Jul 26, 2023
285c0f6
Correct FlushRuntimeStateToIsolate and PlatformData
dkwingsmt Jul 27, 2023
9c92de2
AddView specifies view config
dkwingsmt Jul 27, 2023
86bd921
Merge remote-tracking branch 'origin/main' into mv-window-metrics
dkwingsmt Jul 27, 2023
a898834
Remove ImplicitViewEnabled from more and lint
dkwingsmt Jul 27, 2023
2ff8609
Fix test and lint
dkwingsmt Jul 28, 2023
c61cf67
Fix tests?
dkwingsmt Jul 31, 2023
d9fc2a5
Shell Add/RemoveView blocking
dkwingsmt Aug 1, 2023
e99900a
Merge remote-tracking branch 'origin/main' into mv-window-metrics
dkwingsmt Aug 1, 2023
89755d2
Implement Rasterizer::CollectView
dkwingsmt Aug 1, 2023
42db5c3
Flushing test
dkwingsmt Aug 1, 2023
164ca90
Add TODO doc
dkwingsmt Aug 1, 2023
3e2902b
doc for implicit view ID.
dkwingsmt Aug 1, 2023
26d3cbe
Better doc
dkwingsmt Aug 1, 2023
8db91df
Bring back docs
dkwingsmt Aug 1, 2023
8d718d5
Merge remote-tracking branch 'origin/main' into mv-window-metrics
dkwingsmt Aug 1, 2023
0d3f6fb
Merge remote-tracking branch 'origin/main' into mv-window-metrics
dkwingsmt Aug 1, 2023
5cb56f8
Trivial comments
dkwingsmt Aug 3, 2023
6264164
Use TODO issue; solve lint
dkwingsmt Aug 3, 2023
a1b0740
Simplify implicit view init, add assertion
dkwingsmt Aug 4, 2023
b3284aa
Doc
dkwingsmt Aug 4, 2023
a7e033b
WIP
dkwingsmt Aug 4, 2023
2fb045b
Comments
dkwingsmt Aug 4, 2023
257f7cc
Merge remote-tracking branch 'origin/main' into mv-window-metrics
dkwingsmt Aug 4, 2023
9bb1d75
RemoveView no longer blocks
dkwingsmt Aug 4, 2023
90020f4
Fix compile
dkwingsmt Aug 5, 2023
ed46975
Compilable
dkwingsmt Aug 7, 2023
eb00183
Merge remote-tracking branch 'origin/main' into mv-pipeline
dkwingsmt Aug 7, 2023
7c24ab8
Merge remote-tracking branch 'origin/main' into mv-window-metrics
dkwingsmt Aug 7, 2023
4e2d39a
Merge branch 'mv-window-metrics' into mv-pipeline
dkwingsmt Aug 7, 2023
a3b7567
Merge remote-tracking branch 'origin/main' into mv-pipeline
dkwingsmt Aug 11, 2023
5c7c313
Merge remote-tracking branch 'origin/main' into mv-pipeline
dkwingsmt Aug 15, 2023
9b6210e
Merge remote-tracking branch 'origin/main' into mv-pipeline
dkwingsmt Aug 31, 2023
9c888ec
Clear changes
dkwingsmt Aug 31, 2023
8d14e6d
More clear patch
dkwingsmt Aug 31, 2023
29aea0a
lint
dkwingsmt Sep 2, 2023
3f17841
Merge remote-tracking branch 'dkwingsmt/mv-pipeline' into mv-pipeline
dkwingsmt Sep 5, 2023
6589d45
Merge remote-tracking branch 'origin/main' into mv-pipeline
dkwingsmt Sep 5, 2023
a762a11
Merge remote-tracking branch 'origin/main' into mv-pipeline
dkwingsmt Sep 5, 2023
2bead3f
Merge remote-tracking branch 'origin/main' into mv-pipeline
dkwingsmt Sep 22, 2023
50b7031
Merge changes with mv-rasterizer
dkwingsmt Sep 22, 2023
f08c963
Remove unneeded include
dkwingsmt Sep 22, 2023
87c73c4
Merge remote-tracking branch 'origin/main' into mv-pipeline
dkwingsmt Sep 29, 2023
2a5a715
Merge remote-tracking branch 'origin/main' into mv-pipeline
dkwingsmt Oct 4, 2023
b74574b
assert frame_timings_recorder is not null in render
dkwingsmt Oct 4, 2023
a705321
Fix many shell tests
dkwingsmt Oct 6, 2023
7f7d0ad
Merge remote-tracking branch 'origin/main' into mv-pipeline
dkwingsmt Oct 6, 2023
a0dd49a
Refactor PumpOneFrame
dkwingsmt Oct 7, 2023
629ea33
Fix lint
dkwingsmt Oct 8, 2023
02ba1b9
Doc, and logs
dkwingsmt Oct 8, 2023
29972e0
Add debug logs
dkwingsmt Oct 8, 2023
dfbd19e
Wait for 2 frames
dkwingsmt Oct 9, 2023
b792ff7
Add more logs
dkwingsmt Oct 9, 2023
be6804b
Fix
dkwingsmt Oct 9, 2023
25cf6f5
Fix two more tests
dkwingsmt Oct 9, 2023
34bf49a
Merge remote-tracking branch 'origin/main' into mv-pipeline
dkwingsmt Oct 9, 2023
0c2f053
Fix compile
dkwingsmt Oct 9, 2023
862a318
Remove logs
dkwingsmt Oct 9, 2023
56cd636
Better fix secondary vsync test
dkwingsmt Oct 9, 2023
1f411ec
Run engine for the first time
dkwingsmt Oct 9, 2023
6cec636
Test complete
dkwingsmt Oct 10, 2023
8021575
Remove postsync
dkwingsmt Oct 10, 2023
ae3e06e
Add docs and fix a lint
dkwingsmt Oct 10, 2023
b037f9a
Add log
dkwingsmt Oct 10, 2023
4f34de0
Fix compile
dkwingsmt Oct 10, 2023
1b21cea
Use another way to fix secondary vsync test
dkwingsmt Oct 10, 2023
181a94b
Fix lint
dkwingsmt Oct 10, 2023
3523e91
Double test started
dkwingsmt Oct 10, 2023
e7bd8fe
Merge remote-tracking branch 'origin/main' into mv-pipeline
dkwingsmt Oct 10, 2023
7a1436d
Fix lint
dkwingsmt Oct 10, 2023
918cf19
Pretty string state
dkwingsmt Oct 12, 2023
199ff4a
EngineContext
dkwingsmt Oct 16, 2023
55b57b2
Remove some params
dkwingsmt Oct 16, 2023
9544da9
Move to engine test
dkwingsmt Oct 16, 2023
4c9a11a
Move mock up
dkwingsmt Oct 16, 2023
39dfbc6
Verify view ID
dkwingsmt Oct 16, 2023
fc44a61
Merge remote-tracking branch 'origin/main' into mv-pipeline
dkwingsmt Oct 19, 2023
d52f4f6
Fix some lint
dkwingsmt Oct 19, 2023
3a9cfb1
Fix clang tidy
dkwingsmt Oct 19, 2023
d570066
Fix test
dkwingsmt Oct 20, 2023
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
24 changes: 23 additions & 1 deletion flow/frame_timings.cc
Original file line number Diff line number Diff line change
Expand Up @@ -254,8 +254,30 @@ const char* FrameTimingsRecorder::GetFrameNumberTraceArg() const {
return frame_number_trace_arg_val_.c_str();
}

static const char* StateToString(FrameTimingsRecorder::State state) {
#ifndef NDEBUG
switch (state) {
case FrameTimingsRecorder::State::kUninitialized:
return "kUninitialized";
case FrameTimingsRecorder::State::kVsync:
return "kVsync";
case FrameTimingsRecorder::State::kBuildStart:
return "kBuildStart";
case FrameTimingsRecorder::State::kBuildEnd:
return "kBuildEnd";
case FrameTimingsRecorder::State::kRasterStart:
return "kRasterStart";
case FrameTimingsRecorder::State::kRasterEnd:
return "kRasterEnd";
};
FML_UNREACHABLE();
#endif
return "";
}

void FrameTimingsRecorder::AssertInState(State state) const {
FML_DCHECK(state_ == state);
FML_DCHECK(state_ == state) << "Expected state " << StateToString(state)
<< ", actual state " << StateToString(state_);
}

} // namespace flutter
3 changes: 3 additions & 0 deletions flow/frame_timings.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class FrameTimingsRecorder {
public:
/// Various states that the recorder can be in. When created the recorder is
/// in an unitialized state and transtions in sequential order of the states.
// After adding an item to this enum, modify StateToString accordingly.
enum class State : uint32_t {
kUninitialized,
kVsync,
Expand Down Expand Up @@ -121,6 +122,8 @@ class FrameTimingsRecorder {
///
/// Instead of adding a `GetState` method and asserting on the result, this
/// method prevents other logic from relying on the state.
///
/// In opt builds, this call is a no-op.
void AssertInState(State state) const;

private:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ namespace impeller {
DirectionalGaussianBlurFilterContents::DirectionalGaussianBlurFilterContents() =
default;

DirectionalGaussianBlurFilterContents::
~DirectionalGaussianBlurFilterContents() = default;
DirectionalGaussianBlurFilterContents::~
DirectionalGaussianBlurFilterContents() = default;

void DirectionalGaussianBlurFilterContents::SetSigma(Sigma sigma) {
blur_sigma_ = sigma;
Expand Down
2 changes: 1 addition & 1 deletion lib/ui/dart_ui.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,7 +98,7 @@ typedef CanvasPath Path;
V(NativeStringAttribute::initSpellOutStringAttribute, 3) \
V(PlatformConfigurationNativeApi::DefaultRouteName, 0) \
V(PlatformConfigurationNativeApi::ScheduleFrame, 0) \
V(PlatformConfigurationNativeApi::Render, 1) \
V(PlatformConfigurationNativeApi::Render, 2) \
V(PlatformConfigurationNativeApi::UpdateSemantics, 1) \
V(PlatformConfigurationNativeApi::SetNeedsReportTimings, 1) \
V(PlatformConfigurationNativeApi::SetIsolateDebugName, 1) \
Expand Down
10 changes: 9 additions & 1 deletion lib/ui/painting/image_dispose_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#define FML_USED_ON_EMBEDDER

#include "flutter/common/task_runners.h"
#include "flutter/fml/synchronization/count_down_latch.h"
#include "flutter/fml/synchronization/waitable_event.h"
#include "flutter/lib/ui/painting/canvas.h"
#include "flutter/lib/ui/painting/image.h"
Expand Down Expand Up @@ -57,6 +58,10 @@ TEST_F(ImageDisposeTest, ImageReleasedAfterFrameAndDisposePictureAndLayer) {
};

Settings settings = CreateSettingsForFixture();
fml::CountDownLatch frame_latch{2};
settings.frame_rasterized_callback = [&frame_latch](const FrameTiming& t) {
frame_latch.CountDown();
};
auto task_runner = CreateNewThread();
TaskRunners task_runners("test", // label
GetCurrentTaskRunner(), // platform
Expand All @@ -83,12 +88,15 @@ TEST_F(ImageDisposeTest, ImageReleasedAfterFrameAndDisposePictureAndLayer) {
shell->RunEngine(std::move(configuration), [&](auto result) {
ASSERT_EQ(result, Engine::RunStatus::Success);
});

message_latch_.Wait();

ASSERT_TRUE(current_display_list_);
ASSERT_TRUE(current_image_);

// Wait for 2 frames to be rasterized. The 2nd frame releases resources of the
// 1st frame.
frame_latch.Wait();

// Force a drain the SkiaUnrefQueue. The engine does this normally as frames
// pump, but we force it here to make the test more deterministic.
message_latch_.Reset();
Expand Down
6 changes: 3 additions & 3 deletions lib/ui/window.dart
Original file line number Diff line number Diff line change
Expand Up @@ -362,12 +362,12 @@ class FlutterView {
return true;
}());
if (validRender) {
_render(scene as _NativeScene);
_render(viewId, scene as _NativeScene);
}
}

@Native<Void Function(Pointer<Void>)>(symbol: 'PlatformConfigurationNativeApi::Render')
external static void _render(_NativeScene scene);
@Native<Void Function(Int64, Pointer<Void>)>(symbol: 'PlatformConfigurationNativeApi::Render')
external static void _render(int viewId, _NativeScene scene);

/// Change the retained semantics data about this [FlutterView].
///
Expand Down
5 changes: 3 additions & 2 deletions lib/ui/window/platform_configuration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -449,9 +449,10 @@ void PlatformConfiguration::CompletePlatformMessageResponse(
response->Complete(std::make_unique<fml::DataMapping>(std::move(data)));
}

void PlatformConfigurationNativeApi::Render(Scene* scene) {
void PlatformConfigurationNativeApi::Render(int64_t view_id, Scene* scene) {
UIDartState::ThrowIfUIOperationsProhibited();
UIDartState::Current()->platform_configuration()->client()->Render(scene);
UIDartState::Current()->platform_configuration()->client()->Render(view_id,
scene);
}

void PlatformConfigurationNativeApi::SetNeedsReportTimings(bool value) {
Expand Down
4 changes: 2 additions & 2 deletions lib/ui/window/platform_configuration.h
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class PlatformConfigurationClient {
/// @brief Updates the client's rendering on the GPU with the newly
/// provided Scene.
///
virtual void Render(Scene* scene) = 0;
virtual void Render(int64_t view_id, Scene* scene) = 0;

//--------------------------------------------------------------------------
/// @brief Receives an updated semantics tree from the Framework.
Expand Down Expand Up @@ -557,7 +557,7 @@ class PlatformConfigurationNativeApi {

static void ScheduleFrame();

static void Render(Scene* scene);
static void Render(int64_t view_id, Scene* scene);

static void UpdateSemantics(SemanticsUpdate* update);

Expand Down
158 changes: 158 additions & 0 deletions lib/ui/window/platform_configuration_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,166 @@
#include "flutter/shell/common/shell_test.h"
#include "flutter/shell/common/thread_host.h"
#include "flutter/testing/testing.h"
#include "gmock/gmock.h"

namespace flutter {

namespace {

static constexpr int64_t kImplicitViewId = 0;

static void PostSync(const fml::RefPtr<fml::TaskRunner>& task_runner,
const fml::closure& task) {
fml::AutoResetWaitableEvent latch;
fml::TaskRunner::RunNowOrPostTask(task_runner, [&latch, &task] {
task();
latch.Signal();
});
latch.Wait();
}

class MockRuntimeDelegate : public RuntimeDelegate {
public:
MOCK_METHOD(std::string, DefaultRouteName, (), (override));
MOCK_METHOD(void, ScheduleFrame, (bool), (override));
MOCK_METHOD(void,
Render,
(int64_t, std::unique_ptr<flutter::LayerTree>, float),
(override));
MOCK_METHOD(void,
UpdateSemantics,
(SemanticsNodeUpdates, CustomAccessibilityActionUpdates),
(override));
MOCK_METHOD(void,
HandlePlatformMessage,
(std::unique_ptr<PlatformMessage>),
(override));
MOCK_METHOD(FontCollection&, GetFontCollection, (), (override));
MOCK_METHOD(std::shared_ptr<AssetManager>, GetAssetManager, (), (override));
MOCK_METHOD(void, OnRootIsolateCreated, (), (override));
MOCK_METHOD(void,
UpdateIsolateDescription,
(const std::string, int64_t),
(override));
MOCK_METHOD(void, SetNeedsReportTimings, (bool), (override));
MOCK_METHOD(std::unique_ptr<std::vector<std::string>>,
ComputePlatformResolvedLocale,
(const std::vector<std::string>&),
(override));
MOCK_METHOD(void, RequestDartDeferredLibrary, (intptr_t), (override));
MOCK_METHOD(std::weak_ptr<PlatformMessageHandler>,
GetPlatformMessageHandler,
(),
(const, override));
MOCK_METHOD(void, SendChannelUpdate, (std::string, bool), (override));
MOCK_METHOD(double,
GetScaledFontSize,
(double font_size, int configuration_id),
(const, override));
};

class MockPlatformMessageHandler : public PlatformMessageHandler {
public:
MOCK_METHOD(void,
HandlePlatformMessage,
(std::unique_ptr<PlatformMessage> message),
(override));
MOCK_METHOD(bool,
DoesHandlePlatformMessageOnPlatformThread,
(),
(const, override));
MOCK_METHOD(void,
InvokePlatformMessageResponseCallback,
(int response_id, std::unique_ptr<fml::Mapping> mapping),
(override));
MOCK_METHOD(void,
InvokePlatformMessageEmptyResponseCallback,
(int response_id),
(override));
};

// A class that can launch a RuntimeController with the specified
// RuntimeDelegate.
//
// To use this class, contruct this class with Create, call LaunchRootIsolate,
// and use the controller with ControllerTaskSync().
class RuntimeControllerContext {
public:
using ControllerCallback = std::function<void(RuntimeController&)>;

[[nodiscard]] static std::unique_ptr<RuntimeControllerContext> Create(
Settings settings, //
const TaskRunners& task_runners, //
RuntimeDelegate& client) {
auto [vm, isolate_snapshot] = Shell::InferVmInitDataFromSettings(settings);
FML_CHECK(vm) << "Must be able to initialize the VM.";
// Construct the class with `new` because `make_unique` has no access to the
// private constructor.
RuntimeControllerContext* raw_pointer = new RuntimeControllerContext(
settings, task_runners, client, std::move(vm), isolate_snapshot);
return std::unique_ptr<RuntimeControllerContext>(raw_pointer);
}

~RuntimeControllerContext() {
PostSync(task_runners_.GetUITaskRunner(),
[&]() { runtime_controller_.reset(); });
}

// Launch the root isolate. The post_launch callback will be executed in the
// same UI task, which can be used to create initial views.
void LaunchRootIsolate(RunConfiguration& configuration,
ControllerCallback post_launch) {
PostSync(task_runners_.GetUITaskRunner(), [&]() {
bool launch_success = runtime_controller_->LaunchRootIsolate(
settings_, //
[]() {}, //
configuration.GetEntrypoint(), //
configuration.GetEntrypointLibrary(), //
configuration.GetEntrypointArgs(), //
configuration.TakeIsolateConfiguration()); //
ASSERT_TRUE(launch_success);
post_launch(*runtime_controller_);
});
}

// Run a task that operates the RuntimeController on the UI thread, and wait
// for the task to end.
void ControllerTaskSync(ControllerCallback task) {
ASSERT_TRUE(runtime_controller_);
ASSERT_TRUE(task);
PostSync(task_runners_.GetUITaskRunner(),
[&]() { task(*runtime_controller_); });
}

private:
RuntimeControllerContext(const Settings& settings,
const TaskRunners& task_runners,
RuntimeDelegate& client,
DartVMRef vm,
fml::RefPtr<const DartSnapshot> isolate_snapshot)
: settings_(settings),
task_runners_(task_runners),
isolate_snapshot_(std::move(isolate_snapshot)),
vm_(std::move(vm)),
runtime_controller_(std::make_unique<RuntimeController>(
client,
&vm_,
std::move(isolate_snapshot_),
settings.idle_notification_callback, // idle notification callback
flutter::PlatformData(), // platform data
settings.isolate_create_callback, // isolate create callback
settings.isolate_shutdown_callback, // isolate shutdown callback
settings.persistent_isolate_data, // persistent isolate data
UIDartState::Context{task_runners})) {}

Settings settings_;
TaskRunners task_runners_;
fml::RefPtr<const DartSnapshot> isolate_snapshot_;
DartVMRef vm_;
std::unique_ptr<RuntimeController> runtime_controller_;
};
} // namespace

namespace testing {

class PlatformConfigurationTest : public ShellTest {};
Expand Down
28 changes: 14 additions & 14 deletions runtime/dart_vm.cc
Original file line number Diff line number Diff line change
Expand Up @@ -219,22 +219,22 @@ static std::vector<const char*> ProfilingFlags(bool enable_profiling) {
// flags.
if (enable_profiling) {
return {
// This is the default. But just be explicit.
"--profiler",
// This instructs the profiler to walk C++ frames, and to include
// them in the profile.
"--profile-vm",
// This is the default. But just be explicit.
"--profiler",
// This instructs the profiler to walk C++ frames, and to include
// them in the profile.
"--profile-vm",
#if FML_OS_IOS && FML_ARCH_CPU_ARM_FAMILY && FML_ARCH_CPU_ARMEL
// Set the profiler interrupt period to 500Hz instead of the
// default 1000Hz on 32-bit iOS devices to reduce average and worst
// case frame build times.
//
// Note: profile_period is time in microseconds between sampling
// events, not frequency. Frequency is calculated 1/period (or
// 1,000,000 / 2,000 -> 500Hz in this case).
"--profile_period=2000",
// Set the profiler interrupt period to 500Hz instead of the
// default 1000Hz on 32-bit iOS devices to reduce average and worst
// case frame build times.
//
// Note: profile_period is time in microseconds between sampling
// events, not frequency. Frequency is calculated 1/period (or
// 1,000,000 / 2,000 -> 500Hz in this case).
"--profile_period=2000",
#else
"--profile_period=1000",
"--profile_period=1000",
#endif // FML_OS_IOS && FML_ARCH_CPU_ARM_FAMILY && FML_ARCH_CPU_ARMEL
};
} else {
Expand Down
7 changes: 3 additions & 4 deletions runtime/runtime_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -341,15 +341,14 @@ void RuntimeController::ScheduleFrame() {
}

// |PlatformConfigurationClient|
void RuntimeController::Render(Scene* scene) {
// TODO(dkwingsmt): Currently only supports a single window.
int64_t view_id = kFlutterImplicitViewId;
void RuntimeController::Render(int64_t view_id, Scene* scene) {
const ViewportMetrics* view_metrics =
UIDartState::Current()->platform_configuration()->GetMetrics(view_id);
if (view_metrics == nullptr) {
return;
}
client_.Render(scene->takeLayerTree(view_metrics->physical_width,
client_.Render(view_id,
scene->takeLayerTree(view_metrics->physical_width,
view_metrics->physical_height),
view_metrics->device_pixel_ratio);
}
Expand Down
2 changes: 1 addition & 1 deletion runtime/runtime_controller.h
Original file line number Diff line number Diff line change
Expand Up @@ -658,7 +658,7 @@ class RuntimeController : public PlatformConfigurationClient {
void ScheduleFrame() override;

// |PlatformConfigurationClient|
void Render(Scene* scene) override;
void Render(int64_t view_id, Scene* scene) override;

// |PlatformConfigurationClient|
void UpdateSemantics(SemanticsUpdate* update) override;
Expand Down
3 changes: 2 additions & 1 deletion runtime/runtime_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,8 @@ class RuntimeDelegate {

virtual void ScheduleFrame(bool regenerate_layer_trees = true) = 0;

virtual void Render(std::unique_ptr<flutter::LayerTree> layer_tree,
virtual void Render(int64_t view_id,
std::unique_ptr<flutter::LayerTree> layer_tree,
float device_pixel_ratio) = 0;

virtual void UpdateSemantics(SemanticsNodeUpdates update,
Expand Down
Loading