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

Unified Diff: sync/notifier/invalidation_state_tracker.h

Issue 221963003: Reduce dependency of TiclInvalidationService on Profile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comments addressed. Created 6 years, 8 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
« no previous file with comments | « sync/notifier/fake_invalidation_state_tracker.cc ('k') | sync/tools/null_invalidation_state_tracker.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/notifier/invalidation_state_tracker.h
diff --git a/sync/notifier/invalidation_state_tracker.h b/sync/notifier/invalidation_state_tracker.h
index 81a07eae5c51555792a4b42c7c9d04272cdb3aff..0eff6eee33b6d76c9f7a17b8ec203562647a405e 100644
--- a/sync/notifier/invalidation_state_tracker.h
+++ b/sync/notifier/invalidation_state_tracker.h
@@ -18,6 +18,7 @@
#include "base/basictypes.h"
#include "base/callback_forward.h"
#include "base/memory/ref_counted.h"
+#include "base/memory/weak_ptr.h"
#include "google/cacheinvalidation/include/types.h"
#include "sync/base/sync_export.h"
#include "sync/internal_api/public/base/invalidation.h"
@@ -32,12 +33,18 @@ namespace syncer {
class InvalidationStateTracker {
public:
- InvalidationStateTracker() {}
+ InvalidationStateTracker() : weak_factory_(this) {}
+ virtual ~InvalidationStateTracker() {}
+
+ base::WeakPtr<InvalidationStateTracker> GetWeakPtr() {
+ return weak_factory_.GetWeakPtr();
dcheng 2014/04/14 21:39:59 I don't think we should be publicly exposing weak
bartfab (slow) 2014/04/14 22:06:01 Actually, based on discussions we had on chromium-
+ }
// The per-client unique ID used to register the invalidation client with the
// server. This is used to squelch invalidation notifications that originate
- // from changes made by this client.
- virtual void SetInvalidatorClientId(const std::string& data) = 0;
+ // from changes made by this client. Setting the client ID clears all other
+ // state.
+ virtual void ClearAndSetNewClientId(const std::string& data) = 0;
virtual std::string GetInvalidatorClientId() const = 0;
// Used by invalidation::InvalidationClient for persistence. |data| is an
@@ -56,8 +63,8 @@ class InvalidationStateTracker {
// Erases invalidation versions, client ID, and state stored on disk.
virtual void Clear() = 0;
- protected:
- virtual ~InvalidationStateTracker() {}
+ private:
+ base::WeakPtrFactory<InvalidationStateTracker> weak_factory_;
};
} // namespace syncer
« no previous file with comments | « sync/notifier/fake_invalidation_state_tracker.cc ('k') | sync/tools/null_invalidation_state_tracker.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698