Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 128 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 139 //--------------------------------------------------------------------------- | 139 //--------------------------------------------------------------------------- |
| 140 // SyncProcessRunner's. | 140 // SyncProcessRunner's. |
| 141 | 141 |
| 142 // SyncProcessRunner implementation for LocalSync. | 142 // SyncProcessRunner implementation for LocalSync. |
| 143 class LocalSyncRunner : public SyncProcessRunner, | 143 class LocalSyncRunner : public SyncProcessRunner, |
| 144 public LocalFileSyncService::Observer { | 144 public LocalFileSyncService::Observer { |
| 145 public: | 145 public: |
| 146 LocalSyncRunner(const std::string& name, | 146 LocalSyncRunner(const std::string& name, |
| 147 SyncFileSystemService* sync_service) | 147 SyncFileSystemService* sync_service) |
| 148 : SyncProcessRunner(name, sync_service, | 148 : SyncProcessRunner(name, sync_service, |
| 149 scoped_ptr<SyncProcessRunner::TimerHelper>(), 1), | 149 nullptr, // timer_helper |
| 150 1), | |
|
peria
2014/09/29 02:32:27
nit: would you add an inline comment for '1', too?
tzik
2014/09/29 18:34:53
Done.
| |
| 150 factory_(this) {} | 151 factory_(this) {} |
| 151 | 152 |
| 152 virtual void StartSync(const SyncStatusCallback& callback) OVERRIDE { | 153 virtual void StartSync(const SyncStatusCallback& callback) OVERRIDE { |
| 153 GetSyncService()->local_service_->ProcessLocalChange( | 154 GetSyncService()->local_service_->ProcessLocalChange( |
| 154 base::Bind(&LocalSyncRunner::DidProcessLocalChange, | 155 base::Bind(&LocalSyncRunner::DidProcessLocalChange, |
| 155 factory_.GetWeakPtr(), callback)); | 156 factory_.GetWeakPtr(), callback)); |
| 156 } | 157 } |
| 157 | 158 |
| 158 // LocalFileSyncService::Observer overrides. | 159 // LocalFileSyncService::Observer overrides. |
| 159 virtual void OnLocalChangeAvailable(int64 pending_changes) OVERRIDE { | 160 virtual void OnLocalChangeAvailable(int64 pending_changes) OVERRIDE { |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 182 }; | 183 }; |
| 183 | 184 |
| 184 // SyncProcessRunner implementation for RemoteSync. | 185 // SyncProcessRunner implementation for RemoteSync. |
| 185 class RemoteSyncRunner : public SyncProcessRunner, | 186 class RemoteSyncRunner : public SyncProcessRunner, |
| 186 public RemoteFileSyncService::Observer { | 187 public RemoteFileSyncService::Observer { |
| 187 public: | 188 public: |
| 188 RemoteSyncRunner(const std::string& name, | 189 RemoteSyncRunner(const std::string& name, |
| 189 SyncFileSystemService* sync_service, | 190 SyncFileSystemService* sync_service, |
| 190 RemoteFileSyncService* remote_service) | 191 RemoteFileSyncService* remote_service) |
| 191 : SyncProcessRunner(name, sync_service, | 192 : SyncProcessRunner(name, sync_service, |
| 192 scoped_ptr<SyncProcessRunner::TimerHelper>(), 1), | 193 nullptr, // timer_helper |
| 194 1), | |
|
peria
2014/09/29 02:32:27
nit: ditto
tzik
2014/09/29 18:34:53
Done.
| |
| 193 remote_service_(remote_service), | 195 remote_service_(remote_service), |
| 194 last_state_(REMOTE_SERVICE_OK), | 196 last_state_(REMOTE_SERVICE_OK), |
| 195 factory_(this) {} | 197 factory_(this) {} |
| 196 | 198 |
| 197 virtual void StartSync(const SyncStatusCallback& callback) OVERRIDE { | 199 virtual void StartSync(const SyncStatusCallback& callback) OVERRIDE { |
| 198 remote_service_->ProcessRemoteChange( | 200 remote_service_->ProcessRemoteChange( |
| 199 base::Bind(&RemoteSyncRunner::DidProcessRemoteChange, | 201 base::Bind(&RemoteSyncRunner::DidProcessRemoteChange, |
| 200 factory_.GetWeakPtr(), callback)); | 202 factory_.GetWeakPtr(), callback)); |
| 201 } | 203 } |
| 202 | 204 |
| (...skipping 542 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 745 iter != remote_sync_runners_.end(); ++iter) | 747 iter != remote_sync_runners_.end(); ++iter) |
| 746 ((*iter)->*method)(); | 748 ((*iter)->*method)(); |
| 747 } | 749 } |
| 748 | 750 |
| 749 RemoteFileSyncService* SyncFileSystemService::GetRemoteService( | 751 RemoteFileSyncService* SyncFileSystemService::GetRemoteService( |
| 750 const GURL& origin) { | 752 const GURL& origin) { |
| 751 return remote_service_.get(); | 753 return remote_service_.get(); |
| 752 } | 754 } |
| 753 | 755 |
| 754 } // namespace sync_file_system | 756 } // namespace sync_file_system |
| OLD | NEW |