Commit dc6c7989 authored by ckitagawa's avatar ckitagawa Committed by Commit Bot

[Paint Preview] Faster cleanup

The goal of this change is to try to improve scroll latency for paint
preview, by freeing competing resources eagerly. Instead of freeing
bitmaps/compositing after animating a fade we can do so beforehand.

Change-Id: I8f91792e66c83765335a77683f3c35b85108f79a
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2527506
Commit-Queue: Calder Kitagawa <ckitagawa@chromium.org>
Reviewed-by: default avatarMehran Mahmoudi <mahmoudi@chromium.org>
Cr-Commit-Position: refs/heads/master@{#825977}
parent fb03cc27
......@@ -130,14 +130,16 @@ public class TabbedPaintPreview implements UserData {
if (mTab == null || mPlayerManager == null || mFadingOut) return;
mFadingOut = true;
mPlayerManager.setAcceptUserInput(false);
Point scrollPosition = mPlayerManager.getScrollPosition();
// Destroy early to free up resource, but don't null until faded out so view sticks around.
mPlayerManager.destroy();
if (matchScroll) {
Point scrollPosition = mPlayerManager.getScrollPosition();
if (mTab.getWebContents() != null && scrollPosition != null) {
mTab.getWebContents().getEventForwarder().scrollTo(
scrollPosition.x, scrollPosition.y);
}
}
mPlayerManager.setAcceptUserInput(false);
mTabbedPainPreviewViewProvider.getView()
.animate()
.alpha(0f)
......@@ -150,7 +152,6 @@ public class TabbedPaintPreview implements UserData {
mTabbedPainPreviewViewProvider);
}
if (mPlayerManager != null) {
mPlayerManager.destroy();
mPlayerManager = null;
}
mIsAttachedToTab = false;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment