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

Unified Diff: sync/tools/sync_listen_notifications.cc

Issue 10911084: Implement Invalidator::Acknowledge (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Restart test + more cleanup Created 8 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 side-by-side diff with in-line comments
Download patch
« sync/notifier/sync_invalidation_listener.cc ('K') | « sync/sync.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« sync/notifier/sync_invalidation_listener.cc ('K') | « sync/sync.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698