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

Side by Side Diff: ios/chrome/browser/reading_list/reading_list_model.cc

Issue 2420013005: Remove usage of FOR_EACH_OBSERVER macro in ios/ (Closed)
Patch Set: typo 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "ios/chrome/browser/reading_list/reading_list_model.h" 5 #include "ios/chrome/browser/reading_list/reading_list_model.h"
6 6
7 ReadingListModel::ReadingListModel() : current_batch_updates_count_(0) {} 7 ReadingListModel::ReadingListModel() : current_batch_updates_count_(0) {}
8 ReadingListModel::~ReadingListModel() {} 8 ReadingListModel::~ReadingListModel() {}
9 9
10 // Observer methods. 10 // Observer methods.
(...skipping 14 matching lines...) Expand all
25 return current_batch_updates_count_ > 0; 25 return current_batch_updates_count_ > 0;
26 } 26 }
27 27
28 std::unique_ptr<ReadingListModel::ScopedReadingListBatchUpdate> 28 std::unique_ptr<ReadingListModel::ScopedReadingListBatchUpdate>
29 ReadingListModel::BeginBatchUpdates() { 29 ReadingListModel::BeginBatchUpdates() {
30 std::unique_ptr<ReadingListModel::ScopedReadingListBatchUpdate> token( 30 std::unique_ptr<ReadingListModel::ScopedReadingListBatchUpdate> token(
31 new ReadingListModel::ScopedReadingListBatchUpdate(this)); 31 new ReadingListModel::ScopedReadingListBatchUpdate(this));
32 32
33 ++current_batch_updates_count_; 33 ++current_batch_updates_count_;
34 if (current_batch_updates_count_ == 1) { 34 if (current_batch_updates_count_ == 1) {
35 FOR_EACH_OBSERVER(ReadingListModelObserver, observers_, 35 for (auto& observer : observers_)
36 ReadingListModelBeganBatchUpdates(this)); 36 observer.ReadingListModelBeganBatchUpdates(this);
37 } 37 }
38 return token; 38 return token;
39 } 39 }
40 40
41 void ReadingListModel::EndBatchUpdates() { 41 void ReadingListModel::EndBatchUpdates() {
42 DCHECK(IsPerformingBatchUpdates()); 42 DCHECK(IsPerformingBatchUpdates());
43 --current_batch_updates_count_; 43 --current_batch_updates_count_;
44 if (current_batch_updates_count_ == 0) { 44 if (current_batch_updates_count_ == 0) {
45 FOR_EACH_OBSERVER(ReadingListModelObserver, observers_, 45 for (auto& observer : observers_)
46 ReadingListModelCompletedBatchUpdates(this)); 46 observer.ReadingListModelCompletedBatchUpdates(this);
47 } 47 }
48 } 48 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698