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

Side by Side Diff: components/invalidation/sync_invalidation_listener.h

Issue 446223002: Remove WeakHandle from components/invalidation (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Review fixes 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 // A simple wrapper around invalidation::InvalidationClient that 5 // A simple wrapper around invalidation::InvalidationClient that
6 // handles all the startup/shutdown details and hookups. 6 // handles all the startup/shutdown details and hookups.
7 7
8 #ifndef COMPONENTS_INVALIDATION_SYNC_INVALIDATION_LISTENER_H_ 8 #ifndef COMPONENTS_INVALIDATION_SYNC_INVALIDATION_LISTENER_H_
9 #define COMPONENTS_INVALIDATION_SYNC_INVALIDATION_LISTENER_H_ 9 #define COMPONENTS_INVALIDATION_SYNC_INVALIDATION_LISTENER_H_
10 10
11 #include <string> 11 #include <string>
12 12
13 #include "base/basictypes.h" 13 #include "base/basictypes.h"
14 #include "base/callback_forward.h" 14 #include "base/callback_forward.h"
15 #include "base/compiler_specific.h" 15 #include "base/compiler_specific.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/memory/weak_ptr.h" 17 #include "base/memory/weak_ptr.h"
18 #include "base/threading/non_thread_safe.h" 18 #include "base/threading/non_thread_safe.h"
19 #include "components/invalidation/ack_handler.h" 19 #include "components/invalidation/ack_handler.h"
20 #include "components/invalidation/invalidation_export.h" 20 #include "components/invalidation/invalidation_export.h"
21 #include "components/invalidation/invalidation_state_tracker.h" 21 #include "components/invalidation/invalidation_state_tracker.h"
22 #include "components/invalidation/invalidator_state.h" 22 #include "components/invalidation/invalidator_state.h"
23 #include "components/invalidation/state_writer.h" 23 #include "components/invalidation/state_writer.h"
24 #include "components/invalidation/sync_system_resources.h" 24 #include "components/invalidation/sync_system_resources.h"
25 #include "components/invalidation/unacked_invalidation_set.h" 25 #include "components/invalidation/unacked_invalidation_set.h"
26 #include "google/cacheinvalidation/include/invalidation-listener.h" 26 #include "google/cacheinvalidation/include/invalidation-listener.h"
27 #include "sync/internal_api/public/util/weak_handle.h"
28 27
29 namespace buzz { 28 namespace buzz {
30 class XmppTaskParentInterface; 29 class XmppTaskParentInterface;
31 } // namespace buzz 30 } // namespace buzz
32 31
33 namespace notifier { 32 namespace notifier {
34 class PushClient; 33 class PushClient;
35 } // namespace notifier 34 } // namespace notifier
36 35
37 namespace syncer { 36 namespace syncer {
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 scoped_ptr<SyncNetworkChannel> network_channel); 68 scoped_ptr<SyncNetworkChannel> network_channel);
70 69
71 // Calls Stop(). 70 // Calls Stop().
72 virtual ~SyncInvalidationListener(); 71 virtual ~SyncInvalidationListener();
73 72
74 // Does not take ownership of |delegate| or |state_writer|. 73 // Does not take ownership of |delegate| or |state_writer|.
75 // |invalidation_state_tracker| must be initialized. 74 // |invalidation_state_tracker| must be initialized.
76 void Start( 75 void Start(
77 const CreateInvalidationClientCallback& 76 const CreateInvalidationClientCallback&
78 create_invalidation_client_callback, 77 create_invalidation_client_callback,
79 const std::string& client_id, const std::string& client_info, 78 const std::string& client_id,
79 const std::string& client_info,
80 const std::string& invalidation_bootstrap_data, 80 const std::string& invalidation_bootstrap_data,
81 const UnackedInvalidationsMap& initial_object_states, 81 const UnackedInvalidationsMap& initial_object_states,
82 const WeakHandle<InvalidationStateTracker>& invalidation_state_tracker, 82 const base::WeakPtr<InvalidationStateTracker>& invalidation_state_tracker,
83 const scoped_refptr<base::SequencedTaskRunner>&
84 invalidation_state_tracker_task_runner,
83 Delegate* delegate); 85 Delegate* delegate);
84 86
85 void UpdateCredentials(const std::string& email, const std::string& token); 87 void UpdateCredentials(const std::string& email, const std::string& token);
86 88
87 // Update the set of object IDs that we're interested in getting 89 // Update the set of object IDs that we're interested in getting
88 // notifications for. May be called at any time. 90 // notifications for. May be called at any time.
89 void UpdateRegisteredIds(const ObjectIdSet& ids); 91 void UpdateRegisteredIds(const ObjectIdSet& ids);
90 92
91 // invalidation::InvalidationListener implementation. 93 // invalidation::InvalidationListener implementation.
92 virtual void Ready( 94 virtual void Ready(
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
163 // be safely on disk by the end of the call, but it should ensure that the 165 // be safely on disk by the end of the call, but it should ensure that the
164 // data makes it to disk eventually. 166 // data makes it to disk eventually.
165 void SaveInvalidations(const ObjectIdInvalidationMap& to_save); 167 void SaveInvalidations(const ObjectIdInvalidationMap& to_save);
166 168
167 // Emits previously saved invalidations to their registered observers. 169 // Emits previously saved invalidations to their registered observers.
168 void EmitSavedInvalidations(const ObjectIdInvalidationMap& to_emit); 170 void EmitSavedInvalidations(const ObjectIdInvalidationMap& to_emit);
169 171
170 // Generate a Dictionary with all the debugging information. 172 // Generate a Dictionary with all the debugging information.
171 scoped_ptr<base::DictionaryValue> CollectDebugData() const; 173 scoped_ptr<base::DictionaryValue> CollectDebugData() const;
172 174
173 WeakHandle<AckHandler> GetThisAsAckHandler(); 175 base::WeakPtr<AckHandler> AsWeakPtr();
174 176
175 scoped_ptr<SyncNetworkChannel> sync_network_channel_; 177 scoped_ptr<SyncNetworkChannel> sync_network_channel_;
176 SyncSystemResources sync_system_resources_; 178 SyncSystemResources sync_system_resources_;
177 UnackedInvalidationsMap unacked_invalidations_map_; 179 UnackedInvalidationsMap unacked_invalidations_map_;
178 WeakHandle<InvalidationStateTracker> invalidation_state_tracker_; 180 base::WeakPtr<InvalidationStateTracker> invalidation_state_tracker_;
181 scoped_refptr<base::SequencedTaskRunner>
182 invalidation_state_tracker_task_runner_;
179 Delegate* delegate_; 183 Delegate* delegate_;
180 scoped_ptr<invalidation::InvalidationClient> invalidation_client_; 184 scoped_ptr<invalidation::InvalidationClient> invalidation_client_;
181 scoped_ptr<RegistrationManager> registration_manager_; 185 scoped_ptr<RegistrationManager> registration_manager_;
182 // Stored to pass to |registration_manager_| on start. 186 // Stored to pass to |registration_manager_| on start.
183 ObjectIdSet registered_ids_; 187 ObjectIdSet registered_ids_;
184 188
185 // The states of the ticl and the push client. 189 // The states of the ticl and the push client.
186 InvalidatorState ticl_state_; 190 InvalidatorState ticl_state_;
187 InvalidatorState push_client_state_; 191 InvalidatorState push_client_state_;
188 192
189 base::WeakPtrFactory<SyncInvalidationListener> weak_ptr_factory_; 193 base::WeakPtrFactory<SyncInvalidationListener> weak_ptr_factory_;
190 194
191 DISALLOW_COPY_AND_ASSIGN(SyncInvalidationListener); 195 DISALLOW_COPY_AND_ASSIGN(SyncInvalidationListener);
192 }; 196 };
193 197
194 } // namespace syncer 198 } // namespace syncer
195 199
196 #endif // COMPONENTS_INVALIDATION_SYNC_INVALIDATION_LISTENER_H_ 200 #endif // COMPONENTS_INVALIDATION_SYNC_INVALIDATION_LISTENER_H_
OLDNEW
« no previous file with comments | « components/invalidation/non_blocking_invalidator.cc ('k') | components/invalidation/sync_invalidation_listener.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698