Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(3109)

Unified Diff: chrome/browser/sync/engine/syncapi.cc

Issue 4347003: sync: on chrome os, postpone network reachability check (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/chrome/debug
Patch Set: review Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync/engine/syncapi.cc
diff --git a/chrome/browser/sync/engine/syncapi.cc b/chrome/browser/sync/engine/syncapi.cc
index 8c3b856142262cf2d52997f9c6f86242ee554949..04603a524bd66746f96f4a3951543077df6c8aa0 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();
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698