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 1 commit
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
1950e72
Impl engine
dkwingsmt Feb 12, 2024
f55dfdf
Web
dkwingsmt Feb 12, 2024
7f76c5f
Rename to RequestWarmUpFrame and add web time
dkwingsmt Feb 13, 2024
31a5ea3
Change to scheduleWarmUpFrame and EndWarmUpFrame
dkwingsmt Feb 13, 2024
590287d
Comment
dkwingsmt Feb 13, 2024
40b269b
Doc
dkwingsmt Feb 13, 2024
2d70a0f
Simplify web implementation
dkwingsmt Feb 14, 2024
4af9f06
Fix comment
dkwingsmt Feb 14, 2024
bfe5570
More doc
dkwingsmt Feb 14, 2024
21439c4
Fix doc
dkwingsmt Feb 14, 2024
1bd21db
More doc
dkwingsmt Feb 14, 2024
4f41658
Fix linter
dkwingsmt Feb 14, 2024
eeac064
Fix comment
dkwingsmt Feb 14, 2024
9c5bce4
Add test
dkwingsmt Feb 15, 2024
cdcf71a
Fix test
dkwingsmt Feb 15, 2024
7ab7d8e
Better test
dkwingsmt Feb 15, 2024
afbcfae
Merge remote-tracking branch 'origin/main' into force-sync-frame
dkwingsmt Feb 15, 2024
7381087
Simplify test and add platformdispatcher test
dkwingsmt Feb 15, 2024
05d3d2d
Better structure
dkwingsmt Feb 15, 2024
06957bb
Better name
dkwingsmt Feb 15, 2024
68953c0
Merge branch 'main' into force-sync-frame
dkwingsmt Feb 15, 2024
a9b7511
Merge branch 'main' into force-sync-frame
dkwingsmt Feb 20, 2024
7789d11
Original changes
dkwingsmt Feb 20, 2024
06b4a50
Merge branch 'force-sync-frame' into reland-3-mv-pipeline-base
dkwingsmt Feb 20, 2024
3464c05
Additional changes
dkwingsmt Feb 20, 2024
fe14311
Comments
dkwingsmt Feb 20, 2024
5b0719b
Merge branch 'main' into reland-3-mv-pipeline
dkwingsmt Feb 20, 2024
8731e47
Add web platform dispatcher test
dkwingsmt Feb 20, 2024
cdeffd9
Merge branch 'main' into force-sync-frame
dkwingsmt Feb 20, 2024
4c91a9e
Merge branch 'force-sync-frame' into reland-3-mv-pipeline
dkwingsmt Feb 20, 2024
34998fa
Fix lint
dkwingsmt Feb 20, 2024
658d5d1
Merge branch 'main' into reland-3-mv-pipeline
dkwingsmt Feb 21, 2024
946ffb5
Merge remote-tracking branch 'origin/main' into reland-3-mv-pipeline
dkwingsmt Feb 23, 2024
f9d5ad3
Merge remote-tracking branch 'dkwingsmt/reland-3-mv-pipeline' into re…
dkwingsmt Feb 23, 2024
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
Prev Previous commit
Next Next commit
Rename to RequestWarmUpFrame and add web time
  • Loading branch information
