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

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

Issue 12210109: Call batch/incremental fetch with more strict conditions (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test fixes Created 7 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
« no previous file with comments | « no previous file | chrome/browser/sync_file_system/drive_file_sync_service.cc » ('j') | 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.h
diff --git a/chrome/browser/sync_file_system/drive_file_sync_service.h b/chrome/browser/sync_file_system/drive_file_sync_service.h
index abeda9b3b039c42670396c31d1bdb4715a1eecfa..0ab870c5cba92d77b094313d87e349acdda318e6 100644
--- a/chrome/browser/sync_file_system/drive_file_sync_service.h
+++ b/chrome/browser/sync_file_system/drive_file_sync_service.h
@@ -341,6 +341,18 @@ class DriveFileSyncService
base::FilePath temporary_file_dir_;
+ // May start batch sync or incremental sync.
+ // This immediately returns if:
+ // - Another task is running (i.e. task_ is null), or
+ // - The service state is DISABLED.
+ //
+ // This calls:
+ // - StartBatchSyncForOrigin() if it has any pending batch sync origins, or
+ // - FetchChangesForIncrementalSync() otherwise.
+ //
+ // These two methods are called only from this method.
+ void MaybeStartFetchChanges();
+
void FetchChangesForIncrementalSync();
void DidFetchChangesForIncrementalSync(
scoped_ptr<TaskToken> token,
@@ -349,6 +361,7 @@ class DriveFileSyncService
scoped_ptr<google_apis::ResourceList> changes);
bool GetOriginForEntry(const google_apis::ResourceEntry& entry, GURL* origin);
void SchedulePolling();
+ void OnPollingTimerFired();
void UpdatePollingDelay(int64 new_delay_sec);
void RegisterDriveNotifications();
void SetPushNotificationEnabled(syncer::InvalidatorState state);
@@ -394,9 +407,18 @@ class DriveFileSyncService
// If polling_delay_seconds_ is negative (<0) the timer won't start.
int64 polling_delay_seconds_;
- // Is set to true while the service is fetching changes for incremental
- // sync. Polling will be disabled while this is true.
- bool is_fetching_changes_;
+ // Is set to true when there's a fair possibility that we have some
+ // remote changes that haven't been fetched yet.
+ //
+ // This flag is set when:
+ // - This gets invalidation notification,
+ // - The service is authenticated or becomes online, and
+ // - The polling timer is fired.
+ //
+ // This flag is cleared when:
+ // - A batch or incremental sync has been started, and
+ // - When all pending batch sync tasks have been finished.
+ bool may_have_unfetched_changes_;
ObserverList<Observer> service_observers_;
ObserverList<FileStatusObserver> file_status_observers_;
« no previous file with comments | « no previous file | chrome/browser/sync_file_system/drive_file_sync_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698