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

Unified Diff: components/invalidation/invalidation.cc

Issue 446223002: Remove WeakHandle from components/invalidation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Hack to fix GN Created 6 years, 4 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
Index: components/invalidation/invalidation.cc
diff --git a/components/invalidation/invalidation.cc b/components/invalidation/invalidation.cc
index 0962c9e9cc2e243fa4877e518af0712413c0fdb5..f6d2c77ea3f1f08054856a2063fd43534627322e 100644
--- a/components/invalidation/invalidation.cc
+++ b/components/invalidation/invalidation.cc
@@ -6,7 +6,9 @@
#include <cstddef>
+#include "base/bind.h"
#include "base/json/json_string_value_serializer.h"
+#include "base/location.h"
#include "base/rand_util.h"
#include "base/strings/string_number_conversions.h"
#include "base/values.h"
@@ -109,23 +111,30 @@ const AckHandle& Invalidation::ack_handle() const {
return ack_handle_;
}
-void Invalidation::set_ack_handler(syncer::WeakHandle<AckHandler> handler) {
+void Invalidation::SetAckHandler(
+ base::WeakPtr<AckHandler> handler,
+ scoped_refptr<base::SequencedTaskRunner> handler_task_runner) {
ack_handler_ = handler;
+ ack_handler_task_runner_ = handler_task_runner;
}
bool Invalidation::SupportsAcknowledgement() const {
- return ack_handler_.IsInitialized();
+ return !!ack_handler_task_runner_;
pavely 2014/08/08 20:08:30 I think previous code will return false if ack_han
rlarocque 2014/08/08 21:19:35 This version is actually more correct. SupportsAc
}
void Invalidation::Acknowledge() const {
if (SupportsAcknowledgement()) {
- ack_handler_.Call(FROM_HERE, &AckHandler::Acknowledge, id_, ack_handle_);
+ ack_handler_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&AckHandler::Acknowledge, ack_handler_, id_, ack_handle_));
}
}
void Invalidation::Drop() {
if (SupportsAcknowledgement()) {
- ack_handler_.Call(FROM_HERE, &AckHandler::Drop, id_, ack_handle_);
+ ack_handler_task_runner_->PostTask(
+ FROM_HERE,
+ base::Bind(&AckHandler::Drop, ack_handler_, id_, ack_handle_));
}
}

Powered by Google App Engine
This is Rietveld 408576698