Skip to content

Commit

Permalink
Power bookmark: Fix a jni leak for CurrencyFormatter.
Browse files Browse the repository at this point in the history
PowerBookmarkShoppingItemRow is only used in test. But the production
code needs to call CurrencyFormatter.destroy, or the native side
object is leaked.

Bug: NONE
Change-Id: I46c269eb9e402835bdec316f404a32624648abcd
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3213448
Reviewed-by: Theresa  <twellington@chromium.org>
Reviewed-by: Brandon Wylie <wylieb@chromium.org>
Commit-Queue: Xing Liu <xingliu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#929512}
  • Loading branch information
Xing Liu authored and Chromium LUCI CQ committed Oct 8, 2021
1 parent 4b09875 commit 24dc4ee
Showing 1 changed file with 7 additions and 0 deletions.
Expand Up @@ -49,6 +49,7 @@ void init(ImageFetcher imageFetcher) {
mImageFetcher = imageFetcher;
}

// BookmarkItemRow overrides:
@Override
BookmarkItem setBookmarkId(BookmarkId bookmarkId, @Location int location) {
BookmarkItem bookmarkItem = super.setBookmarkId(bookmarkId, location);
Expand All @@ -57,6 +58,12 @@ BookmarkItem setBookmarkId(BookmarkId bookmarkId, @Location int location) {
return bookmarkItem;
}

@Override
public void onDestroy() {
super.onDestroy();
if (mCurrencyFormatter != null) mCurrencyFormatter.destroy();
}

@VisibleForTesting
void initPriceTrackingUI(String leadImageUrl, boolean priceTrackingEnabled, long originalPrice,
long currentPrice) {
Expand Down

0 comments on commit 24dc4ee

Please sign in to comment.