Skip to content

Commit

Permalink
Cleanup: match the function order and remove TODOs in sync_file_syste…
Browse files Browse the repository at this point in the history
…m_service

No functional changes.

BUG=none
TEST=none

Review URL: https://codereview.chromium.org/11299197

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@169627 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
kinuko@chromium.org committed Nov 27, 2012
1 parent 6100873 commit a01a533
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 44 deletions.
2 changes: 0 additions & 2 deletions chrome/browser/sync_file_system/drive_file_sync_client.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,6 @@ namespace sync_file_system {
class DriveFileSyncClient : public base::NonThreadSafe,
public base::SupportsWeakPtr<DriveFileSyncClient> {
public:
// TODO(tzik): Implement a function to map GDataErrorcode to SyncStatusCode.
// crbug.com/157837
typedef base::Callback<void(google_apis::GDataErrorCode error)>
GDataErrorCallback;
typedef base::Callback<void(google_apis::GDataErrorCode error,
Expand Down
82 changes: 40 additions & 42 deletions chrome/browser/sync_file_system/sync_file_system_service.cc
Original file line number Diff line number Diff line change
Expand Up @@ -245,48 +245,6 @@ void SyncFileSystemService::RemoveSyncEventObserver(
observer_map_[app_origin]->RemoveObserver(observer);
}

// TODO(kinuko): Move these On*ChangeAvailable implementation to make the
// order match with that in .h.
void SyncFileSystemService::OnLocalChangeAvailable(int64 pending_changes) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_GE(pending_changes, 0);
pending_local_changes_ = pending_changes;
base::MessageLoopProxy::current()->PostTask(
FROM_HERE, base::Bind(&SyncFileSystemService::MaybeStartSync,
AsWeakPtr()));
}

void SyncFileSystemService::OnRemoteChangeAvailable(int64 pending_changes) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_GE(pending_changes, 0);
pending_remote_changes_ = pending_changes;
if (pending_changes > 0) {
// The smallest change available might have changed from the previous one.
// Reset the is_waiting_remote_sync_enabled_ flag so that we can retry.
is_waiting_remote_sync_enabled_ = false;
}
base::MessageLoopProxy::current()->PostTask(
FROM_HERE, base::Bind(&SyncFileSystemService::MaybeStartSync,
AsWeakPtr()));
}

void SyncFileSystemService::OnRemoteServiceStateUpdated(
RemoteServiceState state,
const std::string& description) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
for (ObserverMap::iterator iter = observer_map_.begin();
iter != observer_map_.end(); ++iter) {
FOR_EACH_OBSERVER(SyncEventObserver, *iter->second,
OnSyncStateUpdated(RemoteStateToSyncServiceState(state),
description));
}
if (state == REMOTE_SERVICE_OK) {
base::MessageLoopProxy::current()->PostTask(
FROM_HERE, base::Bind(&SyncFileSystemService::MaybeStartSync,
AsWeakPtr()));
}
}

SyncFileSystemService::SyncFileSystemService(Profile* profile)
: profile_(profile),
pending_local_changes_(0),
Expand Down Expand Up @@ -455,6 +413,46 @@ void SyncFileSystemService::OnSyncEnabledForRemoteSync() {
MaybeStartRemoteSync();
}

void SyncFileSystemService::OnLocalChangeAvailable(int64 pending_changes) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_GE(pending_changes, 0);
pending_local_changes_ = pending_changes;
base::MessageLoopProxy::current()->PostTask(
FROM_HERE, base::Bind(&SyncFileSystemService::MaybeStartSync,
AsWeakPtr()));
}

void SyncFileSystemService::OnRemoteChangeAvailable(int64 pending_changes) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
DCHECK_GE(pending_changes, 0);
pending_remote_changes_ = pending_changes;
if (pending_changes > 0) {
// The smallest change available might have changed from the previous one.
// Reset the is_waiting_remote_sync_enabled_ flag so that we can retry.
is_waiting_remote_sync_enabled_ = false;
}
base::MessageLoopProxy::current()->PostTask(
FROM_HERE, base::Bind(&SyncFileSystemService::MaybeStartSync,
AsWeakPtr()));
}

void SyncFileSystemService::OnRemoteServiceStateUpdated(
RemoteServiceState state,
const std::string& description) {
DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
for (ObserverMap::iterator iter = observer_map_.begin();
iter != observer_map_.end(); ++iter) {
FOR_EACH_OBSERVER(SyncEventObserver, *iter->second,
OnSyncStateUpdated(RemoteStateToSyncServiceState(state),
description));
}
if (state == REMOTE_SERVICE_OK) {
base::MessageLoopProxy::current()->PostTask(
FROM_HERE, base::Bind(&SyncFileSystemService::MaybeStartSync,
AsWeakPtr()));
}
}

// SyncFileSystemServiceFactory -----------------------------------------------

// static
Expand Down

0 comments on commit a01a533

Please sign in to comment.