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

Side by Side Diff: chrome/browser/sync_file_system/task_logger.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
« no previous file with comments | « chrome/browser/sync_file_system/sync_file_system_service.cc ('k') | 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/task_logger.h" 5 #include "chrome/browser/sync_file_system/task_logger.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/synchronization/lock.h" 10 #include "base/synchronization/lock.h"
(...skipping 28 matching lines...) Expand all
39 void TaskLogger::RecordLog(std::unique_ptr<TaskLog> log) { 39 void TaskLogger::RecordLog(std::unique_ptr<TaskLog> log) {
40 if (!log) 40 if (!log)
41 return; 41 return;
42 42
43 if (log_history_.size() >= kMaxLogSize) { 43 if (log_history_.size() >= kMaxLogSize) {
44 log_history_.pop_front(); 44 log_history_.pop_front();
45 } 45 }
46 46
47 log_history_.push_back(std::move(log)); 47 log_history_.push_back(std::move(log));
48 48
49 FOR_EACH_OBSERVER(Observer, observers_, 49 for (auto& observer : observers_)
50 OnLogRecorded(*log_history_.back())); 50 observer.OnLogRecorded(*log_history_.back());
51 } 51 }
52 52
53 void TaskLogger::ClearLog() { 53 void TaskLogger::ClearLog() {
54 log_history_.clear(); 54 log_history_.clear();
55 } 55 }
56 56
57 void TaskLogger::AddObserver(Observer* observer) { 57 void TaskLogger::AddObserver(Observer* observer) {
58 observers_.AddObserver(observer); 58 observers_.AddObserver(observer);
59 } 59 }
60 60
61 void TaskLogger::RemoveObserver(Observer* observer) { 61 void TaskLogger::RemoveObserver(Observer* observer) {
62 observers_.RemoveObserver(observer); 62 observers_.RemoveObserver(observer);
63 } 63 }
64 64
65 const TaskLogger::LogList& TaskLogger::GetLog() const { 65 const TaskLogger::LogList& TaskLogger::GetLog() const {
66 return log_history_; 66 return log_history_;
67 } 67 }
68 68
69 } // namespace sync_file_system 69 } // namespace sync_file_system
OLDNEW
« no previous file with comments | « chrome/browser/sync_file_system/sync_file_system_service.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698