dkwingsmt committed Feb 13, 2024
commit 7f76c5fa61ac599b2c328d1fb91fa7d70cab7afb
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) \
V(PlatformConfigurationNativeApi::DefaultRouteName) \
V(PlatformConfigurationNativeApi::ScheduleFrame) \
V(PlatformConfigurationNativeApi::ForceSyncFrame) \
V(PlatformConfigurationNativeApi::RequestWarmUpFrame) \
V(PlatformConfigurationNativeApi::Render) \
V(PlatformConfigurationNativeApi::UpdateSemantics) \
V(PlatformConfigurationNativeApi::SetNeedsReportTimings) \
Expand Down
10 changes: 5 additions & 5 deletions lib/ui/platform_dispatcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,7 @@ class PlatformDispatcher {
///
/// * [SchedulerBinding], the Flutter framework class which manages the
/// scheduling of frames.
/// * [forceSyncFrame], a similar method that is used in rare cases that
/// * [requestWarmUpFrame], a similar method that is used in rare cases that
/// a frame must be rendered immediately.
void scheduleFrame() => _scheduleFrame();

Expand All @@ -816,7 +816,7 @@ class PlatformDispatcher {
/// completed synchronously within this call.
///
/// Prefer [scheduleFrame] to update the display in normal operation. The
/// [forceSyncFrame] method is designed for situations that require a frame is
/// [requestWarmUpFrame] method is designed for situations that require a frame is
/// rendered as soon as possible, even at the cost of rendering quality. An
/// example of using this method is [SchedulerBinding.scheduleWarmUpFrame],
/// which is called during application startup so that the first frame can be
Expand All @@ -826,10 +826,10 @@ class PlatformDispatcher {
///
/// * [SchedulerBinding.scheduleWarmUpFrame], which uses this method.
/// * [scheduleFrame].
void forceSyncFrame() => _forceSyncFrame();
void requestWarmUpFrame() => _requestWarmUpFrame();

@Native<Void Function()>(symbol: 'PlatformConfigurationNativeApi::ForceSyncFrame')
external static void _forceSyncFrame();
@Native<Void Function()>(symbol: 'PlatformConfigurationNativeApi::RequestWarmUpFrame')
external static void _requestWarmUpFrame();

/// Additional accessibility features that may be enabled by the platform.
AccessibilityFeatures get accessibilityFeatures => _configuration.accessibilityFeatures;
Expand Down
7 changes: 5 additions & 2 deletions lib/ui/window/platform_configuration.cc
Original file line number Diff line number Diff line change
Expand Up @@ -589,9 +589,12 @@ void PlatformConfigurationNativeApi::ScheduleFrame() {
UIDartState::Current()->platform_configuration()->client()->ScheduleFrame();
}

void PlatformConfigurationNativeApi::ForceSyncFrame() {
void PlatformConfigurationNativeApi::RequestWarmUpFrame() {
UIDartState::ThrowIfUIOperationsProhibited();
UIDartState::Current()->platform_configuration()->client()->ForceSyncFrame();
UIDartState::Current()
->platform_configuration()
->client()
->RequestWarmUpFrame();
}

void PlatformConfigurationNativeApi::UpdateSemantics(SemanticsUpdate* update) {
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 @@ -68,7 +68,7 @@ class PlatformConfigurationClient {
//--------------------------------------------------------------------------
/// @brief
///
virtual void ForceSyncFrame() = 0;
virtual void RequestWarmUpFrame() = 0;

//--------------------------------------------------------------------------
/// @brief Updates the client's rendering on the GPU with the newly
Expand Down Expand Up @@ -562,7 +562,7 @@ class PlatformConfigurationNativeApi {

static void ScheduleFrame();

static void ForceSyncFrame();
static void RequestWarmUpFrame();

static void Render(int64_t view_id,
Scene* scene,
Expand Down
2 changes: 1 addition & 1 deletion lib/web_ui/lib/platform_dispatcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ abstract class PlatformDispatcher {

void scheduleFrame();

void forceSyncFrame();
void requestWarmUpFrame();

Future<void> render(Scene scene, [FlutterView view]);

Expand Down
10 changes: 5 additions & 5 deletions lib/web_ui/lib/src/engine/initialization.dart
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ void debugResetEngineInitializationState() {
_initializationState = DebugEngineInitializationState.uninitialized;
}

void renderFrame(int timeInMicroseconds) {
void renderFrame(int timeMicroseconds) {
frameTimingsOnVsync();

// In Flutter terminology "building a frame" consists of "beginning
Expand All @@ -114,7 +114,7 @@ void renderFrame(int timeInMicroseconds) {
frameTimingsOnBuildStart();
if (EnginePlatformDispatcher.instance.onBeginFrame != null) {
EnginePlatformDispatcher.instance.invokeOnBeginFrame(
Duration(microseconds: timeInMicroseconds));
Duration(microseconds: timeMicroseconds));
}

if (EnginePlatformDispatcher.instance.onDrawFrame != null) {
Expand Down Expand Up @@ -196,9 +196,9 @@ Future<void> initializeEngineServices({
});
}
};
warmUpFrameCallback = () {
// TODO(dkwingsmt): Can we give it some time value?
renderFrame(0);
requestWarmUpFrameCallback = () {
final int timeMicroseconds = (1000 * domWindow.performance.now()).toInt();
renderFrame(timeMicroseconds);
};

assetManager ??= ui_web.AssetManager(assetBase: configuration.assetBase);
Expand Down
10 changes: 5 additions & 5 deletions lib/web_ui/lib/src/engine/platform_dispatcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ ui.VoidCallback? scheduleFrameCallback;
/// Since this will probably call [PlatformWindow.render] outside of an
/// animation frame, the render will not be actually presented, but just to warm
/// up the framework.
ui.VoidCallback? warmUpFrameCallback;
ui.VoidCallback? requestWarmUpFrameCallback;

/// Signature of functions added as a listener to high contrast changes
typedef HighContrastListener = void Function(bool enabled);
Expand Down Expand Up @@ -779,11 +779,11 @@ class EnginePlatformDispatcher extends ui.PlatformDispatcher {
}

@override
void forceSyncFrame() {
if (warmUpFrameCallback == null) {
throw Exception('warmUpFrameCallback must be initialized first.');
void requestWarmUpFrame() {
if (requestWarmUpFrameCallback == null) {
throw Exception('requestWarmUpFrameCallback must be initialized first.');
}
warmUpFrameCallback!();
requestWarmUpFrameCallback!();
}

/// Updates the application's rendering on the GPU with the newly provided
Expand Down
4 changes: 2 additions & 2 deletions runtime/runtime_controller.cc
Original file line number Diff line number Diff line change
Expand Up @@ -341,8 +341,8 @@ void RuntimeController::ScheduleFrame() {
}

// |PlatformConfigurationClient|
void RuntimeController::ForceSyncFrame() {
client_.ForceSyncFrame();
void RuntimeController::RequestWarmUpFrame() {
client_.RequestWarmUpFrame();
}

// |PlatformConfigurationClient|
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 ForceSyncFrame() override;
void RequestWarmUpFrame() override;

// |PlatformConfigurationClient|
void Render(Scene* scene, double width, double height) override;
Expand Down
2 changes: 1 addition & 1 deletion runtime/runtime_delegate.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class RuntimeDelegate {

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

virtual void ForceSyncFrame() = 0;
virtual void RequestWarmUpFrame() = 0;

virtual void Render(std::unique_ptr<flutter::LayerTree> layer_tree,
float device_pixel_ratio) = 0;
Expand Down
2 changes: 1 addition & 1 deletion shell/common/animator.cc
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ void Animator::AwaitVSync() {
}
}

void Animator::ForceSyncFrame() {
void Animator::RequestWarmUpFrame() {
TRACE_EVENT_ASYNC_BEGIN0("flutter", "Forced Frame Request Pending",
frame_request_number_);
regenerate_layer_trees_ = true;
Expand Down
2 changes: 1 addition & 1 deletion shell/common/animator.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class Animator final {

void RequestFrame(bool regenerate_layer_trees = true);

void ForceSyncFrame();
void RequestWarmUpFrame();

//--------------------------------------------------------------------------
/// @brief Tells the Animator that this frame needs to render another view.
Expand Down
4 changes: 2 additions & 2 deletions shell/common/engine.cc
Original file line number Diff line number Diff line change
Expand Up @@ -462,8 +462,8 @@ void Engine::ScheduleFrame(bool regenerate_layer_trees) {
animator_->RequestFrame(regenerate_layer_trees);
}

void Engine::ForceSyncFrame() {
animator_->ForceSyncFrame();
void Engine::RequestWarmUpFrame() {
animator_->RequestWarmUpFrame();
}

void Engine::Render(std::unique_ptr<flutter::LayerTree> layer_tree,
Expand Down
2 changes: 1 addition & 1 deletion shell/common/engine.h
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ class Engine final : public RuntimeDelegate, PointerDataDispatcher::Delegate {
void ScheduleFrame() { ScheduleFrame(true); }

// |RuntimeDelegate|
void ForceSyncFrame() override;
void RequestWarmUpFrame() override;

// |RuntimeDelegate|
FontCollection& GetFontCollection() override;
Expand Down
2 changes: 1 addition & 1 deletion shell/common/engine_unittests.cc
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class MockRuntimeDelegate : public RuntimeDelegate {
public:
MOCK_METHOD(std::string, DefaultRouteName, (), (override));
MOCK_METHOD(void, ScheduleFrame, (bool), (override));
MOCK_METHOD(void, ForceSyncFrame, (), (override));
MOCK_METHOD(void, RequestWarmUpFrame, (), (override));
MOCK_METHOD(void,
Render,
(std::unique_ptr<flutter::LayerTree>, float),
Expand Down