diff options
author | mihaip@chromium.org <mihaip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-27 16:55:57 +0000 |
---|---|---|
committer | mihaip@chromium.org <mihaip@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-09-27 16:55:57 +0000 |
commit | 6ebdc9b97a81173453aeae660c1c6cd6600a39bc (patch) | |
tree | e54f07f76bc8d484cb63395475f31fc810663a35 /chrome | |
parent | ac537c33a1f639d7439f02d899bd33013694d3fa (diff) | |
download | chromium_src-6ebdc9b97a81173453aeae660c1c6cd6600a39bc.zip chromium_src-6ebdc9b97a81173453aeae660c1c6cd6600a39bc.tar.gz chromium_src-6ebdc9b97a81173453aeae660c1c6cd6600a39bc.tar.bz2 |
Revert 60527 - Fix flickering when calling push/replaceState (or changing the location hash)
in a tight loop by delaying the UI updates when beginning a load by 50
milliseconds (and cancelling altogether if the load finishes before then).
Reverting to see if it's responsible for the page_cycler_moz regression.
BUG=57043
TBR=thakis@chromium.org
Review URL: http://codereview.chromium.org/3415028
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@60659 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome')
-rw-r--r-- | chrome/browser/browser.cc | 46 | ||||
-rw-r--r-- | chrome/browser/tab_contents/navigation_controller.cc | 5 | ||||
-rw-r--r-- | chrome/browser/tab_contents/tab_contents.cc | 4 |
3 files changed, 18 insertions, 37 deletions
diff --git a/chrome/browser/browser.cc b/chrome/browser/browser.cc index bf50bdd..4b74a78 100644 --- a/chrome/browser/browser.cc +++ b/chrome/browser/browser.cc @@ -131,15 +131,9 @@ using base::TimeDelta; -// How long we wait before updating the browser chrome (except for loads, see -// below). +// How long we wait before updating the browser chrome while loading a page. static const int kUIUpdateCoalescingTimeMS = 200; -// How long we wait before updating the browser chrome while loading a page -// (generally lower than kUIUpdateCoalescingTimeMS to increase perceived -// snappiness). -static const int kUIUpdateCoalescingTimeForLoadsMS = 50; - // The URL to be loaded to display Help. static const char* const kHelpContentUrl = "http://www.google.com/support/chrome/"; @@ -3479,17 +3473,15 @@ void Browser::ScheduleUIUpdate(const TabContents* source, changed_flags &= ~TabContents::INVALIDATE_URL; } if (changed_flags & TabContents::INVALIDATE_LOAD) { - // Update the loading state synchronously if we're done loading. This is so - // the throbber will stop, which gives a more snappy feel. We want to do + // Update the loading state synchronously. This is so the throbber will + // immediately start/stop, which gives a more snappy feel. We want to do // this for any tab so they start & stop quickly. - if (!source->is_loading()) { - LoadingStateChanged(const_cast<TabContents*>(source)); - tabstrip_model_->UpdateTabContentsStateAt( - tabstrip_model_->GetIndexOfController(&source->controller()), - TabStripModelObserver::LOADING_ONLY); - } - // We don't strip INVALIDATE_LOAD from changed_flags so that we can update - // the trobber when stopping loads and the status bubble. + tabstrip_model_->UpdateTabContentsStateAt( + tabstrip_model_->GetIndexOfController(&source->controller()), + TabStripModelObserver::LOADING_ONLY); + // The status bubble needs to be updated during INVALIDATE_LOAD too, but + // we do that asynchronously by not stripping INVALIDATE_LOAD from + // changed_flags. } if (changed_flags & TabContents::INVALIDATE_TITLE && !source->is_loading()) { @@ -3516,13 +3508,11 @@ void Browser::ScheduleUIUpdate(const TabContents* source, if (chrome_updater_factory_.empty()) { // No task currently scheduled, start another. - int coalesce_time = changed_flags & TabContents::INVALIDATE_LOAD ? - kUIUpdateCoalescingTimeForLoadsMS : kUIUpdateCoalescingTimeMS; MessageLoop::current()->PostDelayedTask( FROM_HERE, chrome_updater_factory_.NewRunnableMethod( &Browser::ProcessPendingUIUpdates), - coalesce_time); + kUIUpdateCoalescingTimeMS); } } @@ -3558,19 +3548,9 @@ void Browser::ProcessPendingUIUpdates() { if (flags & TabContents::INVALIDATE_PAGE_ACTIONS) window()->GetLocationBar()->UpdatePageActions(); - if (flags & TabContents::INVALIDATE_LOAD) { - // Updating the URL happens synchronously in ScheduleUIUpdate for loads - // that ended. - if (contents->is_loading()) { - LoadingStateChanged(GetSelectedTabContents()); - tabstrip_model_->UpdateTabContentsStateAt( - tabstrip_model_->GetIndexOfController(&contents->controller()), - TabStripModelObserver::LOADING_ONLY); - } - - if (GetStatusBubble()) - GetStatusBubble()->SetStatus(WideToUTF16(contents->GetStatusText())); - } + // Updating the URL happens synchronously in ScheduleUIUpdate. + if (flags & TabContents::INVALIDATE_LOAD && GetStatusBubble()) + GetStatusBubble()->SetStatus(WideToUTF16(contents->GetStatusText())); if (flags & (TabContents::INVALIDATE_TAB | TabContents::INVALIDATE_TITLE)) { diff --git a/chrome/browser/tab_contents/navigation_controller.cc b/chrome/browser/tab_contents/navigation_controller.cc index 6b84020..b54c394 100644 --- a/chrome/browser/tab_contents/navigation_controller.cc +++ b/chrome/browser/tab_contents/navigation_controller.cc @@ -1070,11 +1070,8 @@ void NavigationController::NotifyNavigationEntryCommitted( // TODO(pkasting): http://b/1113079 Probably these explicit notification paths // should be removed, and interested parties should just listen for the // notification below instead. - // We don't set INVALIDATE_LOAD since that will be done separately for real - // loads (by TabContents::SetIsLoading). tab_contents_->NotifyNavigationStateChanged( - (kInvalidateAllButShelves & ~TabContents::INVALIDATE_LOAD) | - extra_invalidate_flags); + kInvalidateAllButShelves | extra_invalidate_flags); NotificationService::current()->Notify( NotificationType::NAV_ENTRY_COMMITTED, diff --git a/chrome/browser/tab_contents/tab_contents.cc b/chrome/browser/tab_contents/tab_contents.cc index 5ec1cc0..086d1f1 100644 --- a/chrome/browser/tab_contents/tab_contents.cc +++ b/chrome/browser/tab_contents/tab_contents.cc @@ -157,6 +157,8 @@ namespace { // is queried for its state and pushed to the NavigationEntry. const int kQueryStateDelay = 5000; +const int kSyncWaitDelay = 40; + #if defined(OS_CHROMEOS) // If a popup window is bigger than this fraction of the screen on chrome os, // turn it into a tab @@ -1501,6 +1503,8 @@ void TabContents::SetIsLoading(bool is_loading, is_loading_ = is_loading; waiting_for_response_ = is_loading; + if (delegate_) + delegate_->LoadingStateChanged(this); NotifyNavigationStateChanged(INVALIDATE_LOAD); NotificationType type = is_loading ? NotificationType::LOAD_START : |