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

Side by Side Diff: chrome/browser/sync_file_system/sync_file_system_service.cc

Issue 386523002: [SyncFS] Refine SyncProcessRunner's throttling algorithm for parallel task support (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/sync_file_system/sync_file_system_service.h" 5 #include "chrome/browser/sync_file_system/sync_file_system_service.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/format_macros.h" 10 #include "base/format_macros.h"
(...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after
154 factory_.GetWeakPtr(), callback)); 154 factory_.GetWeakPtr(), callback));
155 } 155 }
156 156
157 // LocalFileSyncService::Observer overrides. 157 // LocalFileSyncService::Observer overrides.
158 virtual void OnLocalChangeAvailable(int64 pending_changes) OVERRIDE { 158 virtual void OnLocalChangeAvailable(int64 pending_changes) OVERRIDE {
159 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 159 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
160 160
161 OnChangesUpdated(pending_changes); 161 OnChangesUpdated(pending_changes);
162 162
163 // Kick other sync runners just in case they're not running. 163 // Kick other sync runners just in case they're not running.
164 GetSyncService()->RunForEachSyncRunners( 164 GetSyncService()->RunForEachSyncRunners(&SyncProcessRunner::Schedule);
165 &SyncProcessRunner::ScheduleIfNotRunning);
166 } 165 }
167 166
168 private: 167 private:
169 void DidProcessLocalChange( 168 void DidProcessLocalChange(
170 const SyncStatusCallback& callback, 169 const SyncStatusCallback& callback,
171 SyncStatusCode status, 170 SyncStatusCode status,
172 const FileSystemURL& url) { 171 const FileSystemURL& url) {
173 util::Log(logging::LOG_VERBOSE, FROM_HERE, 172 util::Log(logging::LOG_VERBOSE, FROM_HERE,
174 "ProcessLocalChange finished with status=%d (%s) for url=%s", 173 "ProcessLocalChange finished with status=%d (%s) for url=%s",
175 status, SyncStatusCodeToString(status), 174 status, SyncStatusCodeToString(status),
(...skipping 28 matching lines...) Expand all
204 return RemoteStateToSyncServiceState(last_state_); 203 return RemoteStateToSyncServiceState(last_state_);
205 } 204 }
206 205
207 // RemoteFileSyncService::Observer overrides. 206 // RemoteFileSyncService::Observer overrides.
208 virtual void OnRemoteChangeQueueUpdated(int64 pending_changes) OVERRIDE { 207 virtual void OnRemoteChangeQueueUpdated(int64 pending_changes) OVERRIDE {
209 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 208 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
210 209
211 OnChangesUpdated(pending_changes); 210 OnChangesUpdated(pending_changes);
212 211
213 // Kick other sync runners just in case they're not running. 212 // Kick other sync runners just in case they're not running.
214 GetSyncService()->RunForEachSyncRunners( 213 GetSyncService()->RunForEachSyncRunners(&SyncProcessRunner::Schedule);
215 &SyncProcessRunner::ScheduleIfNotRunning);
216 } 214 }
217 215
218 virtual void OnRemoteServiceStateUpdated( 216 virtual void OnRemoteServiceStateUpdated(
219 RemoteServiceState state, 217 RemoteServiceState state,
220 const std::string& description) OVERRIDE { 218 const std::string& description) OVERRIDE {
221 // Just forward to SyncFileSystemService. 219 // Just forward to SyncFileSystemService.
222 GetSyncService()->OnRemoteServiceStateUpdated(state, description); 220 GetSyncService()->OnRemoteServiceStateUpdated(state, description);
223 last_state_ = state; 221 last_state_ = state;
224 } 222 }
225 223
(...skipping 524 matching lines...) Expand 10 before | Expand all | Expand 10 after
750 v2_remote_service_->AddServiceObserver(v2_remote_syncer.get()); 748 v2_remote_service_->AddServiceObserver(v2_remote_syncer.get());
751 v2_remote_service_->AddFileStatusObserver(this); 749 v2_remote_service_->AddFileStatusObserver(this);
752 v2_remote_service_->SetRemoteChangeProcessor(local_service_.get()); 750 v2_remote_service_->SetRemoteChangeProcessor(local_service_.get());
753 v2_remote_service_->SetSyncEnabled(sync_enabled_); 751 v2_remote_service_->SetSyncEnabled(sync_enabled_);
754 remote_sync_runners_.push_back(v2_remote_syncer.release()); 752 remote_sync_runners_.push_back(v2_remote_syncer.release());
755 } 753 }
756 return v2_remote_service_.get(); 754 return v2_remote_service_.get();
757 } 755 }
758 756
759 } // namespace sync_file_system 757 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698