Chromium Code Reviews| Index: components/proximity_auth/logging/log_buffer.h |
| diff --git a/components/proximity_auth/logging/log_buffer.h b/components/proximity_auth/logging/log_buffer.h |
| index 3fefd68b24cda61f5d0ed22772536537dd766243..3a1ffc8fef94c701277f6508268bb16b49a061da 100644 |
| --- a/components/proximity_auth/logging/log_buffer.h |
| +++ b/components/proximity_auth/logging/log_buffer.h |
| @@ -9,6 +9,7 @@ |
| #include "base/logging.h" |
| #include "base/macros.h" |
| +#include "base/observer_list.h" |
| #include "base/time/time.h" |
| namespace proximity_auth { |
| @@ -33,12 +34,22 @@ class LogBuffer { |
| logging::LogSeverity severity); |
| }; |
| + class Observer { |
| + public: |
| + virtual void OnLogMessageAdded(const LogMessage& log_message) = 0; |
| + virtual void OnLogBufferCleared() = 0; |
|
Ilya Sherman
2015/05/13 00:49:57
Please document these methods.
Tim Song
2015/05/13 02:24:37
Done.
|
| + }; |
| + |
| LogBuffer(); |
| ~LogBuffer(); |
| // Returns the global instance. |
| static LogBuffer* GetInstance(); |
| + // Adds and removes log buffer observers. |
| + void AddObserver(Observer* observer); |
| + void RemoveObserver(Observer* observer); |
| + |
| // Adds a new log message to the buffer. If the number of log messages exceeds |
| // the maximum, then the earliest added log will be removed. |
| void AddLogMessage(const LogMessage& log_message); |
| @@ -56,6 +67,9 @@ class LogBuffer { |
| // The messages currently in the buffer. |
| std::list<LogMessage> log_messages_; |
| + // List of observers. |
| + ObserverList<Observer> observers_; |
| + |
| DISALLOW_COPY_AND_ASSIGN(LogBuffer); |
| }; |