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

Commit faa3467

Browse files
committed
Migrate engine to use multi-window API
The goal here is to convert from the window singleton to an API that has the concept of multiple windows. I'm not attempting to actually enable creating multiple windows here, just migrate to an API that has a concept of multiple windows.
1 parent 8540e00 commit faa3467

File tree

86 files changed

+4095
-2461
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

86 files changed

+4095
-2461
lines changed

ci/licenses_golden/licenses_flutter

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -369,6 +369,7 @@ FILE: ../../../flutter/lib/ui/painting/single_frame_codec.h
369369
FILE: ../../../flutter/lib/ui/painting/vertices.cc
370370
FILE: ../../../flutter/lib/ui/painting/vertices.h
371371
FILE: ../../../flutter/lib/ui/painting/vertices_unittests.cc
372+
FILE: ../../../flutter/lib/ui/platform_dispatcher.dart
372373
FILE: ../../../flutter/lib/ui/plugins.dart
373374
FILE: ../../../flutter/lib/ui/plugins/callback_cache.cc
374375
FILE: ../../../flutter/lib/ui/plugins/callback_cache.h
@@ -494,6 +495,7 @@ FILE: ../../../flutter/lib/web_ui/lib/src/engine/keyboard.dart
494495
FILE: ../../../flutter/lib/web_ui/lib/src/engine/mouse_cursor.dart
495496
FILE: ../../../flutter/lib/web_ui/lib/src/engine/onscreen_logging.dart
496497
FILE: ../../../flutter/lib/web_ui/lib/src/engine/picture.dart
498+
FILE: ../../../flutter/lib/web_ui/lib/src/engine/platform_dispatcher.dart
497499
FILE: ../../../flutter/lib/web_ui/lib/src/engine/platform_views.dart
498500
FILE: ../../../flutter/lib/web_ui/lib/src/engine/plugins.dart
499501
FILE: ../../../flutter/lib/web_ui/lib/src/engine/pointer_binding.dart
@@ -548,6 +550,7 @@ FILE: ../../../flutter/lib/web_ui/lib/src/ui/natives.dart
548550
FILE: ../../../flutter/lib/web_ui/lib/src/ui/painting.dart
549551
FILE: ../../../flutter/lib/web_ui/lib/src/ui/path.dart
550552
FILE: ../../../flutter/lib/web_ui/lib/src/ui/path_metrics.dart
553+
FILE: ../../../flutter/lib/web_ui/lib/src/ui/platform_dispatcher.dart
551554
FILE: ../../../flutter/lib/web_ui/lib/src/ui/pointer.dart
552555
FILE: ../../../flutter/lib/web_ui/lib/src/ui/semantics.dart
553556
FILE: ../../../flutter/lib/web_ui/lib/src/ui/test_embedding.dart

lib/ui/compositing.dart

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ part of dart.ui;
1010
///
1111
/// To create a Scene object, use a [SceneBuilder].
1212
///
13-
/// Scene objects can be displayed on the screen using the
14-
/// [Window.render] method.
13+
/// Scene objects can be displayed on the screen using the [FlutterView.render]
14+
/// method.
1515
@pragma('vm:entry-point')
1616
class Scene extends NativeFieldWrapperClass2 {
1717
/// This class is created by the engine, and should not be instantiated
@@ -179,7 +179,7 @@ class PhysicalShapeEngineLayer extends _EngineLayerWrapper {
179179

180180
/// Builds a [Scene] containing the given visuals.
181181
///
182-
/// A [Scene] can then be rendered using [Window.render].
182+
/// A [Scene] can then be rendered using [FlutterView.render].
183183
///
184184
/// To draw graphical operations onto a [Scene], first create a
185185
/// [Picture] using a [PictureRecorder] and a [Canvas], and then add
@@ -648,13 +648,13 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
648648
/// - 0x08: visualizeEngineStatistics - graph UI thread frame times
649649
/// Set enabledOptions to 0x0F to enable all the currently defined features.
650650
///
651-
/// The "UI thread" is the thread that includes all the execution of
652-
/// the main Dart isolate (the isolate that can call
653-
/// [Window.render]). The UI thread frame time is the total time
654-
/// spent executing the [Window.onBeginFrame] callback. The "raster
655-
/// thread" is the thread (running on the CPU) that subsequently
656-
/// processes the [Scene] provided by the Dart code to turn it into
657-
/// GPU commands and send it to the GPU.
651+
/// The "UI thread" is the thread that includes all the execution of the main
652+
/// Dart isolate (the isolate that can call [FlutterView.render]). The UI
653+
/// thread frame time is the total time spent executing the
654+
/// [PlatformDispatcher.onBeginFrame] callback. The "raster thread" is the
655+
/// thread (running on the CPU) that subsequently processes the [Scene]
656+
/// provided by the Dart code to turn it into GPU commands and send it to the
657+
/// GPU.
658658
///
659659
/// See also the [PerformanceOverlayOption] enum in the rendering library.
660660
/// for more details.
@@ -795,7 +795,7 @@ class SceneBuilder extends NativeFieldWrapperClass2 {
795795
///
796796
/// Returns a [Scene] containing the objects that have been added to
797797
/// this scene builder. The [Scene] can then be displayed on the
798-
/// screen with [Window.render].
798+
/// screen with [FlutterView.render].
799799
///
800800
/// After calling this function, the scene builder object is invalid and
801801
/// cannot be used further.

lib/ui/compositing/scene.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,10 @@ Scene::Scene(std::shared_ptr<flutter::Layer> rootLayer,
4242
uint32_t rasterizerTracingThreshold,
4343
bool checkerboardRasterCacheImages,
4444
bool checkerboardOffscreenLayers) {
45+
// Currently only supports a single window.
4546
auto viewport_metrics = UIDartState::Current()
4647
->platform_configuration()
47-
->window()
48+
->get_window(0)
4849
->viewport_metrics();
4950

5051
layer_tree_ = std::make_unique<LayerTree>(

lib/ui/dart_ui.gni

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ dart_ui_files = [
1313
"//flutter/lib/ui/lerp.dart",
1414
"//flutter/lib/ui/natives.dart",
1515
"//flutter/lib/ui/painting.dart",
16+
"//flutter/lib/ui/platform_dispatcher.dart",
1617
"//flutter/lib/ui/plugins.dart",
1718
"//flutter/lib/ui/pointer.dart",
1819
"//flutter/lib/ui/semantics.dart",

0 commit comments

Comments
 (0)