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

Side by Side Diff: sync/notifier/non_blocking_invalidation_notifier.h

Issue 10451060: sync: migrate invalidation state from syncable::Directory to InvalidationStorage (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: include order Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 // 4 //
5 // An implementation of SyncNotifier that wraps InvalidationNotifier 5 // An implementation of SyncNotifier that wraps InvalidationNotifier
6 // on its own thread. 6 // on its own thread.
7 7
8 #ifndef SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_ 8 #ifndef SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_
9 #define SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_ 9 #define SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_
10 #pragma once 10 #pragma once
(...skipping 19 matching lines...) Expand all
30 30
31 class NonBlockingInvalidationNotifier 31 class NonBlockingInvalidationNotifier
32 : public SyncNotifier, 32 : public SyncNotifier,
33 // SyncNotifierObserver to "observe" our Core via WeakHandle. 33 // SyncNotifierObserver to "observe" our Core via WeakHandle.
34 public SyncNotifierObserver { 34 public SyncNotifierObserver {
35 public: 35 public:
36 // |invalidation_state_tracker| must be initialized. 36 // |invalidation_state_tracker| must be initialized.
37 NonBlockingInvalidationNotifier( 37 NonBlockingInvalidationNotifier(
38 const notifier::NotifierOptions& notifier_options, 38 const notifier::NotifierOptions& notifier_options,
39 const InvalidationVersionMap& initial_max_invalidation_versions, 39 const InvalidationVersionMap& initial_max_invalidation_versions,
40 const std::string& initial_invalidation_state,
40 const browser_sync::WeakHandle<InvalidationStateTracker>& 41 const browser_sync::WeakHandle<InvalidationStateTracker>&
41 invalidation_state_tracker, 42 invalidation_state_tracker,
42 const std::string& client_info); 43 const std::string& client_info);
43 44
44 virtual ~NonBlockingInvalidationNotifier(); 45 virtual ~NonBlockingInvalidationNotifier();
45 46
46 // SyncNotifier implementation. 47 // SyncNotifier implementation.
47 virtual void AddObserver(SyncNotifierObserver* observer) OVERRIDE; 48 virtual void AddObserver(SyncNotifierObserver* observer) OVERRIDE;
48 virtual void RemoveObserver(SyncNotifierObserver* observer) OVERRIDE; 49 virtual void RemoveObserver(SyncNotifierObserver* observer) OVERRIDE;
49 virtual void SetUniqueId(const std::string& unique_id) OVERRIDE; 50 virtual void SetUniqueId(const std::string& unique_id) OVERRIDE;
50 virtual void SetState(const std::string& state) OVERRIDE; 51 virtual void SetStateDeprecated(const std::string& state) OVERRIDE;
51 virtual void UpdateCredentials( 52 virtual void UpdateCredentials(
52 const std::string& email, const std::string& token) OVERRIDE; 53 const std::string& email, const std::string& token) OVERRIDE;
53 virtual void UpdateEnabledTypes( 54 virtual void UpdateEnabledTypes(
54 syncable::ModelTypeSet enabled_types) OVERRIDE; 55 syncable::ModelTypeSet enabled_types) OVERRIDE;
55 virtual void SendNotification( 56 virtual void SendNotification(
56 syncable::ModelTypeSet changed_types) OVERRIDE; 57 syncable::ModelTypeSet changed_types) OVERRIDE;
57 58
58 // SyncNotifierObserver implementation. 59 // SyncNotifierObserver implementation.
59 virtual void OnIncomingNotification( 60 virtual void OnIncomingNotification(
60 const syncable::ModelTypePayloadMap& type_payloads, 61 const syncable::ModelTypePayloadMap& type_payloads,
61 IncomingNotificationSource source) OVERRIDE; 62 IncomingNotificationSource source) OVERRIDE;
62 virtual void OnNotificationStateChange(bool notifications_enabled) OVERRIDE; 63 virtual void OnNotificationStateChange(bool notifications_enabled) OVERRIDE;
63 virtual void StoreState(const std::string& state) OVERRIDE;
64 64
65 private: 65 private:
66 class Core; 66 class Core;
67 67
68 base::WeakPtrFactory<NonBlockingInvalidationNotifier> weak_ptr_factory_; 68 base::WeakPtrFactory<NonBlockingInvalidationNotifier> weak_ptr_factory_;
69 69
70 // Our observers (which must live on the parent thread). 70 // Our observers (which must live on the parent thread).
71 ObserverList<SyncNotifierObserver> observers_; 71 ObserverList<SyncNotifierObserver> observers_;
72 72
73 // The real guts of NonBlockingInvalidationNotifier, which allows 73 // The real guts of NonBlockingInvalidationNotifier, which allows
74 // this class to live completely on the parent thread. 74 // this class to live completely on the parent thread.
75 scoped_refptr<Core> core_; 75 scoped_refptr<Core> core_;
76 scoped_refptr<base::MessageLoopProxy> parent_message_loop_proxy_; 76 scoped_refptr<base::MessageLoopProxy> parent_message_loop_proxy_;
77 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_; 77 scoped_refptr<base::MessageLoopProxy> io_message_loop_proxy_;
78 78
79 DISALLOW_COPY_AND_ASSIGN(NonBlockingInvalidationNotifier); 79 DISALLOW_COPY_AND_ASSIGN(NonBlockingInvalidationNotifier);
80 }; 80 };
81 81
82 } // namespace sync_notifier 82 } // namespace sync_notifier
83 83
84 #endif // SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_ 84 #endif // SYNC_NOTIFIER_NON_BLOCKING_INVALIDATION_NOTIFIER_H_
OLDNEW
« no previous file with comments | « sync/notifier/mock_sync_notifier_observer.h ('k') | sync/notifier/non_blocking_invalidation_notifier.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698