Skip to content

Commit

Permalink
[DownloadBubble] Show up to 30 items in the bubble
Browse files Browse the repository at this point in the history
This changes the upper bound on items to show from 100 to 30. This
reduces the impact of possible O(n^2) behavior in showing the bubble,
which may be causing performance issues.

Because caching fewer items leads to backfilling more frequently,
which we want to avoid, the number of extra items to cache is
raised accordingly, so that we cache 60 items of each type
(previously 120). Caching more items is relatively cheap while
backfilling is expensive.

Bug: 1421426
Change-Id: I1b69f8971c3ed7c866b1219427fdd023a38459e7
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/4370538
Commit-Queue: Lily Chen <chlily@chromium.org>
Reviewed-by: Xinghui Lu <xinghuilu@chromium.org>
Cr-Commit-Position: refs/heads/main@{#1121772}
  • Loading branch information
chlily1 authored and Chromium LUCI CQ committed Mar 24, 2023
1 parent a742282 commit a7cf2bd
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions chrome/browser/download/bubble/download_bubble_update_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,12 @@ using ProgressInfo = DownloadDisplayController::ProgressInfo;
template <typename Item>
using SortedItems = DownloadBubbleUpdateService::SortedItems<Item>;

// Show 100 items by default. We will cache up to this many download items and
// up to this many offline items.
constexpr size_t kDefaultMaxNumItemsToShow = 100u;
// Cache a few more items than we will return from GetAllModelsToDisplay. This
// gives us some wiggle room and makes it more likely that we'll return enough
// items before backfilling.
constexpr size_t kDefaultExtraItemsToCache = 20u;
// Show up to 30 items in total by default.
constexpr size_t kDefaultMaxNumItemsToShow = 30u;
// Cache a few more items of each type than we will return from
// GetAllModelsToDisplay. This gives us some wiggle room and makes it more
// likely that we'll return enough items before backfilling.
constexpr size_t kDefaultExtraItemsToCache = 30u;
// Amount of time to show an item in the bubble. Items older than this duration
// ago will be pruned.
constexpr base::TimeDelta kShowItemInBubbleDuration = base::Hours(24);
Expand Down

0 comments on commit a7cf2bd

Please sign in to comment.