summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-03 21:56:46 +0000
committertim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-11-03 21:56:46 +0000
commit5ec05c0018c0b6c9fa72a2134283d6593b28defe (patch)
tree9c33bcf84f6b05b5e241ce1ca8af5cc37af3cb30
parentd8ab5bc2f65d15fa4061e08df6ba9975bb3e4783 (diff)
downloadchromium_src-5ec05c0018c0b6c9fa72a2134283d6593b28defe.zip
chromium_src-5ec05c0018c0b6c9fa72a2134283d6593b28defe.tar.gz
chromium_src-5ec05c0018c0b6c9fa72a2134283d6593b28defe.tar.bz2
Merge 64958 - 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=chromium-os:8429 TEST=none Review URL: http://codereview.chromium.org/4347003 TBR=tim@chromium.org Review URL: http://codereview.chromium.org/4430001 git-svn-id: svn://svn.chromium.org/chrome/branches/552/src@64972 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--chrome/browser/sync/engine/syncapi.cc20
1 files changed, 20 insertions, 0 deletions
diff --git a/chrome/browser/sync/engine/syncapi.cc b/chrome/browser/sync/engine/syncapi.cc
index 1874672..a44e199 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);
@@ -1153,6 +1157,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.
@@ -1700,6 +1707,19 @@ void SyncManager::SyncInternal::Shutdown() {
void SyncManager::SyncInternal::OnIPAddressChanged() {
LOG(INFO) << "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();