Chromium Code Reviews| Index: sync/tools/sync_listen_notifications.cc |
| diff --git a/sync/tools/sync_listen_notifications.cc b/sync/tools/sync_listen_notifications.cc |
| index 51cef834cb5c0f2b8e773dab322c8870888508be..3d8521cd70df1a72dc98c5b4c7383349abc3d050 100644 |
| --- a/sync/tools/sync_listen_notifications.cc |
| +++ b/sync/tools/sync_listen_notifications.cc |
| @@ -8,8 +8,11 @@ |
| #include "base/at_exit.h" |
| #include "base/base64.h" |
| +#include "base/bind.h" |
| +#include "base/callback.h" |
| #include "base/command_line.h" |
| #include "base/compiler_specific.h" |
| +#include "base/location.h" |
| #include "base/logging.h" |
| #include "base/memory/ref_counted.h" |
| #include "base/memory/scoped_ptr.h" |
| @@ -48,6 +51,12 @@ const char kTrySslTcpFirstSwitch[] = "try-ssltcp-first"; |
| const char kAllowInsecureConnectionSwitch[] = "allow-insecure-connection"; |
| const char kNotificationMethodSwitch[] = "notification-method"; |
| +void GenerateAckHandlesReplyHelper( |
|
akalin
2012/10/19 13:27:16
bind callback / ackhandles directly
dcheng
2012/10/19 19:38:11
Done.
|
| + base::Callback<void(const AckHandleMap&)> callback, |
| + const AckHandleMap& ack_handles) { |
| + callback.Run(ack_handles); |
| +} |
| + |
| // Class to print received notifications events. |
| class NotificationPrinter : public InvalidationHandler { |
| public: |
| @@ -85,8 +94,8 @@ class NullInvalidationStateTracker |
| NullInvalidationStateTracker() {} |
| virtual ~NullInvalidationStateTracker() {} |
| - virtual InvalidationVersionMap GetAllMaxVersions() const OVERRIDE { |
| - return InvalidationVersionMap(); |
| + virtual InvalidationStateMap GetStateMap() const OVERRIDE { |
| + return InvalidationStateMap(); |
| } |
| virtual void SetMaxVersion( |
| @@ -111,6 +120,24 @@ class NullInvalidationStateTracker |
| CHECK(base::Base64Encode(data, &base64_data)); |
| LOG(INFO) << "Setting bootstrap data to: " << base64_data; |
| } |
| + |
| + virtual void GenerateAckHandles( |
| + const ObjectIdSet& ids, |
| + const scoped_refptr<base::TaskRunner>& task_runner, |
| + base::Callback<void(const AckHandleMap&)> callback) OVERRIDE { |
| + AckHandleMap ack_handles; |
| + for (ObjectIdSet::const_iterator it = ids.begin(); it != ids.end(); ++it) { |
| + ack_handles.insert(std::make_pair(*it, AckHandle::InvalidAckHandle())); |
| + } |
| + task_runner->PostTask(FROM_HERE, |
| + base::Bind(&GenerateAckHandlesReplyHelper, |
| + callback, ack_handles)); |
| + } |
| + |
| + virtual void Acknowledge(const invalidation::ObjectId& id, |
| + const AckHandle& ack_handle) OVERRIDE { |
| + LOG(INFO) << "Received ack for " << ObjectIdToString(id); |
| + } |
| }; |
| // Needed to use a real host resolver. |