RUM-4561 Delegate Drawable copy to background thread#2048
Merged
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #2048 +/- ##
===========================================
- Coverage 83.10% 83.02% -0.09%
===========================================
Files 494 494
Lines 17720 17688 -32
Branches 2686 2684 -2
===========================================
- Hits 14726 14684 -42
- Misses 2253 2259 +6
- Partials 741 745 +4
|
jonathanmos
approved these changes
May 23, 2024
| } | ||
|
|
||
| val resolvedWireframes = internalLogger.measureMethodCallPerf( | ||
| javaClass, |
Member
There was a problem hiding this comment.
Similar to what was done with WindowsOnDrawListener, do we need to also add this class to proguard rules to prevent classname obfuscation?
Contributor
Author
There was a problem hiding this comment.
Makes sense indeeed
0xnm
approved these changes
May 23, 2024
| override fun onSuccess(bitmap: Bitmap) { | ||
| mainThreadHandler.post { | ||
| @Suppress("ThreadSafety") // this runs on the main thread | ||
| executorService.submitSafe("drawOnCanvas", internalLogger) { |
Member
There was a problem hiding this comment.
is it safe to operate with bitmap/canvas from the worker thread on all Android versions?
Contributor
Author
There was a problem hiding this comment.
From the tests I've done, it seems so. I'll do more test to ensure it works on all levels.
Contributor
Author
There was a problem hiding this comment.
It does work on all versions 👍
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What does this PR do?
Our previous mechanism of copying a drawable's content was performed on the main thread.
When starting an app, this would create a lot of main thread task to run. And any new image would also take some of the main thread time, creating a lot of jank frames in any non hello world app.
This will fix the performance issue some of our customers started to notice when enabling SR.