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 3 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
2 changes: 1 addition & 1 deletion DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ vars = {
# Dart is: https://github.com/dart-lang/sdk/blob/master/DEPS.
# You can use //tools/dart/create_updated_flutter_deps.py to produce
# updated revision list of existing dependencies.
'dart_revision': '26219fa05863420b5811ef509663ee13bc7432eb',
'dart_revision': '6fee8e27b8206acd82cd7ed6204941916a2568e5',

# WARNING: DO NOT EDIT MANUALLY
# The lines between blank lines above and below are generated by a script. See create_updated_flutter_deps.py
Expand Down
4 changes: 0 additions & 4 deletions shell/platform/darwin/macos/framework/Source/FlutterEngine.mm
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,6 @@ - (BOOL)runWithEntrypoint:(NSString*)entrypoint {
[self sendUserLocales];
[self updateWindowMetrics];
[self updateDisplayConfig];
self.viewController.flutterView.synchronousResizing = YES;
return YES;
}

Expand Down Expand Up @@ -359,9 +358,6 @@ - (void)setViewController:(FlutterViewController*)controller {
[self shutDownEngine];
_resourceContext = nil;
}
if (_engine) {
self.viewController.flutterView.synchronousResizing = YES;
}
}

- (id<FlutterBinaryMessenger>)binaryMessenger {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,10 @@ @interface FlutterResizeSynchronizer () {
// Used to block [requestCommit].
std::condition_variable _condBlockRequestCommit;

// Whether a frame was received; We don't block platform thread during resize
// until we know that framework is running and producing frames
BOOL _receivedFirstFrame;

// If NO, requestCommit calls are ignored until shouldEnsureSurfaceForSize is called with
// proper size.
BOOL _acceptingCommit;
Expand Down Expand Up @@ -50,6 +54,12 @@ - (void)beginResize:(CGSize)size notify:(dispatch_block_t)notify {
return;
}

if (!_receivedFirstFrame) {
// No blocking until framework produces at least one frame
notify();
return;
}

++_cookie;

// from now on, ignore all incoming commits until the block below gets
Expand Down Expand Up @@ -79,6 +89,11 @@ - (void)beginResize:(CGSize)size notify:(dispatch_block_t)notify {

- (BOOL)shouldEnsureSurfaceForSize:(CGSize)size {
std::unique_lock<std::mutex> lock(_mutex);

if (!_receivedFirstFrame) {
return YES;
}

if (!_acceptingCommit) {
if (CGSizeEqualToSize(_newSize, size)) {
_acceptingCommit = YES;
Expand All @@ -93,6 +108,8 @@ - (void)requestCommit {
return;
}

_receivedFirstFrame = YES;

_pendingCommit = YES;
if (_waiting) { // BeginResize is in progress, interrupt it and schedule commit call
_condBlockRequestCommit.notify_all();
Expand Down
7 changes: 0 additions & 7 deletions shell/platform/darwin/macos/framework/Source/FlutterView.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,6 @@
*/
@property(readwrite, nonatomic, nonnull) NSOpenGLContext* openGLContext;

/**
* Controls whether view resizing synchronously updates contents. This can only be enabled
* after the engine is running and producing frames, because during synchronous view resizing the
* platform thread is blocked until engine produces frame with requested size.
*/
@property(readwrite, nonatomic) BOOL synchronousResizing;

- (nullable instancetype)initWithFrame:(NSRect)frame
shareContext:(nonnull NSOpenGLContext*)shareContext
reshapeListener:(nonnull id<FlutterViewReshapeListener>)reshapeListener
Expand Down
14 changes: 5 additions & 9 deletions shell/platform/darwin/macos/framework/Source/FlutterView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,11 @@ - (void)present {
}

- (void)reshaped {
if (self.synchronousResizing) {
CGSize scaledSize = [self convertSizeToBacking:self.bounds.size];
[_resizeSynchronizer beginResize:scaledSize
notify:^{
[_reshapeListener viewDidReshape:self];
}];
} else {
[_reshapeListener viewDidReshape:self];
}
CGSize scaledSize = [self convertSizeToBacking:self.bounds.size];
[_resizeSynchronizer beginResize:scaledSize
notify:^{
[_reshapeListener viewDidReshape:self];
}];
}

#pragma mark - NSView overrides
Expand Down
4 changes: 2 additions & 2 deletions tools/generate_package_config/bin/generate_from_legacy.dart
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ void main(List<String> args) async {
if (!File.fromUri(pubspec).existsSync()) {
continue;
}
// Default to 2.8 if not found to prevent all packages from accidentally
// Default to 2.7 if not found to prevent all packages from accidentally
// opting into NNBD.
languageVersion = await languageVersionFromPubspec(pubspec, name) ??
LanguageVersion(2, 8);
LanguageVersion(2, 7);
packages.add(Package(name, packageRoot,
languageVersion: languageVersion, packageUriRoot: uri));
}
Expand Down