diff options
author | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-25 19:58:40 +0000 |
---|---|---|
committer | sky@chromium.org <sky@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-09-25 19:58:40 +0000 |
commit | 853549865e2110ab696f81c3c9386328f5b73d62 (patch) | |
tree | f39c84d2cd0d9ae9593c029b507d08655a31f079 /chrome/browser/browser.h | |
parent | 6bea5abf7fb61153a722caef5f0575dcbca242a7 (diff) | |
download | chromium_src-853549865e2110ab696f81c3c9386328f5b73d62.zip chromium_src-853549865e2110ab696f81c3c9386328f5b73d62.tar.gz chromium_src-853549865e2110ab696f81c3c9386328f5b73d62.tar.bz2 |
Minor cleanup. Converts Browser from storing a vector of pending
updates to a map. This simplifies processing and removal.
BUG=1209369
TEST=none
Review URL: http://codereview.chromium.org/250003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@27228 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/browser.h')
-rw-r--r-- | chrome/browser/browser.h | 23 |
1 files changed, 13 insertions, 10 deletions
diff --git a/chrome/browser/browser.h b/chrome/browser/browser.h index f5c1bd6..2120a05 100644 --- a/chrome/browser/browser.h +++ b/chrome/browser/browser.h @@ -5,6 +5,7 @@ #ifndef CHROME_BROWSER_BROWSER_H_ #define CHROME_BROWSER_BROWSER_H_ +#include <map> #include <set> #include <vector> @@ -567,12 +568,15 @@ class Browser : public TabStripModelDelegate, // well. void UpdateToolbar(bool should_restore_state); - // Adds an update to the update queue and schedules an update if necessary. - // These are subsequently processed by ProcessPendingUIUpdates. - // |changed_flags| is a bitfield of TabContents::INVALIDATE_* values. + // Does one or both of the following for each bit in |changed_flags|: + // . If the update should be processed immediately, it is. + // . If the update should processed asynchronously (to avoid lots of ui + // updates), then scheduled_updates_ is updated for the |source| and update + // pair and a task is scheduled (assuming it isn't running already) + // that invokes ProcessPendingUIUpdates. void ScheduleUIUpdate(const TabContents* source, unsigned changed_flags); - // Processes all pending updates to the UI that have been queued by + // Processes all pending updates to the UI that have been scheduled by // ScheduleUIUpdate in scheduled_updates_. void ProcessPendingUIUpdates(); @@ -730,14 +734,13 @@ class Browser : public TabStripModelDelegate, // UI update coalescing and handling //////////////////////////////////////// - // Tracks invalidates to the UI, see the declaration in the .cc file. - struct UIUpdate; - typedef std::vector<UIUpdate> UpdateVector; + typedef std::map<const TabContents*,int> UpdateMap; - // Lists all UI updates that are pending. We don't update things like the - // URL or tab title right away to avoid flickering and extra painting. + // Maps from TabContents to pending UI updates that need to be processed. + // We don't update things like the URL or tab title right away to avoid + // flickering and extra painting. // See ScheduleUIUpdate and ProcessPendingUIUpdates. - UpdateVector scheduled_updates_; + UpdateMap scheduled_updates_; // The following factory is used for chrome update coalescing. ScopedRunnableMethodFactory<Browser> chrome_updater_factory_; |