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

Side by Side Diff: components/drive/chromeos/change_list_loader.cc

Issue 2421083002: Replace FOR_EACH_OBSERVER in components/drive with range-based for (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
« no previous file with comments | « no previous file | components/drive/chromeos/directory_loader.cc » ('j') | 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 "components/drive/chromeos/change_list_loader.h" 5 #include "components/drive/chromeos/change_list_loader.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <set> 9 #include <set>
10 #include <utility> 10 #include <utility>
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after
449 // Start loading the change list. 449 // Start loading the change list.
450 LoadChangeListFromServer(start_changestamp); 450 LoadChangeListFromServer(start_changestamp);
451 } 451 }
452 } 452 }
453 453
454 void ChangeListLoader::OnChangeListLoadComplete(FileError error) { 454 void ChangeListLoader::OnChangeListLoadComplete(FileError error) {
455 DCHECK(thread_checker_.CalledOnValidThread()); 455 DCHECK(thread_checker_.CalledOnValidThread());
456 456
457 if (!loaded_ && error == FILE_ERROR_OK) { 457 if (!loaded_ && error == FILE_ERROR_OK) {
458 loaded_ = true; 458 loaded_ = true;
459 FOR_EACH_OBSERVER(ChangeListLoaderObserver, 459 for (auto& observer : observers_)
460 observers_, 460 observer.OnInitialLoadComplete();
461 OnInitialLoadComplete());
462 } 461 }
463 462
464 for (size_t i = 0; i < pending_load_callback_.size(); ++i) { 463 for (size_t i = 0; i < pending_load_callback_.size(); ++i) {
465 base::ThreadTaskRunnerHandle::Get()->PostTask( 464 base::ThreadTaskRunnerHandle::Get()->PostTask(
466 FROM_HERE, 465 FROM_HERE,
467 base::Bind(pending_load_callback_[i], error)); 466 base::Bind(pending_load_callback_[i], error));
468 } 467 }
469 pending_load_callback_.clear(); 468 pending_load_callback_.clear();
470 469
471 // If there is pending update check, try to load the change from the server 470 // If there is pending update check, try to load the change from the server
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
561 const base::Time& start_time, 560 const base::Time& start_time,
562 FileError error) { 561 FileError error) {
563 DCHECK(thread_checker_.CalledOnValidThread()); 562 DCHECK(thread_checker_.CalledOnValidThread());
564 563
565 const base::TimeDelta elapsed = base::Time::Now() - start_time; 564 const base::TimeDelta elapsed = base::Time::Now() - start_time;
566 logger_->Log(logging::LOG_INFO, 565 logger_->Log(logging::LOG_INFO,
567 "Change lists applied (elapsed time: %sms)", 566 "Change lists applied (elapsed time: %sms)",
568 base::Int64ToString(elapsed.InMilliseconds()).c_str()); 567 base::Int64ToString(elapsed.InMilliseconds()).c_str());
569 568
570 if (should_notify_changed_directories) { 569 if (should_notify_changed_directories) {
571 FOR_EACH_OBSERVER(ChangeListLoaderObserver, 570 for (auto& observer : observers_)
572 observers_, 571 observer.OnFileChanged(change_list_processor->changed_files());
573 OnFileChanged(change_list_processor->changed_files()));
574 } 572 }
575 573
576 OnChangeListLoadComplete(error); 574 OnChangeListLoadComplete(error);
577 575
578 FOR_EACH_OBSERVER(ChangeListLoaderObserver, 576 for (auto& observer : observers_)
579 observers_, 577 observer.OnLoadFromServerComplete();
580 OnLoadFromServerComplete());
581 } 578 }
582 579
583 } // namespace internal 580 } // namespace internal
584 } // namespace drive 581 } // namespace drive
OLDNEW
« no previous file with comments | « no previous file | components/drive/chromeos/directory_loader.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698