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

Side by Side Diff: ios/net/cookies/cookie_store_ios.h

Issue 2618293003: [ios] Removed CookieStoreIOS::SynchronizationState::SYNCHRONIZING. (Closed)
Patch Set: Created 3 years, 11 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
« no previous file with comments | « no previous file | ios/net/cookies/cookie_store_ios.mm » ('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 #ifndef IOS_NET_COOKIES_COOKIE_STORE_IOS_H_ 5 #ifndef IOS_NET_COOKIES_COOKIE_STORE_IOS_H_
6 #define IOS_NET_COOKIES_COOKIE_STORE_IOS_H_ 6 #define IOS_NET_COOKIES_COOKIE_STORE_IOS_H_
7 7
8 #include <map> 8 #include <map>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 private: 139 private:
140 CookieStoreIOS( 140 CookieStoreIOS(
141 net::CookieMonster::PersistentCookieStore* persistent_store, 141 net::CookieMonster::PersistentCookieStore* persistent_store,
142 NSHTTPCookieStorage* system_store); 142 NSHTTPCookieStorage* system_store);
143 143
144 // For tests. 144 // For tests.
145 friend struct CookieStoreIOSTestTraits; 145 friend struct CookieStoreIOSTestTraits;
146 146
147 enum SynchronizationState { 147 enum SynchronizationState {
148 NOT_SYNCHRONIZED, // Uses CookieMonster as backend. 148 NOT_SYNCHRONIZED, // Uses CookieMonster as backend.
149 SYNCHRONIZING, // Moves from NSHTTPCookieStorage to CookieMonster.
150 SYNCHRONIZED // Uses NSHTTPCookieStorage as backend. 149 SYNCHRONIZED // Uses NSHTTPCookieStorage as backend.
151 }; 150 };
152 151
153 // Cookie fliter for DeleteCookiesWithFilter(). 152 // Cookie fliter for DeleteCookiesWithFilter().
154 // Takes a cookie and a creation time and returns true if the cookie must be 153 // Takes a cookie and a creation time and returns true if the cookie must be
155 // deleted. 154 // deleted.
156 typedef base::Callback<bool(NSHTTPCookie*, base::Time)> CookieFilterFunction; 155 typedef base::Callback<bool(NSHTTPCookie*, base::Time)> CookieFilterFunction;
157 156
158 // Clears the system cookie store. 157 // Clears the system cookie store.
159 void ClearSystemStore(); 158 void ClearSystemStore();
(...skipping 11 matching lines...) Expand all
171 const DeleteCallback& callback); 170 const DeleteCallback& callback);
172 171
173 std::unique_ptr<net::CookieMonster> cookie_monster_; 172 std::unique_ptr<net::CookieMonster> cookie_monster_;
174 base::scoped_nsobject<NSHTTPCookieStorage> system_store_; 173 base::scoped_nsobject<NSHTTPCookieStorage> system_store_;
175 std::unique_ptr<CookieCreationTimeManager> creation_time_manager_; 174 std::unique_ptr<CookieCreationTimeManager> creation_time_manager_;
176 bool metrics_enabled_; 175 bool metrics_enabled_;
177 base::TimeDelta flush_delay_; 176 base::TimeDelta flush_delay_;
178 base::CancelableClosure flush_closure_; 177 base::CancelableClosure flush_closure_;
179 178
180 SynchronizationState synchronization_state_; 179 SynchronizationState synchronization_state_;
181 // Tasks received when SYNCHRONIZING are queued and run when SYNCHRONIZED.
182 std::vector<base::Closure> tasks_pending_synchronization_;
183 180
184 base::ThreadChecker thread_checker_; 181 base::ThreadChecker thread_checker_;
185 182
186 // Cookie notification methods. 183 // Cookie notification methods.
187 // The cookie cache is updated from both the system store and the 184 // The cookie cache is updated from both the system store and the
188 // CookieStoreIOS' own mutators. Changes when the CookieStoreIOS is 185 // CookieStoreIOS' own mutators. Changes when the CookieStoreIOS is
189 // synchronized are signalled by the system store; changes when the 186 // synchronized are signalled by the system store; changes when the
190 // CookieStoreIOS is not synchronized are signalled by the appropriate 187 // CookieStoreIOS is not synchronized are signalled by the appropriate
191 // mutators on CookieStoreIOS. The cookie cache tracks the system store when 188 // mutators on CookieStoreIOS. The cookie cache tracks the system store when
192 // the CookieStoreIOS is synchronized and the CookieStore when the 189 // the CookieStoreIOS is synchronized and the CookieStore when the
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 // deleted from NSHTTPCookieStorage. 242 // deleted from NSHTTPCookieStorage.
246 void DidClearBinaryCookiesFileCookies( 243 void DidClearBinaryCookiesFileCookies(
247 const DeleteCallback& callback, 244 const DeleteCallback& callback,
248 int num_deleted_from_nshttp_cookie_storage); 245 int num_deleted_from_nshttp_cookie_storage);
249 246
250 // Callback-wrapping: 247 // Callback-wrapping:
251 // When this CookieStoreIOS object is synchronized with the system store, 248 // When this CookieStoreIOS object is synchronized with the system store,
252 // OnSystemCookiesChanged is responsible for updating the cookie cache (and 249 // OnSystemCookiesChanged is responsible for updating the cookie cache (and
253 // hence running callbacks). 250 // hence running callbacks).
254 // 251 //
255 // When this CookieStoreIOS object is not synchronized (or is synchronizing), 252 // When this CookieStoreIOS object is not synchronized, the various mutator
256 // the various mutator methods (SetCookieWithOptionsAsync &c) instead store 253 // methods (SetCookieWithOptionsAsync &c) instead store their state in a
257 // their state in a CookieMonster object to be written back when the system 254 // CookieMonster object to be written back when the system store synchronizes.
258 // store synchronizes. To deliver notifications in a timely manner, the 255 // To deliver notifications in a timely manner, the mutators have to ensure
259 // mutators have to ensure that hooks get run, but only after the changes have 256 // that hooks get run, but only after the changes have been written back to
260 // been written back to CookieMonster. To do this, the mutators wrap the 257 // CookieMonster. To do this, the mutators wrap the user-supplied callback in
261 // user-supplied callback in a callback which schedules an asynchronous task 258 // a callback which schedules an asynchronous task to synchronize the cache
262 // to synchronize the cache and run callbacks, then calls through to the 259 // and run callbacks, then calls through to the user-specified callback.
263 // user-specified callback.
264 // 260 //
265 // These three UpdateCachesAfter functions are responsible for scheduling an 261 // These three UpdateCachesAfter functions are responsible for scheduling an
266 // asynchronous cache update (using UpdateCachesFromCookieMonster()) and 262 // asynchronous cache update (using UpdateCachesFromCookieMonster()) and
267 // calling the provided callback. 263 // calling the provided callback.
268 264
269 void UpdateCachesAfterSet(const SetCookiesCallback& callback, bool success); 265 void UpdateCachesAfterSet(const SetCookiesCallback& callback, bool success);
270 void UpdateCachesAfterDelete(const DeleteCallback& callback, int num_deleted); 266 void UpdateCachesAfterDelete(const DeleteCallback& callback, int num_deleted);
271 void UpdateCachesAfterClosure(const base::Closure& callback); 267 void UpdateCachesAfterClosure(const base::Closure& callback);
272 268
273 // Takes an NSArray of NSHTTPCookies as returns a net::CookieList. 269 // Takes an NSArray of NSHTTPCookies as returns a net::CookieList.
(...skipping 21 matching lines...) Expand all
295 hook_map_; 291 hook_map_;
296 292
297 base::WeakPtrFactory<CookieStoreIOS> weak_factory_; 293 base::WeakPtrFactory<CookieStoreIOS> weak_factory_;
298 294
299 DISALLOW_COPY_AND_ASSIGN(CookieStoreIOS); 295 DISALLOW_COPY_AND_ASSIGN(CookieStoreIOS);
300 }; 296 };
301 297
302 } // namespace net 298 } // namespace net
303 299
304 #endif // IOS_NET_COOKIES_COOKIE_STORE_IOS_H_ 300 #endif // IOS_NET_COOKIES_COOKIE_STORE_IOS_H_
OLDNEW
« no previous file with comments | « no previous file | ios/net/cookies/cookie_store_ios.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698