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

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

Issue 23754021: Invalidation trickles mega-patch (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 3 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
« no previous file with comments | « sync/notifier/ordered_invalidation_list.cc ('k') | sync/notifier/p2p_invalidator.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 invalidator that uses p2p invalidations based on XMPP push 5 // An invalidator that uses p2p invalidations based on XMPP push
6 // notifications. Used only for sync integration tests. 6 // notifications. Used only for sync integration tests.
7 7
8 #ifndef SYNC_NOTIFIER_P2P_INVALIDATOR_H_ 8 #ifndef SYNC_NOTIFIER_P2P_INVALIDATOR_H_
9 #define SYNC_NOTIFIER_P2P_INVALIDATOR_H_ 9 #define SYNC_NOTIFIER_P2P_INVALIDATOR_H_
10 10
11 #include <string> 11 #include <string>
12 12
13 #include "base/compiler_specific.h" 13 #include "base/compiler_specific.h"
14 #include "base/memory/ref_counted.h" 14 #include "base/memory/ref_counted.h"
15 #include "base/memory/scoped_ptr.h" 15 #include "base/memory/scoped_ptr.h"
16 #include "base/memory/weak_ptr.h" 16 #include "base/memory/weak_ptr.h"
17 #include "base/observer_list.h" 17 #include "base/observer_list.h"
18 #include "base/threading/thread_checker.h" 18 #include "base/threading/thread_checker.h"
19 #include "jingle/notifier/base/notifier_options.h" 19 #include "jingle/notifier/base/notifier_options.h"
20 #include "jingle/notifier/listener/push_client.h" 20 #include "jingle/notifier/listener/push_client.h"
21 #include "jingle/notifier/listener/push_client_observer.h" 21 #include "jingle/notifier/listener/push_client_observer.h"
22 #include "sync/base/sync_export.h" 22 #include "sync/base/sync_export.h"
23 #include "sync/internal_api/public/base/model_type.h" 23 #include "sync/internal_api/public/base/model_type.h"
24 #include "sync/notifier/invalidator.h" 24 #include "sync/notifier/invalidator.h"
25 #include "sync/notifier/invalidator_registrar.h" 25 #include "sync/notifier/invalidator_registrar.h"
26 #include "sync/notifier/invalidator_state.h" 26 #include "sync/notifier/invalidator_state.h"
27 #include "sync/notifier/object_id_invalidation_map.h"
27 28
28 namespace notifier { 29 namespace notifier {
29 class PushClient; 30 class PushClient;
30 } // namespace notifier 31 } // namespace notifier
31 32
32 namespace syncer { 33 namespace syncer {
33 34
34 // The channel to use for sync notifications. 35 // The channel to use for sync notifications.
35 SYNC_EXPORT extern const char kSyncP2PNotificationChannel[]; 36 SYNC_EXPORT extern const char kSyncP2PNotificationChannel[];
36 37
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after
98 const std::string& invalidator_client_id, 99 const std::string& invalidator_client_id,
99 P2PNotificationTarget send_notification_target); 100 P2PNotificationTarget send_notification_target);
100 101
101 virtual ~P2PInvalidator(); 102 virtual ~P2PInvalidator();
102 103
103 // Invalidator implementation. 104 // Invalidator implementation.
104 virtual void RegisterHandler(InvalidationHandler* handler) OVERRIDE; 105 virtual void RegisterHandler(InvalidationHandler* handler) OVERRIDE;
105 virtual void UpdateRegisteredIds(InvalidationHandler* handler, 106 virtual void UpdateRegisteredIds(InvalidationHandler* handler,
106 const ObjectIdSet& ids) OVERRIDE; 107 const ObjectIdSet& ids) OVERRIDE;
107 virtual void UnregisterHandler(InvalidationHandler* handler) OVERRIDE; 108 virtual void UnregisterHandler(InvalidationHandler* handler) OVERRIDE;
108 virtual void Acknowledge(const invalidation::ObjectId& id,
109 const AckHandle& ack_handle) OVERRIDE;
110 virtual InvalidatorState GetInvalidatorState() const OVERRIDE; 109 virtual InvalidatorState GetInvalidatorState() const OVERRIDE;
111 virtual void UpdateCredentials( 110 virtual void UpdateCredentials(
112 const std::string& email, const std::string& token) OVERRIDE; 111 const std::string& email, const std::string& token) OVERRIDE;
113 112
114 // PushClientObserver implementation. 113 // PushClientObserver implementation.
115 virtual void OnNotificationsEnabled() OVERRIDE; 114 virtual void OnNotificationsEnabled() OVERRIDE;
116 virtual void OnNotificationsDisabled( 115 virtual void OnNotificationsDisabled(
117 notifier::NotificationsDisabledReason reason) OVERRIDE; 116 notifier::NotificationsDisabledReason reason) OVERRIDE;
118 virtual void OnIncomingNotification( 117 virtual void OnIncomingNotification(
119 const notifier::Notification& notification) OVERRIDE; 118 const notifier::Notification& notification) OVERRIDE;
120 119
121 void SendInvalidation( 120 void SendInvalidation(const ObjectIdSet& ids);
122 const ObjectIdInvalidationMap& invalidation_map);
123 121
124 void SendNotificationDataForTest( 122 void SendNotificationDataForTest(
125 const P2PNotificationData& notification_data); 123 const P2PNotificationData& notification_data);
126 124
127 private: 125 private:
128 void SendNotificationData(const P2PNotificationData& notification_data); 126 void SendNotificationData(const P2PNotificationData& notification_data);
129 127
130 base::ThreadChecker thread_checker_; 128 base::ThreadChecker thread_checker_;
131 129
132 InvalidatorRegistrar registrar_; 130 InvalidatorRegistrar registrar_;
133 131
134 // The push client. 132 // The push client.
135 scoped_ptr<notifier::PushClient> push_client_; 133 scoped_ptr<notifier::PushClient> push_client_;
136 // Our unique ID. 134 // Our unique ID.
137 std::string invalidator_client_id_; 135 std::string invalidator_client_id_;
138 // Whether we have called UpdateCredentials() yet. 136 // Whether we have called UpdateCredentials() yet.
139 bool logged_in_; 137 bool logged_in_;
140 bool notifications_enabled_; 138 bool notifications_enabled_;
141 // Which set of clients should be sent notifications. 139 // Which set of clients should be sent notifications.
142 P2PNotificationTarget send_notification_target_; 140 P2PNotificationTarget send_notification_target_;
143 141
144 DISALLOW_COPY_AND_ASSIGN(P2PInvalidator); 142 DISALLOW_COPY_AND_ASSIGN(P2PInvalidator);
145 }; 143 };
146 144
147 } // namespace syncer 145 } // namespace syncer
148 146
149 #endif // SYNC_NOTIFIER_P2P_INVALIDATOR_H_ 147 #endif // SYNC_NOTIFIER_P2P_INVALIDATOR_H_
OLDNEW
« no previous file with comments | « sync/notifier/ordered_invalidation_list.cc ('k') | sync/notifier/p2p_invalidator.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698