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

Side by Side Diff: components/invalidation/impl/sync_system_resources.h

Issue 2469433003: Reland of move stl_util's deletion function use from components/invalidation/. (Closed)
Patch Set: Created 4 years, 1 month 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
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 // Simple system resources class that uses the current thread for scheduling. 5 // Simple system resources class that uses the current thread for scheduling.
6 // Assumes the current thread is already running tasks. 6 // Assumes the current thread is already running tasks.
7 7
8 #ifndef COMPONENTS_INVALIDATION_IMPL_SYNC_SYSTEM_RESOURCES_H_ 8 #ifndef COMPONENTS_INVALIDATION_IMPL_SYNC_SYSTEM_RESOURCES_H_
9 #define COMPONENTS_INVALIDATION_IMPL_SYNC_SYSTEM_RESOURCES_H_ 9 #define COMPONENTS_INVALIDATION_IMPL_SYNC_SYSTEM_RESOURCES_H_
10 10
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
63 63
64 invalidation::Time GetCurrentTime() const override; 64 invalidation::Time GetCurrentTime() const override;
65 65
66 void SetSystemResources(invalidation::SystemResources* resources) override; 66 void SetSystemResources(invalidation::SystemResources* resources) override;
67 67
68 private: 68 private:
69 // Runs the task, deletes it, and removes it from |posted_tasks_|. 69 // Runs the task, deletes it, and removes it from |posted_tasks_|.
70 void RunPostedTask(invalidation::Closure* task); 70 void RunPostedTask(invalidation::Closure* task);
71 71
72 // Holds all posted tasks that have not yet been run. 72 // Holds all posted tasks that have not yet been run.
73 std::set<invalidation::Closure*> posted_tasks_; 73 std::set<std::unique_ptr<invalidation::Closure>> posted_tasks_;
74 74
75 scoped_refptr<base::SingleThreadTaskRunner> const created_on_task_runner_; 75 scoped_refptr<base::SingleThreadTaskRunner> const created_on_task_runner_;
76 bool is_started_; 76 bool is_started_;
77 bool is_stopped_; 77 bool is_stopped_;
78 78
79 base::WeakPtrFactory<SyncInvalidationScheduler> weak_factory_; 79 base::WeakPtrFactory<SyncInvalidationScheduler> weak_factory_;
80 }; 80 };
81 81
82 // SyncNetworkChannel implements common tasks needed to interact with 82 // SyncNetworkChannel implements common tasks needed to interact with
83 // invalidation library: 83 // invalidation library:
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 // NotifyChannelStateChange. If communication doesn't work and it is possible 152 // NotifyChannelStateChange. If communication doesn't work and it is possible
153 // that invalidations from server will not reach this client then channel 153 // that invalidations from server will not reach this client then channel
154 // should call this function with TRANSIENT_INVALIDATION_ERROR. 154 // should call this function with TRANSIENT_INVALIDATION_ERROR.
155 void NotifyChannelStateChange(InvalidatorState invalidator_state); 155 void NotifyChannelStateChange(InvalidatorState invalidator_state);
156 156
157 // Subclass should call DeliverIncomingMessage for message to reach 157 // Subclass should call DeliverIncomingMessage for message to reach
158 // invalidations library. 158 // invalidations library.
159 bool DeliverIncomingMessage(const std::string& message); 159 bool DeliverIncomingMessage(const std::string& message);
160 160
161 private: 161 private:
162 typedef std::vector<invalidation::NetworkStatusCallback*>
163 NetworkStatusReceiverList;
164
165 // Callbacks into invalidation library 162 // Callbacks into invalidation library
166 std::unique_ptr<invalidation::MessageCallback> incoming_receiver_; 163 std::unique_ptr<invalidation::MessageCallback> incoming_receiver_;
167 NetworkStatusReceiverList network_status_receivers_; 164 std::vector<std::unique_ptr<invalidation::NetworkStatusCallback>>
165 network_status_receivers_;
168 166
169 // Last network status for new network status receivers. 167 // Last network status for new network status receivers.
170 bool last_network_status_; 168 bool last_network_status_;
171 169
172 int received_messages_count_; 170 int received_messages_count_;
173 171
174 base::ObserverList<Observer> observers_; 172 base::ObserverList<Observer> observers_;
175 }; 173 };
176 174
177 class SyncStorage : public invalidation::Storage { 175 class SyncStorage : public invalidation::Storage {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
240 std::unique_ptr<SyncInvalidationScheduler> internal_scheduler_; 238 std::unique_ptr<SyncInvalidationScheduler> internal_scheduler_;
241 std::unique_ptr<SyncInvalidationScheduler> listener_scheduler_; 239 std::unique_ptr<SyncInvalidationScheduler> listener_scheduler_;
242 std::unique_ptr<SyncStorage> storage_; 240 std::unique_ptr<SyncStorage> storage_;
243 // sync_network_channel_ is owned by SyncInvalidationListener. 241 // sync_network_channel_ is owned by SyncInvalidationListener.
244 SyncNetworkChannel* sync_network_channel_; 242 SyncNetworkChannel* sync_network_channel_;
245 }; 243 };
246 244
247 } // namespace syncer 245 } // namespace syncer
248 246
249 #endif // COMPONENTS_INVALIDATION_IMPL_SYNC_SYSTEM_RESOURCES_H_ 247 #endif // COMPONENTS_INVALIDATION_IMPL_SYNC_SYSTEM_RESOURCES_H_
OLDNEW
« no previous file with comments | « components/invalidation/impl/registration_manager.cc ('k') | components/invalidation/impl/sync_system_resources.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698