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

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

Issue 2425553002: Remove FOR_EACH_OBSERVER macro usage in chrome/browser/sync_file_system (Closed)
Patch Set: Created 4 years, 2 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
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/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/single_thread_task_runner.h" 8 #include "base/single_thread_task_runner.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/threading/thread_task_runner_handle.h" 10 #include "base/threading/thread_task_runner_handle.h"
(...skipping 311 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 SyncFileSystemBackend* backend = 322 SyncFileSystemBackend* backend =
323 SyncFileSystemBackend::GetBackend(origin_to_contexts_[origin]); 323 SyncFileSystemBackend::GetBackend(origin_to_contexts_[origin]);
324 DCHECK(backend); 324 DCHECK(backend);
325 DCHECK(backend->change_tracker()); 325 DCHECK(backend->change_tracker());
326 origin_change_map_.SetOriginChangeCount( 326 origin_change_map_.SetOriginChangeCount(
327 origin, backend->change_tracker()->num_changes()); 327 origin, backend->change_tracker()->num_changes());
328 } 328 }
329 if (!need_notification) 329 if (!need_notification)
330 return; 330 return;
331 int64_t num_changes = origin_change_map_.GetTotalChangeCount(); 331 int64_t num_changes = origin_change_map_.GetTotalChangeCount();
332 FOR_EACH_OBSERVER(Observer, change_observers_, 332 for (auto& observer : change_observers_)
333 OnLocalChangeAvailable(num_changes)); 333 observer.OnLocalChangeAvailable(num_changes);
334 } 334 }
335 335
336 void LocalFileSyncService::SetOriginEnabled(const GURL& origin, bool enabled) { 336 void LocalFileSyncService::SetOriginEnabled(const GURL& origin, bool enabled) {
337 if (!base::ContainsKey(origin_to_contexts_, origin)) 337 if (!base::ContainsKey(origin_to_contexts_, origin))
338 return; 338 return;
339 origin_change_map_.SetOriginEnabled(origin, enabled); 339 origin_change_map_.SetOriginEnabled(origin, enabled);
340 } 340 }
341 341
342 LocalFileSyncService::LocalFileSyncService(Profile* profile, 342 LocalFileSyncService::LocalFileSyncService(Profile* profile,
343 leveldb::Env* env_override) 343 leveldb::Env* env_override)
(...skipping 24 matching lines...) Expand all
368 pending_origins_with_changes_.end()) { 368 pending_origins_with_changes_.end()) {
369 // We have remaining changes for the origin. 369 // We have remaining changes for the origin.
370 pending_origins_with_changes_.erase(app_origin); 370 pending_origins_with_changes_.erase(app_origin);
371 SyncFileSystemBackend* backend = 371 SyncFileSystemBackend* backend =
372 SyncFileSystemBackend::GetBackend(file_system_context); 372 SyncFileSystemBackend::GetBackend(file_system_context);
373 DCHECK(backend); 373 DCHECK(backend);
374 DCHECK(backend->change_tracker()); 374 DCHECK(backend->change_tracker());
375 origin_change_map_.SetOriginChangeCount( 375 origin_change_map_.SetOriginChangeCount(
376 app_origin, backend->change_tracker()->num_changes()); 376 app_origin, backend->change_tracker()->num_changes());
377 int64_t num_changes = origin_change_map_.GetTotalChangeCount(); 377 int64_t num_changes = origin_change_map_.GetTotalChangeCount();
378 FOR_EACH_OBSERVER(Observer, change_observers_, 378 for (auto& observer : change_observers_)
379 OnLocalChangeAvailable(num_changes)); 379 observer.OnLocalChangeAvailable(num_changes);
380 } 380 }
381 callback.Run(status); 381 callback.Run(status);
382 } 382 }
383 383
384 void LocalFileSyncService::DidInitializeForRemoteSync( 384 void LocalFileSyncService::DidInitializeForRemoteSync(
385 const FileSystemURL& url, 385 const FileSystemURL& url,
386 storage::FileSystemContext* file_system_context, 386 storage::FileSystemContext* file_system_context,
387 const PrepareChangeCallback& callback, 387 const PrepareChangeCallback& callback,
388 SyncStatusCode status) { 388 SyncStatusCode status) {
389 if (status != SYNC_STATUS_OK) { 389 if (status != SYNC_STATUS_OK) {
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
489 489
490 LocalChangeProcessor* LocalFileSyncService::GetLocalChangeProcessor( 490 LocalChangeProcessor* LocalFileSyncService::GetLocalChangeProcessor(
491 const FileSystemURL& url) { 491 const FileSystemURL& url) {
492 if (!get_local_change_processor_.is_null()) 492 if (!get_local_change_processor_.is_null())
493 return get_local_change_processor_.Run(url.origin()); 493 return get_local_change_processor_.Run(url.origin());
494 DCHECK(local_change_processor_); 494 DCHECK(local_change_processor_);
495 return local_change_processor_; 495 return local_change_processor_;
496 } 496 }
497 497
498 } // namespace sync_file_system 498 } // namespace sync_file_system
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698