diff options
author | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-22 20:08:05 +0000 |
---|---|---|
committer | oshima@chromium.org <oshima@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-22 20:08:05 +0000 |
commit | 354b8491e74c82b2c19c0e7f10ea9be2a71c6799 (patch) | |
tree | b880d9df79017a2baaac287b0d064e70cb06dc64 /chrome/browser/chromeos/offline/offline_load_page.cc | |
parent | dafb7a0a867fbe26a4cff631d0b64bf5af43671e (diff) | |
download | chromium_src-354b8491e74c82b2c19c0e7f10ea9be2a71c6799.zip chromium_src-354b8491e74c82b2c19c0e7f10ea9be2a71c6799.tar.gz chromium_src-354b8491e74c82b2c19c0e7f10ea9be2a71c6799.tar.bz2 |
Add delay when resuming load when network connection is restured.
Without delay, chrome silently fails to load the page.
This is a wordaround and should be remoevd once the root cause is fixed.
* Different delays for secure and non secure connection as
secure connection needs longer delay.
* I simply shortened proxy resolution as this may hit the same
issue, and short enough that the page load happens after
proxy resolution.
BUG=chromium-os:8285
TEST=see the bug description for repro steps.
Review URL: http://codereview.chromium.org/5156007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@66990 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/chromeos/offline/offline_load_page.cc')
-rw-r--r-- | chrome/browser/chromeos/offline/offline_load_page.cc | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/chrome/browser/chromeos/offline/offline_load_page.cc b/chrome/browser/chromeos/offline/offline_load_page.cc index 94893a1..236a992 100644 --- a/chrome/browser/chromeos/offline/offline_load_page.cc +++ b/chrome/browser/chromeos/offline/offline_load_page.cc @@ -33,6 +33,14 @@ namespace { // Maximum time to show a blank page. const int kMaxBlankPeriod = 3000; +// This is a workaround for crosbug.com/8285. +// Chrome sometimes fails to load the page silently +// when the load is requested right after network is +// restored. This happens more often in HTTPS than HTTP. +// This should be removed once the root cause is fixed. +const int kSecureDelayMs = 1000; +const int kDefaultDelayMs = 300; + // A utility function to set the dictionary's value given by |resource_id|. void SetString(DictionaryValue* strings, const char* name, int resource_id) { strings->SetString(name, l10n_util::GetStringUTF16(resource_id)); @@ -61,7 +69,10 @@ OfflineLoadPage::OfflineLoadPage(TabContents* tab_contents, const GURL& url, Delegate* delegate) : InterstitialPage(tab_contents, true, url), - delegate_(delegate) { + delegate_(delegate), + proceeded_(false), + ALLOW_THIS_IN_INITIALIZER_LIST(method_factory_(this)), + in_test_(false) { registrar_.Add(this, NotificationType::NETWORK_STATE_CHANGED, NotificationService::AllSources()); } @@ -174,11 +185,26 @@ void OfflineLoadPage::CommandReceived(const std::string& cmd) { } void OfflineLoadPage::Proceed() { + DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); + int delay = url().SchemeIsSecure() ? kSecureDelayMs : kDefaultDelayMs; + if (in_test_) + delay = 0; + proceeded_ = true; + BrowserThread::PostDelayedTask( + BrowserThread::UI, FROM_HERE, + method_factory_.NewRunnableMethod(&OfflineLoadPage::DoProceed), + delay); +} + +void OfflineLoadPage::DoProceed() { delegate_->OnBlockingPageComplete(true); InterstitialPage::Proceed(); } void OfflineLoadPage::DontProceed() { + // Inogre if it's already proceeded. + if (proceeded_) + return; delegate_->OnBlockingPageComplete(false); InterstitialPage::DontProceed(); } |