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

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

Issue 386523002: [SyncFS] Refine SyncProcessRunner's throttling algorithm for parallel task support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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_file_system/sync_process_runner.h
diff --git a/chrome/browser/sync_file_system/sync_process_runner.h b/chrome/browser/sync_file_system/sync_process_runner.h
index 0143cfefd3bc556b869dacd85f2b991d74f916ee..3fa10920fb3456bfed98b5f283ac91363535de57 100644
--- a/chrome/browser/sync_file_system/sync_process_runner.h
+++ b/chrome/browser/sync_file_system/sync_process_runner.h
@@ -67,7 +67,7 @@ class SyncProcessRunner {
SyncProcessRunner(const std::string& name,
Client* client,
scoped_ptr<TimerHelper> timer_helper,
- int max_parallel_task);
+ size_t max_parallel_task);
virtual ~SyncProcessRunner();
// Subclass must implement this.
@@ -75,7 +75,6 @@ class SyncProcessRunner {
// Schedules a new sync.
void Schedule();
- void ScheduleIfNotRunning();
int64 pending_changes() const { return pending_changes_; }
@@ -92,14 +91,26 @@ class SyncProcessRunner {
void Run();
void ScheduleInternal(int64 delay);
+ // Throttles new sync for |base_delay| milliseconds for an error case.
+ // If new sync is already throttled, back off the duration.
+ void ThrottleSync(int64 base_delay);
+
+ // Clears old throttling setting that is already over.
+ void ResetOldThrottling();
+ void ResetThrottling();
+
std::string name_;
Client* client_;
- int max_parallel_task_;
- int running_tasks_;
+ size_t max_parallel_task_;
+ size_t running_tasks_;
scoped_ptr<TimerHelper> timer_helper_;
+ base::TimeTicks last_run_;
base::TimeTicks last_scheduled_;
- int64 current_delay_;
- int64 last_delay_;
+ SyncServiceState service_state_;
+
+ base::TimeTicks throttle_from_;
+ base::TimeTicks throttle_until_;
+
int64 pending_changes_;
base::WeakPtrFactory<SyncProcessRunner> factory_;

Powered by Google App Engine
This is Rietveld 408576698