summaryrefslogtreecommitdiffstats
path: root/chrome/browser/custom_home_pages_table_model.h
diff options
context:
space:
mode:
authoralexclarke <alexclarke@chromium.org>2015-01-22 15:05:02 -0800
committerCommit bot <commit-bot@chromium.org>2015-01-22 23:06:04 +0000
commite6cdee7f596a3a897a2786e58a88b0f69cd31a9f (patch)
treea61960cdf17018e1aae632f3fc85b138219a3613 /chrome/browser/custom_home_pages_table_model.h
parente61989b21484b652a5124d4cfad960dbd8b6946c (diff)
downloadchromium_src-e6cdee7f596a3a897a2786e58a88b0f69cd31a9f.zip
chromium_src-e6cdee7f596a3a897a2786e58a88b0f69cd31a9f.tar.gz
chromium_src-e6cdee7f596a3a897a2786e58a88b0f69cd31a9f.tar.bz2
Fixes flickering in chrome://settings/startup with the scheduler enabled
Previously CustomHomePagesTableModel::SetToCurrentlyOpenPages was sending a large number of StartupOverlay.updateStartupPages with intermediate state as pre-existing rows where removed and then new ones added and their titles looked up. This became a problem with the blink scheduler enabled on touch devices, because a touch puts the renderer scheduler into compositor priority and generated more frames than before leading to horrible flickering of the dialog. This patch fixes that by only sending a single update once all of the titles have been looked up. BUG=450953 Review URL: https://codereview.chromium.org/870563003 Cr-Commit-Position: refs/heads/master@{#312695}
Diffstat (limited to 'chrome/browser/custom_home_pages_table_model.h')
-rw-r--r--chrome/browser/custom_home_pages_table_model.h26
1 files changed, 25 insertions, 1 deletions
diff --git a/chrome/browser/custom_home_pages_table_model.h b/chrome/browser/custom_home_pages_table_model.h
index ca19997..797cc14 100644
--- a/chrome/browser/custom_home_pages_table_model.h
+++ b/chrome/browser/custom_home_pages_table_model.h
@@ -68,13 +68,33 @@ class CustomHomePagesTableModel : public ui::TableModel {
// Loads the title for the specified entry.
void LoadTitle(Entry* entry);
+ // Loads all the titles, notifies the observer of the change once all loads
+ // are complete.
+ void LoadAllTitles();
+
// Callback from history service. Updates the title of the Entry whose
- // |url| matches |entry_url| and notifies the observer of the change.
+ // |url| matches |entry_url| and notifies the observer of the change if
+ // |observable| is true.
void OnGotTitle(const GURL& entry_url,
+ bool observable,
bool found_url,
const history::URLRow& row,
const history::VisitVector& visits);
+ // Like OnGotTitle, except that num_outstanding_title_lookups_ is decremented
+ // and if the count reaches zero the observer is notifed.
+ void OnGotOneOfManyTitles(const GURL& entry_url,
+ bool found_url,
+ const history::URLRow& row,
+ const history::VisitVector& visits);
+
+ // Adds an entry at the specified index, but doesn't load the title or tell
+ // the observer.
+ void AddWithoutNotification(int index, const GURL& url);
+
+ // Removes the entry at the specified index, but doesn't tell the observer.
+ void RemoveWithoutNotification(int index);
+
// Returns the URL for a particular row, formatted for display to the user.
base::string16 FormattedURL(int row) const;
@@ -89,6 +109,10 @@ class CustomHomePagesTableModel : public ui::TableModel {
// Used in loading titles.
base::CancelableTaskTracker task_tracker_;
+ // Used to keep track of when it's time to update the observer when loading
+ // multiple titles.
+ int num_outstanding_title_lookups_;
+
DISALLOW_COPY_AND_ASSIGN(CustomHomePagesTableModel);
};