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

Unified Diff: chrome/browser/sync_file_system/drive_file_sync_service.cc

Issue 11416339: Sync FileSystem: Update polling delay when remote change-list did not update change_queue. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: '' Created 8 years 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 | « chrome/browser/sync_file_system/drive_file_sync_service.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/sync_file_system/drive_file_sync_service.cc
diff --git a/chrome/browser/sync_file_system/drive_file_sync_service.cc b/chrome/browser/sync_file_system/drive_file_sync_service.cc
index 5183af9f0fec1071171bb0a139f10023fd27e111..2d6c57c0d6e27fc39c0d5fe01229722ac613d0df 100644
--- a/chrome/browser/sync_file_system/drive_file_sync_service.cc
+++ b/chrome/browser/sync_file_system/drive_file_sync_service.cc
@@ -1309,7 +1309,7 @@ void DriveFileSyncService::FinalizeRemoteSync(
}
}
-void DriveFileSyncService::AppendNewRemoteChange(
+bool DriveFileSyncService::AppendNewRemoteChange(
const GURL& origin,
const google_apis::DocumentEntry& entry,
int64 changestamp,
@@ -1321,7 +1321,7 @@ void DriveFileSyncService::AppendNewRemoteChange(
PathToChange::iterator found = path_to_change->find(path);
if (found != path_to_change->end()) {
if (found->second.changestamp >= changestamp)
- return;
+ return false;
pending_changes_.erase(found->second.position_in_queue);
}
@@ -1350,6 +1350,7 @@ void DriveFileSyncService::AppendNewRemoteChange(
(*path_to_change)[path] = RemoteChange(
changestamp, entry.resource_id(), url, file_change,
inserted_to_queue.first);
+ return true;
}
void DriveFileSyncService::RemoveRemoteChange(
@@ -1409,11 +1410,12 @@ void DriveFileSyncService::FetchChangesForIncrementalSync() {
sync_client_->ListChanges(
largest_fetched_changestamp_ + 1,
base::Bind(&DriveFileSyncService::DidFetchChangesForIncrementalSync,
- AsWeakPtr(), base::Passed(&token)));
+ AsWeakPtr(), base::Passed(&token), false));
}
void DriveFileSyncService::DidFetchChangesForIncrementalSync(
scoped_ptr<TaskToken> token,
+ bool has_new_changes,
google_apis::GDataErrorCode error,
scoped_ptr<google_apis::DocumentFeed> changes) {
if (error != google_apis::HTTP_SUCCESS) {
@@ -1429,8 +1431,9 @@ void DriveFileSyncService::DidFetchChangesForIncrementalSync(
if (!GetOriginForEntry(entry, &origin))
continue;
- AppendNewRemoteChange(origin, entry, entry.changestamp(),
- REMOTE_SYNC_TYPE_INCREMENTAL);
+ has_new_changes = has_new_changes ||
+ AppendNewRemoteChange(origin, entry, entry.changestamp(),
+ REMOTE_SYNC_TYPE_INCREMENTAL);
}
GURL next_feed;
@@ -1438,20 +1441,20 @@ void DriveFileSyncService::DidFetchChangesForIncrementalSync(
sync_client_->ContinueListing(
next_feed,
base::Bind(&DriveFileSyncService::DidFetchChangesForIncrementalSync,
- AsWeakPtr(), base::Passed(&token)));
+ AsWeakPtr(), base::Passed(&token), has_new_changes));
return;
}
largest_fetched_changestamp_ = changes->largest_changestamp();
- if (changes->start_index() == 0 && changes->entries().empty()) {
- // If this set of changes is the first feed and it's empty, update
- // the polling delay to wait longer.
+ if (has_new_changes) {
+ polling_delay_seconds_ = kMinimumPollingDelaySeconds;
+ } else {
+ // If the change_queue_ was not updated, update the polling delay to wait
+ // longer.
polling_delay_seconds_ = std::min(
static_cast<int64>(kDelayMultiplier * polling_delay_seconds_),
kMaximumPollingDelaySeconds);
- } else {
- polling_delay_seconds_ = kMinimumPollingDelaySeconds;
}
NotifyTaskDone(fileapi::SYNC_STATUS_OK, token.Pass());
« no previous file with comments | « chrome/browser/sync_file_system/drive_file_sync_service.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698