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

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

Issue 12660020: SyncFS: Fix up DCHECK failures (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 9 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/drive_file_sync_service.h" 5 #include "chrome/browser/sync_file_system/drive_file_sync_service.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1208 matching lines...) Expand 10 before | Expand all | Expand 10 after
1219 return LOCAL_SYNC_OPERATION_RESOLVE_TO_REMOTE; 1219 return LOCAL_SYNC_OPERATION_RESOLVE_TO_REMOTE;
1220 NOTREACHED(); 1220 NOTREACHED();
1221 return LOCAL_SYNC_OPERATION_FAIL; 1221 return LOCAL_SYNC_OPERATION_FAIL;
1222 } 1222 }
1223 1223
1224 RemoteChange remote_change; 1224 RemoteChange remote_change;
1225 const bool has_remote_change = GetPendingChangeForFileSystemURL( 1225 const bool has_remote_change = GetPendingChangeForFileSystemURL(
1226 url, &remote_change); 1226 url, &remote_change);
1227 1227
1228 if (has_remote_change) { 1228 if (has_remote_change) {
1229 if (param && !has_metadata) 1229 if (param && param->drive_metadata.resource_id().empty())
1230 param->drive_metadata.set_resource_id(remote_change.resource_id); 1230 param->drive_metadata.set_resource_id(remote_change.resource_id);
1231 1231
1232 // Remote change for the file identified by |url| exists in the pending 1232 // Remote change for the file identified by |url| exists in the pending
1233 // change queue. 1233 // change queue.
1234 const FileChange& remote_file_change = remote_change.change; 1234 const FileChange& remote_file_change = remote_change.change;
1235 1235
1236 // (RemoteChange) + (LocalChange) -> (Operation Type) 1236 // (RemoteChange) + (LocalChange) -> (Operation Type)
1237 // AddOrUpdate + AddOrUpdate -> CONFLICT 1237 // AddOrUpdate + AddOrUpdate -> CONFLICT
1238 // AddOrUpdate + Delete -> NONE 1238 // AddOrUpdate + Delete -> NONE
1239 // Delete + AddOrUpdate -> ADD 1239 // Delete + AddOrUpdate -> ADD
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
1297 NotifyTaskDone(status, token.Pass()); 1297 NotifyTaskDone(status, token.Pass());
1298 callback.Run(status); 1298 callback.Run(status);
1299 } 1299 }
1300 1300
1301 void DriveFileSyncService::DidUploadNewFileForLocalSync( 1301 void DriveFileSyncService::DidUploadNewFileForLocalSync(
1302 scoped_ptr<ApplyLocalChangeParam> param, 1302 scoped_ptr<ApplyLocalChangeParam> param,
1303 google_apis::GDataErrorCode error, 1303 google_apis::GDataErrorCode error,
1304 const std::string& resource_id, 1304 const std::string& resource_id,
1305 const std::string& file_md5) { 1305 const std::string& file_md5) {
1306 DCHECK(param); 1306 DCHECK(param);
1307 DCHECK(!param->has_drive_metadata);
1308 const FileSystemURL& url = param->url; 1307 const FileSystemURL& url = param->url;
1309 if (error == google_apis::HTTP_CREATED) { 1308 if (error == google_apis::HTTP_CREATED) {
1310 param->drive_metadata.set_resource_id(resource_id); 1309 param->drive_metadata.set_resource_id(resource_id);
1311 param->drive_metadata.set_md5_checksum(file_md5); 1310 param->drive_metadata.set_md5_checksum(file_md5);
1312 param->drive_metadata.set_conflicted(false); 1311 param->drive_metadata.set_conflicted(false);
1313 param->drive_metadata.set_to_be_fetched(false); 1312 param->drive_metadata.set_to_be_fetched(false);
1314 const DriveMetadata& metadata = param->drive_metadata; 1313 const DriveMetadata& metadata = param->drive_metadata;
1315 metadata_store_->UpdateEntry( 1314 metadata_store_->UpdateEntry(
1316 url, metadata, 1315 url, metadata,
1317 base::Bind(&DriveFileSyncService::DidApplyLocalChange, 1316 base::Bind(&DriveFileSyncService::DidApplyLocalChange,
(...skipping 1143 matching lines...) Expand 10 before | Expand all | Expand 10 after
2461 pending_batch_sync_origins_.insert(origin); 2460 pending_batch_sync_origins_.insert(origin);
2462 } 2461 }
2463 callback.Run(status, resource_id); 2462 callback.Run(status, resource_id);
2464 } 2463 }
2465 2464
2466 std::string DriveFileSyncService::sync_root_resource_id() { 2465 std::string DriveFileSyncService::sync_root_resource_id() {
2467 return metadata_store_->sync_root_directory(); 2466 return metadata_store_->sync_root_directory();
2468 } 2467 }
2469 2468
2470 } // namespace sync_file_system 2469 } // namespace sync_file_system
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698