Chromium Code Reviews| Index: chrome/browser/invalidation/invalidation_logger.cc |
| diff --git a/chrome/browser/invalidation/invalidation_logger.cc b/chrome/browser/invalidation/invalidation_logger.cc |
| index 19bdf9d2464409600d139744fe6d3b5bc7336797..6e740241fe513ca20c135afd8d60682c48068c7a 100644 |
| --- a/chrome/browser/invalidation/invalidation_logger.cc |
| +++ b/chrome/browser/invalidation/invalidation_logger.cc |
| @@ -7,10 +7,7 @@ |
| #include "base/memory/scoped_ptr.h" |
| #include "base/values.h" |
| #include "chrome/browser/invalidation/invalidation_logger_observer.h" |
| - |
| -namespace syncer { |
| -class ObjectIdInvalidationMap; |
| -} |
| +#include "sync/notifier/invalidation_handler.h" |
| namespace invalidation { |
| class InvalidationLoggerObserver; |
| @@ -43,9 +40,26 @@ void InvalidationLogger::EmitState() { |
| OnStateChange(last_invalidator_state_)); |
| } |
| -void InvalidationLogger::OnUpdateIds(const base::DictionaryValue& details) { |
| - FOR_EACH_OBSERVER( |
| - InvalidationLoggerObserver, observer_list_, OnUpdateIds(details)); |
| +void InvalidationLogger::OnUpdateIds( |
| + std::map<std::string, syncer::ObjectIdSet> updatedIds) { |
|
Nicolas Zea
2014/02/14 23:23:22
here too
mferreria_g
2014/02/14 23:57:03
Done.
|
| + for (std::map<std::string, syncer::ObjectIdSet>::iterator it = |
| + updatedIds.begin(); |
| + it != updatedIds.end(); |
| + ++it) { |
|
rlarocque
2014/02/15 00:09:39
The indentation here looks strange. Does this nee
mferreria_g
2014/02/15 01:27:39
That's what cl format did. I've managed to get in
|
| + latest_ids_[it->first] = syncer::ObjectIdSet(it->second); |
| + } |
| + EmitUpdatedIds(); |
| +} |
| + |
| +void InvalidationLogger::EmitUpdatedIds() { |
| + for (std::map<std::string, syncer::ObjectIdSet>::iterator it = |
| + latest_ids_.begin(); |
| + it != latest_ids_.end(); |
| + ++it) { |
| + FOR_EACH_OBSERVER(InvalidationLoggerObserver, |
| + observer_list_, |
| + OnUpdateIds(it->first, it->second)); |
| + } |
| } |
| void InvalidationLogger::OnDebugMessage(const base::DictionaryValue& details) { |
| @@ -60,21 +74,16 @@ void InvalidationLogger::OnInvalidation( |
| } |
| void InvalidationLogger::EmitContent() { |
| - // Here we add content to send to the observers not via real time push |
| - // but on explicit request. |
| EmitState(); |
| + EmitUpdatedIds(); |
| } |
| -// Obtain a target object to call whenever we have |
| -// debug messages to display |
| -void InvalidationLogger::RegisterForDebug( |
| +void InvalidationLogger::RegisterObserver( |
| InvalidationLoggerObserver* debug_observer) { |
| observer_list_.AddObserver(debug_observer); |
| } |
| -// Removes the target object to call whenever we have |
| -// debug messages to display |
| -void InvalidationLogger::UnregisterForDebug( |
| +void InvalidationLogger::UnregisterObserver( |
| InvalidationLoggerObserver* debug_observer) { |
| observer_list_.RemoveObserver(debug_observer); |
| } |