-
Notifications
You must be signed in to change notification settings - Fork 29.7k
Closed
flutter/engine
#34642Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: performanceRelates to speed or footprint issues (see "perf:" labels)Relates to speed or footprint issues (see "perf:" labels)engineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.platform-iosiOS applications specificallyiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version
Description
void PlatformViewIOS::attachView() {
auto flutter_view = static_cast<FlutterView*>(owner_controller_.get().view);
auto ca_layer = fml::scoped_nsobject<CALayer>{[[flutter_view layer] retain]};
ios_surface_ = IOSSurface::Create(ios_context_, ca_layer);
FML_DCHECK(ios_surface_ != nullptr);
...
}
During the startup process of the flutter engine, this function(PlatformViewIOS::attachView()) will be called multiple times, which will result in unnecessary creation and deletion of ios_surface_ (ios_surface_ = IOSSurface::Create(ios_context_, ca_layer))many times.
First time: shell/platform/darwin/ios/platform_view_ios.mm
void PlatformViewIOS::SetOwnerViewController(fml::WeakPtr<FlutterViewController> owner_controller) {
// line 101-103
if (owner_controller_ && [owner_controller_.get() isViewLoaded]) {
this->attachView();
}
...
}
second time: /shell/platform/darwin/ios/framework/Source/FlutterEngine.mm
// line 391-394
- (void)attachView {
self.iosPlatformView->attachView();
[_textInputPlugin.get() setupIndirectScribbleInteraction:self.viewController];
}
Metadata
Metadata
Assignees
Labels
P2Important issues not at the top of the work listImportant issues not at the top of the work listc: performanceRelates to speed or footprint issues (see "perf:" labels)Relates to speed or footprint issues (see "perf:" labels)engineflutter/engine related. See also e: labels.flutter/engine related. See also e: labels.platform-iosiOS applications specificallyiOS applications specificallyr: fixedIssue is closed as already fixed in a newer versionIssue is closed as already fixed in a newer version