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

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

Issue 9348036: Trim code from sync's ServerConnectionManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Back off some changes Created 8 years, 10 months 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
Index: chrome/browser/sync/engine/sync_scheduler.cc
diff --git a/chrome/browser/sync/engine/sync_scheduler.cc b/chrome/browser/sync/engine/sync_scheduler.cc
index dafe685110934deb65a4cc439555877d64ce96e0..e9955a9901e716f22588eb3d8111a13e22d887f5 100644
--- a/chrome/browser/sync/engine/sync_scheduler.cc
+++ b/chrome/browser/sync/engine/sync_scheduler.cc
@@ -194,7 +194,6 @@ SyncScheduler::SyncScheduler(const std::string& name,
mode_(NORMAL_MODE),
// Start with assuming everything is fine with the connection.
// At the end of the sync cycle we would have the correct status.
- server_connection_ok_(true),
connection_code_(HttpResponse::SERVER_CONNECTION_OK),
delay_provider_(new DelayProvider()),
syncer_(syncer),
@@ -230,9 +229,7 @@ void SyncScheduler::OnConnectionStatusChange() {
}
void SyncScheduler::OnServerConnectionErrorFixed() {
- DCHECK(!server_connection_ok_);
connection_code_ = HttpResponse::SERVER_CONNECTION_OK;
- server_connection_ok_ = true;
PostTask(FROM_HERE, "DoCanaryJob",
base::Bind(&SyncScheduler::DoCanaryJob,
weak_ptr_factory_.GetWeakPtr()));
@@ -244,7 +241,6 @@ void SyncScheduler::UpdateServerConnectionManagerStatus(
DCHECK_EQ(MessageLoop::current(), sync_loop_);
SDVLOG(2) << "New server connection code: "
<< HttpResponse::GetServerConnectionCodeString(code);
- bool old_server_connection_ok = server_connection_ok_;
connection_code_ = code;
@@ -256,20 +252,12 @@ void SyncScheduler::UpdateServerConnectionManagerStatus(
// a valid connection has been re-established
if (HttpResponse::CONNECTION_UNAVAILABLE == code ||
HttpResponse::SYNC_AUTH_ERROR == code) {
- server_connection_ok_ = false;
SDVLOG(2) << "Sync auth error or unavailable connection: "
<< "server connection is down";
} else if (HttpResponse::SERVER_CONNECTION_OK == code) {
- server_connection_ok_ = true;
SDVLOG(2) << "Sync server connection is ok: "
<< "server connection is up, doing canary job";
}
-
- if (old_server_connection_ok != server_connection_ok_) {
- const char* transition =
- server_connection_ok_ ? "down -> up" : "up -> down";
- SDVLOG(2) << "Server connection changed: " << transition;
lipalani1 2012/02/11 00:12:10 There is some value to this log statement. You can
rlarocque 2012/02/11 01:31:36 This log statement exists specifically to tell us
- }
}
void SyncScheduler::Start(Mode mode, const base::Closure& callback) {
@@ -385,10 +373,10 @@ SyncScheduler::JobProcessDecision SyncScheduler::DecideOnJob(
return DROP;
}
- if (server_connection_ok_)
+ if (!session_context_->connection_manager()->HasInvalidAuthToken())
rlarocque 2012/02/10 23:16:06 You might be thinking that this condition is not t
lipalani1 2012/02/11 00:12:10 Yep it was designed to capture cases where this va
return CONTINUE;
- SDVLOG(2) << "Bad server connection. Using that to decide on job.";
+ SDVLOG(2) << "No valid auth token. Using that to decide on job.";
return job.purpose == SyncSessionJob::NUDGE ? SAVE : DROP;
}
@@ -852,15 +840,14 @@ void SyncScheduler::FinishSyncSessionJob(const SyncSessionJob& job) {
}
last_sync_session_end_time_ = now;
- // Now update the status of the connection from SCM. We need this
- // to decide whether we need to save/run future jobs. The notifications
- // from SCM are not reliable.
+ // Now update the status of the connection from SCM. We need this to decide
+ // whether we need to save/run future jobs. The notifications from SCM are not
+ // reliable.
+ //
// TODO(rlarocque): crbug.com/110954
- // We should get rid of the notifications and
- // it is probably not needed to maintain this status variable
- // in 2 places. We should query it directly from SCM when needed.
- // But that would need little more refactoring(including a method to
- // query if the auth token is invalid) from SCM side.
+ // We should get rid of the notifications and it is probably not needed to
+ // maintain this status variable in 2 places. We should query it directly from
+ // SCM when needed.
ServerConnectionManager* scm = session_context_->connection_manager();
UpdateServerConnectionManagerStatus(scm->server_status());

Powered by Google App Engine
This is Rietveld 408576698