Chromium Code Reviews| Index: chrome/browser/invalidation/invalidation_logger.h |
| diff --git a/chrome/browser/invalidation/invalidation_logger.h b/chrome/browser/invalidation/invalidation_logger.h |
| index 0d80b9a2b69763c57c522b5d69275d9e6b53bcd1..d7ff3636098fd618b3cdb00c18f7b6db07ba5051 100644 |
| --- a/chrome/browser/invalidation/invalidation_logger.h |
| +++ b/chrome/browser/invalidation/invalidation_logger.h |
| @@ -5,8 +5,10 @@ |
| #ifndef CHROME_BROWSER_INVALIDATION_INVALIDATION_LOGGER_H_ |
| #define CHROME_BROWSER_INVALIDATION_INVALIDATION_LOGGER_H_ |
| +#include <map> |
| #include "base/memory/scoped_ptr.h" |
| #include "base/observer_list.h" |
| +#include "sync/notifier/invalidation_util.h" |
| #include "sync/notifier/invalidator_state.h" |
| namespace base { |
| @@ -14,38 +16,57 @@ class DictionaryValue; |
| } // namespace base |
| namespace syncer { |
| +class InvalidationHandler; |
| class ObjectIdInvalidationMap; |
| -} |
| +} // namespace syncer |
| namespace invalidation { |
| + |
| class InvalidationLoggerObserver; |
| class InvalidationLogger { |
|
James Hawkins
2014/02/18 17:19:22
Please add documentation for this class. It's har
mferreria_g
2014/02/18 18:06:51
Done. Is this clearer?
|
| public: |
| + InvalidationLogger(); |
| + ~InvalidationLogger(); |
| + |
| // Pass through to any registered InvalidationLoggerObservers. |
| // We will do local logging here too. |
| void OnRegistration(const base::DictionaryValue& details); |
| void OnUnregistration(const base::DictionaryValue& details); |
| - void OnStateChange(const syncer::InvalidatorState& newState); |
| - void OnUpdateIds(const base::DictionaryValue& details); |
| + void OnStateChange(const syncer::InvalidatorState& new_state); |
| + void OnUpdateIds(std::map<std::string, syncer::ObjectIdSet> updated_ids); |
| void OnDebugMessage(const base::DictionaryValue& details); |
| void OnInvalidation(const syncer::ObjectIdInvalidationMap& details); |
| + // Triggers messages to be sent to the Observers to provide them with |
| + // the current state of the logging. |
| void EmitContent(); |
| - InvalidationLogger(); |
| - ~InvalidationLogger(); |
| - |
| - void RegisterForDebug(InvalidationLoggerObserver* debug_observer); |
| - void UnregisterForDebug(InvalidationLoggerObserver* debug_observer); |
| + // Add and remove observers listening for messages. |
|
James Hawkins
2014/02/18 17:19:22
The above need for documentation aside, I don't th
mferreria_g
2014/02/18 18:06:51
The stored registration is something related to an
|
| + void RegisterObserver(InvalidationLoggerObserver* debug_observer); |
| + void UnregisterObserver(InvalidationLoggerObserver* debug_observer); |
| private: |
| + // Send to every Observer a OnStateChange event with the latest state. |
| void EmitState(); |
| + |
| + // Send to every Observer many OnUpdateIds events, each with one registrar |
| + // and every objectId it currently has registered. |
| + void EmitUpdatedIds(); |
| + |
| // The list of every observer currently listening for notifications. |
| ObserverList<InvalidationLoggerObserver> observer_list_; |
| + |
| // The last InvalidatorState updated by the InvalidatorService. |
| syncer::InvalidatorState last_invalidator_state_; |
| + |
| + // The map that contains every object id that is currently registered |
| + // and its owner. |
| + std::map<std::string, syncer::ObjectIdSet> latest_ids_; |
| + |
| + DISALLOW_COPY_AND_ASSIGN(InvalidationLogger); |
| }; |
| } // namespace invalidation |
| + |
| #endif // CHROME_BROWSER_INVALIDATION_INVALIDATION_LOGGER_H_ |