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

Side by Side Diff: chrome/browser/sync_file_system/local/local_file_sync_service.cc

Issue 98633003: SyncFS v2: Add modest logging for ApplyLocalChange, ApplyRemoteChange (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/local/local_file_sync_service.h" 5 #include "chrome/browser/sync_file_system/local/local_file_sync_service.h"
6 6
7 #include "base/stl_util.h" 7 #include "base/stl_util.h"
8 #include "chrome/browser/extensions/extension_service.h" 8 #include "chrome/browser/extensions/extension_service.h"
9 #include "chrome/browser/extensions/extension_system.h" 9 #include "chrome/browser/extensions/extension_system.h"
10 #include "chrome/browser/profiles/profile.h" 10 #include "chrome/browser/profiles/profile.h"
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 LocalFileSyncContext::SYNC_EXCLUSIVE, 240 LocalFileSyncContext::SYNC_EXCLUSIVE,
241 base::Bind(&PrepareForProcessRemoteChangeCallbackAdapter, callback)); 241 base::Bind(&PrepareForProcessRemoteChangeCallbackAdapter, callback));
242 } 242 }
243 243
244 void LocalFileSyncService::ApplyRemoteChange( 244 void LocalFileSyncService::ApplyRemoteChange(
245 const FileChange& change, 245 const FileChange& change,
246 const base::FilePath& local_path, 246 const base::FilePath& local_path,
247 const FileSystemURL& url, 247 const FileSystemURL& url,
248 const SyncStatusCallback& callback) { 248 const SyncStatusCallback& callback) {
249 DCHECK(ContainsKey(origin_to_contexts_, url.origin())); 249 DCHECK(ContainsKey(origin_to_contexts_, url.origin()));
250 util::Log(logging::LOG_INFO, FROM_HERE,
251 "[Remote->Local] ApplyRemoteChange: %s on %s",
252 change.DebugString().c_str(),
253 url.DebugString().c_str());
254
250 sync_context_->ApplyRemoteChange( 255 sync_context_->ApplyRemoteChange(
251 origin_to_contexts_[url.origin()], 256 origin_to_contexts_[url.origin()],
252 change, local_path, url, callback); 257 change, local_path, url,
258 base::Bind(&LocalFileSyncService::DidApplyRemoteChange, AsWeakPtr(),
259 callback));
253 } 260 }
254 261
255 void LocalFileSyncService::FinalizeRemoteSync( 262 void LocalFileSyncService::FinalizeRemoteSync(
256 const FileSystemURL& url, 263 const FileSystemURL& url,
257 bool clear_local_changes, 264 bool clear_local_changes,
258 const base::Closure& completion_callback) { 265 const base::Closure& completion_callback) {
259 DCHECK(ContainsKey(origin_to_contexts_, url.origin())); 266 DCHECK(ContainsKey(origin_to_contexts_, url.origin()));
260 sync_context_->FinalizeExclusiveSync( 267 sync_context_->FinalizeExclusiveSync(
261 origin_to_contexts_[url.origin()], 268 origin_to_contexts_[url.origin()],
262 url, clear_local_changes, completion_callback); 269 url, clear_local_changes, completion_callback);
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after
356 SyncStatusCode status, 363 SyncStatusCode status,
357 const FileSystemURL& url) { 364 const FileSystemURL& url) {
358 DVLOG(1) << "Local sync is finished with: " << status 365 DVLOG(1) << "Local sync is finished with: " << status
359 << " on " << url.DebugString(); 366 << " on " << url.DebugString();
360 DCHECK(!local_sync_callback_.is_null()); 367 DCHECK(!local_sync_callback_.is_null());
361 SyncFileCallback callback = local_sync_callback_; 368 SyncFileCallback callback = local_sync_callback_;
362 local_sync_callback_.Reset(); 369 local_sync_callback_.Reset();
363 callback.Run(status, url); 370 callback.Run(status, url);
364 } 371 }
365 372
373 void LocalFileSyncService::DidApplyRemoteChange(
374 const SyncStatusCallback& callback,
375 SyncStatusCode status) {
376 util::Log(logging::LOG_INFO, FROM_HERE,
377 "[Remote->Local] ApplyRemoteChange finished --> %s",
378 SyncStatusCodeToString(status));
379 callback.Run(status);
380 }
381
366 void LocalFileSyncService::DidGetFileForLocalSync( 382 void LocalFileSyncService::DidGetFileForLocalSync(
367 SyncStatusCode status, 383 SyncStatusCode status,
368 const LocalFileSyncInfo& sync_file_info, 384 const LocalFileSyncInfo& sync_file_info,
369 webkit_blob::ScopedFile snapshot) { 385 webkit_blob::ScopedFile snapshot) {
370 DCHECK(!local_sync_callback_.is_null()); 386 DCHECK(!local_sync_callback_.is_null());
371 if (status != SYNC_STATUS_OK) { 387 if (status != SYNC_STATUS_OK) {
372 RunLocalSyncCallback(status, sync_file_info.url); 388 RunLocalSyncCallback(status, sync_file_info.url);
373 return; 389 return;
374 } 390 }
375 if (sync_file_info.changes.empty()) { 391 if (sync_file_info.changes.empty()) {
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
446 462
447 LocalChangeProcessor* LocalFileSyncService::GetLocalChangeProcessor( 463 LocalChangeProcessor* LocalFileSyncService::GetLocalChangeProcessor(
448 const FileSystemURL& url) { 464 const FileSystemURL& url) {
449 if (!get_local_change_processor_.is_null()) 465 if (!get_local_change_processor_.is_null())
450 return get_local_change_processor_.Run(url.origin()); 466 return get_local_change_processor_.Run(url.origin());
451 DCHECK(local_change_processor_); 467 DCHECK(local_change_processor_);
452 return local_change_processor_; 468 return local_change_processor_;
453 } 469 }
454 470
455 } // namespace sync_file_system 471 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698