This repository was archived by the owner on Feb 25, 2025. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6k
fml: Use CFRef where possible and add docs #56436
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This comment was marked as resolved.
This comment was marked as resolved.
Member
Author
|
|
cbracken
commented
Nov 7, 2024
cbracken
commented
Nov 7, 2024
shell/platform/darwin/graphics/FlutterDarwinContextMetalSkia.mm
Outdated
Show resolved
Hide resolved
shell/platform/darwin/graphics/FlutterDarwinContextMetalSkia.mm
Outdated
Show resolved
Hide resolved
Document where CFRef takes over or hands back ownership of the underlying CoreFoundation object memory. Migrates manual CoreFoundation object management to CFRef in: * impeller/golden_tests/metal_screenshot.mm * shell/platform/darwin/graphics/FlutterDarwinContextMetalSkia.mm * shell/platform/darwin/graphics/FlutterDarwinExternalTextureMetal.mm * shell/platform/darwin/ios/framework/Source/FlutterView.mm * shell/platform/darwin/macos/framework/Source/FlutterSurface.mm Adds a Retain() method to take shared ownership of the underlying object, as opposed to Reset, where ownership is transferred to the CFRef wrapper. Adds a Get() method to make dealing with bridged Objective-C casts more convenient: ```objc fml::CFRef<CFStringRef> cfString(...); NSString* aString = (__bridge NSString*)cfString.Get(); ``` as opposed to: ```objc fml::CFRef<CFStringRef> cfString(...); NSString* aString = (__bridge NSString*)static_cast<CFStringRef>(cfString); ```
stuartmorgan-g
approved these changes
Nov 8, 2024
Contributor
stuartmorgan-g
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
engine-flutter-autoroll
added a commit
to engine-flutter-autoroll/flutter
that referenced
this pull request
Nov 8, 2024
auto-submit bot
pushed a commit
to flutter/flutter
that referenced
this pull request
Nov 8, 2024
…158402) flutter/engine@6b77347...b7134d3 2024-11-08 [email protected] fml: Use CFRef where possible and add docs (flutter/engine#56436) 2024-11-08 [email protected] [web] Split all 1MB+ fallback fonts (including CJK) (flutter/engine#56388) 2024-11-08 [email protected] yapf: Add more detailed error message and TODO (flutter/engine#56458) If this roll has caused a breakage, revert this CL and stop the roller using the controls here: https://autoroll.skia.org/r/flutter-engine-flutter-autoroll Please CC [email protected],[email protected] on the revert to ensure that a human is aware of the problem. To file a bug in Flutter: https://github.com/flutter/flutter/issues/new/choose To report a problem with the AutoRoller itself, please file a bug: https://issues.skia.org/issues/new?component=1389291&template=1850622 Documentation for the AutoRoller is here: https://skia.googlesource.com/buildbot/+doc/main/autoroll/README.md
nick9822
pushed a commit
to nick9822/flutter
that referenced
this pull request
Dec 18, 2024
Document where CFRef takes over or hands back ownership of the underlying CoreFoundation object memory. Migrates manual CoreFoundation object management to CFRef in: * impeller/golden_tests/metal_screenshot.mm * shell/platform/darwin/graphics/FlutterDarwinContextMetalSkia.mm * shell/platform/darwin/graphics/FlutterDarwinExternalTextureMetal.mm * shell/platform/darwin/ios/framework/Source/FlutterView.mm * shell/platform/darwin/macos/framework/Source/FlutterSurface.mm Adds a `Retain()` method to take shared ownership of the underlying object, as opposed to Reset, where ownership is transferred to the CFRef wrapper. Adds a `Get()` method to make dealing with bridged Objective-C casts more convenient: ```objc fml::CFRef<CFStringRef> cfString(...); NSString* aString = (__bridge NSString*)cfString.Get(); ``` as opposed to: ```objc fml::CFRef<CFStringRef> cfString(...); NSString* aString = (__bridge NSString*)static_cast<CFStringRef>(cfString); ``` I considered making use of `fml::scoped_policy::OwnershipPolicy` to add a second parameter to the ctor and `Reset` but, but I think documentation and addition of a `Retain()` method makes things a little clearer at the call site. It's also more consistent with `sk_cfp`, which we use in some Skia bits of the codebase. [C++, Objective-C, Java style guides]: https://github.com/flutter/engine/blob/main/CONTRIBUTING.md#style
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Labels
affects: desktop
autosubmit
Merge PR when tree becomes green via auto submit App
e: impeller
platform-ios
platform-macos
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Document where CFRef takes over or hands back ownership of the underlying CoreFoundation object memory.
Migrates manual CoreFoundation object management to CFRef in:
Adds a
Retain()method to take shared ownership of the underlying object, as opposed to Reset, where ownership is transferred to the CFRef wrapper.Adds a
Get()method to make dealing with bridged Objective-C casts more convenient:as opposed to:
I considered making use of
fml::scoped_policy::OwnershipPolicyto add a second parameter to the ctor andResetbut, but I think documentation and addition of aRetain()method makes things a little clearer at the call site. It's also more consistent withsk_cfp, which we use in some Skia bits of the codebase.Issue: flutter/flutter#137801
Pre-launch Checklist
///).If you need help, consider asking for advice on the #hackers-new channel on Discord.