Skip to content

Commit

Permalink
[web] Non-singleton implementation of ui.FlutterView (flutter#47806)
Browse files Browse the repository at this point in the history
- Provide a non-singleton implementation of `EngineFlutterView`.
- Move all common "view" logic into `EngineFlutterView`.
- Remove the unused `windowConfigurations` map from `EnginePlatformDispatcher`.
  • Loading branch information
mdebbar committed Nov 8, 2023
1 parent 88baf62 commit 71a6799
Show file tree
Hide file tree
Showing 3 changed files with 320 additions and 185 deletions.
15 changes: 6 additions & 9 deletions lib/web_ui/lib/src/engine/platform_dispatcher.dart
Original file line number Diff line number Diff line change
Expand Up @@ -130,24 +130,21 @@ class EnginePlatformDispatcher extends ui.PlatformDispatcher {
EngineFlutterDisplay.instance,
];

/// Adds [view] to the platform dispatcher's registry of [views].
void registerView(EngineFlutterView view) {
viewData[view.viewId] = view;
}

/// The current list of windows.
@override
Iterable<EngineFlutterView> get views => viewData.values;
final Map<int, EngineFlutterView> viewData = <int, EngineFlutterView>{};

/// Returns the [FlutterView] with the provided ID if one exists, or null
/// Returns the [EngineFlutterView] with the provided ID if one exists, or null
/// otherwise.
@override
EngineFlutterView? view({required int id}) => viewData[id];

/// A map of opaque platform window identifiers to window configurations.
///
/// This should be considered a protected member, only to be used by
/// [PlatformDispatcher] subclasses.
Map<Object, ViewConfiguration> get windowConfigurations => _windowConfigurations;
final Map<Object, ViewConfiguration> _windowConfigurations =
<Object, ViewConfiguration>{};

/// The [FlutterView] provided by the engine if the platform is unable to
/// create windows, or, for backwards compatibility.
///
Expand Down
Loading

0 comments on commit 71a6799

Please sign in to comment.