| 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..4b2b5e58640518c9741a8c20796dbeee86f74637 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,11 +33,17 @@ namespace syncer {
|
|
|
| class InvalidationStateTracker {
|
| public:
|
| - InvalidationStateTracker() {}
|
| + InvalidationStateTracker() : weak_factory_(this) {}
|
| + virtual ~InvalidationStateTracker() {}
|
| +
|
| + base::WeakPtr<InvalidationStateTracker> GetWeakPtr() {
|
| + return weak_factory_.GetWeakPtr();
|
| + }
|
|
|
| // 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.
|
| + // from changes made by this client. Setting the client ID clears all other
|
| + // state.
|
| virtual void SetInvalidatorClientId(const std::string& data) = 0;
|
| virtual std::string GetInvalidatorClientId() const = 0;
|
|
|
| @@ -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
|
|
|