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

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

Issue 480413006: [SyncFS] Add idle callback to SyncFileSystemService for testing (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 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 | « chrome/browser/sync_file_system/sync_process_runner.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/sync_process_runner.cc
diff --git a/chrome/browser/sync_file_system/sync_process_runner.cc b/chrome/browser/sync_file_system/sync_process_runner.cc
index 5b91b3544cf991a7e7060a038b6295bc1194b734..a6320c744563cab94791021c89e4cc0658c3b225 100644
--- a/chrome/browser/sync_file_system/sync_process_runner.cc
+++ b/chrome/browser/sync_file_system/sync_process_runner.cc
@@ -145,14 +145,17 @@ void SyncProcessRunner::ResetThrottling() {
throttle_until_ = base::TimeTicks();
}
+SyncServiceState SyncProcessRunner::GetServiceState() {
+ return client_->GetSyncServiceState();
+}
+
void SyncProcessRunner::OnChangesUpdated(
int64 pending_changes) {
DCHECK_GE(pending_changes, 0);
int64 old_pending_changes = pending_changes_;
pending_changes_ = pending_changes;
if (old_pending_changes != pending_changes) {
- if (pending_changes == 0)
- client_->OnSyncIdle();
+ CheckIfIdle();
util::Log(logging::LOG_VERBOSE, FROM_HERE,
"[%s] pending_changes updated: %" PRId64,
name_.c_str(), pending_changes);
@@ -164,15 +167,12 @@ SyncFileSystemService* SyncProcessRunner::GetSyncService() {
return client_->GetSyncService();
}
-SyncServiceState SyncProcessRunner::GetServiceState() {
- return client_->GetSyncServiceState();
-}
-
void SyncProcessRunner::Finished(const base::TimeTicks& start_time,
SyncStatusCode status) {
DCHECK_LT(0u, running_tasks_);
DCHECK_LE(running_tasks_, max_parallel_task_);
--running_tasks_;
+ CheckIfIdle();
util::Log(logging::LOG_VERBOSE, FROM_HERE,
"[%s] * Finished (elapsed: %" PRId64 " ms)", name_.c_str(),
(timer_helper_->Now() - start_time).InMilliseconds());
@@ -238,4 +238,9 @@ void SyncProcessRunner::ScheduleInternal(int64 delay) {
base::Bind(&SyncProcessRunner::Run, base::Unretained(this)));
}
+void SyncProcessRunner::CheckIfIdle() {
+ if (pending_changes_ == 0 && running_tasks_ == 0)
+ client_->OnSyncIdle();
+}
+
} // namespace sync_file_system
« no previous file with comments | « chrome/browser/sync_file_system/sync_process_runner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698