diff options
author | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-03 20:09:02 +0000 |
---|---|---|
committer | tim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2010-11-03 20:09:02 +0000 |
commit | ca410f8f2e60d917e648a8075e100a583c6b4e52 (patch) | |
tree | a6d733c1cf22d3b49773e06c9034a4523732c1a9 | |
parent | c387abf610a5e71b7641c25f7b5045813a66d291 (diff) | |
download | chromium_src-ca410f8f2e60d917e648a8075e100a583c6b4e52.zip chromium_src-ca410f8f2e60d917e648a8075e100a583c6b4e52.tar.gz chromium_src-ca410f8f2e60d917e648a8075e100a583c6b4e52.tar.bz2 |
sync: on chrome os, postpone network reachability check
Incur a delay of 5 seconds to reduce probability of of blocking shutdown on an http request. This is intended to be a temporary workaround hack.
BUG=8429
TEST=none
Review URL: http://codereview.chromium.org/4347003
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@64958 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r-- | chrome/browser/sync/engine/syncapi.cc | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/chrome/browser/sync/engine/syncapi.cc b/chrome/browser/sync/engine/syncapi.cc index 8c3b856..04603a5 100644 --- a/chrome/browser/sync/engine/syncapi.cc +++ b/chrome/browser/sync/engine/syncapi.cc @@ -89,6 +89,10 @@ typedef GoogleServiceAuthError AuthError; static const int kThreadExitTimeoutMsec = 60000; static const int kSSLPort = 443; +#if defined(OS_CHROMEOS) +static const int kChromeOSNetworkChangeReactionDelayHackMsec = 5000; +#endif // OS_CHROMEOS + // We manage the lifetime of sync_api::SyncManager::SyncInternal ourselves. DISABLE_RUNNABLE_METHOD_REFCOUNT(sync_api::SyncManager::SyncInternal); @@ -1169,6 +1173,9 @@ class SyncManager::SyncInternal // decryption. Otherwise, the cryptographer is made ready (is_ready()). void BootstrapEncryption(const std::string& restored_key_for_bootstrapping); + // Checks for server reachabilty and requests a nudge. + void OnIPAddressChangedImpl(); + // We couple the DirectoryManager and username together in a UserShare member // so we can return a handle to share_ to clients of the API for use when // constructing any transaction type. @@ -1718,6 +1725,19 @@ void SyncManager::SyncInternal::Shutdown() { void SyncManager::SyncInternal::OnIPAddressChanged() { VLOG(1) << "IP address change detected"; +#if defined (OS_CHROMEOS) + // TODO(tim): This is a hack to intentionally lose a race with flimflam at + // shutdown, so we don't cause shutdown to wait for our http request. + // http://crosbug.com/8429 + MessageLoop::current()->PostDelayedTask(FROM_HERE, + method_factory_.NewRunnableMethod(&SyncInternal::OnIPAddressChangedImpl), + kChromeOSNetworkChangeReactionDelayHackMsec); +#else + OnIPAddressChangedImpl(); +#endif // defined(OS_CHROMEOS) +} + +void SyncManager::SyncInternal::OnIPAddressChangedImpl() { // TODO(akalin): CheckServerReachable() can block, which may cause // jank if we try to shut down sync. Fix this. connection_manager()->CheckServerReachable(); |