Chromium Code Reviews| Index: chrome/browser/sync_file_system/drive_file_sync_service.cc |
| diff --git a/chrome/browser/sync_file_system/drive_file_sync_service.cc b/chrome/browser/sync_file_system/drive_file_sync_service.cc |
| index 84222cecad3aadaa65c0ce986420ee90db9705d1..58b0b8571ed9f081919569d6210881ac3f8c2af6 100644 |
| --- a/chrome/browser/sync_file_system/drive_file_sync_service.cc |
| +++ b/chrome/browser/sync_file_system/drive_file_sync_service.cc |
| @@ -327,12 +327,12 @@ void DriveFileSyncService::UnregisterOriginForTrackingChanges( |
| return; |
| } |
| - URLToChange::iterator found = url_to_change_.find(origin); |
| - if (found != url_to_change_.end()) { |
| - for (PathToChange::iterator itr = found->second.begin(); |
| + OriginToChangesMap::iterator found = origin_to_changes_map_.find(origin); |
| + if (found != origin_to_changes_map_.end()) { |
| + for (PathToChangeMap::iterator itr = found->second.begin(); |
| itr != found->second.end(); ++itr) |
| pending_changes_.erase(itr->second.position_in_queue); |
| - url_to_change_.erase(found); |
| + origin_to_changes_map_.erase(found); |
| } |
| metadata_store_->RemoveOrigin(origin, base::Bind( |
| @@ -371,8 +371,8 @@ void DriveFileSyncService::ProcessRemoteChange( |
| const fileapi::FileSystemURL& url = pending_changes_.begin()->url; |
| const GURL& origin = url.origin(); |
| const FilePath& path = url.path(); |
| - DCHECK(ContainsKey(url_to_change_, origin)); |
| - PathToChange* path_to_change = &url_to_change_[origin]; |
| + DCHECK(ContainsKey(origin_to_changes_map_, origin)); |
| + PathToChangeMap* path_to_change = &origin_to_changes_map_[origin]; |
| DCHECK(ContainsKey(*path_to_change, path)); |
| const RemoteChange& remote_change = (*path_to_change)[path]; |
| @@ -887,6 +887,11 @@ void DriveFileSyncService::DidGetDirectoryContentForBatchSync( |
| return; |
| } |
| + if (metadata_store_->IsBatchSyncOrigin(origin) && |
|
kinuko
2013/01/07 09:28:31
nit: can you add a brief comment like: 'Move the o
tzik
2013/01/07 11:16:14
Done.
|
| + !ContainsKey(origin_to_changes_map_, origin)) { |
| + metadata_store_->MoveBatchSyncOriginToIncremental(origin); |
| + } |
| + |
| NotifyTaskDone(fileapi::SYNC_STATUS_OK, token.Pass()); |
| } |
| @@ -1488,8 +1493,8 @@ bool DriveFileSyncService::AppendRemoteChangeInternal( |
| const std::string& resource_id, |
| int64 changestamp, |
| RemoteSyncType sync_type) { |
| - PathToChange* path_to_change = &url_to_change_[origin]; |
| - PathToChange::iterator found = path_to_change->find(path); |
| + PathToChangeMap* path_to_change = &origin_to_changes_map_[origin]; |
| + PathToChangeMap::iterator found = path_to_change->find(path); |
| if (found != path_to_change->end()) { |
| if (found->second.changestamp >= changestamp) |
| return false; |
| @@ -1527,22 +1532,23 @@ bool DriveFileSyncService::AppendRemoteChangeInternal( |
| void DriveFileSyncService::RemoveRemoteChange( |
| const fileapi::FileSystemURL& url) { |
| - URLToChange::iterator found_origin = url_to_change_.find(url.origin()); |
| - if (found_origin == url_to_change_.end()) |
| + OriginToChangesMap::iterator found_origin = |
| + origin_to_changes_map_.find(url.origin()); |
| + if (found_origin == origin_to_changes_map_.end()) |
| return; |
| - PathToChange* path_to_change = &found_origin->second; |
| - PathToChange::iterator found_change = path_to_change->find(url.path()); |
| + PathToChangeMap* path_to_change = &found_origin->second; |
| + PathToChangeMap::iterator found_change = path_to_change->find(url.path()); |
| if (found_change == path_to_change->end()) |
| return; |
| pending_changes_.erase(found_change->second.position_in_queue); |
| path_to_change->erase(found_change); |
| if (path_to_change->empty()) |
| - url_to_change_.erase(found_origin); |
| + origin_to_changes_map_.erase(found_origin); |
| if (metadata_store_->IsBatchSyncOrigin(url.origin()) && |
| - !ContainsKey(url_to_change_, url.origin())) { |
| + !ContainsKey(origin_to_changes_map_, url.origin())) { |
| metadata_store_->MoveBatchSyncOriginToIncremental(url.origin()); |
| } |
| } |
| @@ -1551,11 +1557,12 @@ bool DriveFileSyncService::GetPendingChangeForFileSystemURL( |
| const fileapi::FileSystemURL& url, |
| RemoteChange* change) const { |
| DCHECK(change); |
| - URLToChange::const_iterator found_url = url_to_change_.find(url.origin()); |
| - if (found_url == url_to_change_.end()) |
| + OriginToChangesMap::const_iterator found_url = |
| + origin_to_changes_map_.find(url.origin()); |
| + if (found_url == origin_to_changes_map_.end()) |
| return false; |
| - const PathToChange& path_to_change = found_url->second; |
| - PathToChange::const_iterator found_path = path_to_change.find(url.path()); |
| + const PathToChangeMap& path_to_change = found_url->second; |
| + PathToChangeMap::const_iterator found_path = path_to_change.find(url.path()); |
| if (found_path == path_to_change.end()) |
| return false; |
| *change = found_path->second; |