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

Side by Side Diff: chrome/browser/sync/glue/sync_backend_host_core.h

Issue 551843003: Persist Directory to disk when the app is backgrounded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address nits. Created 6 years, 2 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_CORE_H_ 5 #ifndef CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_CORE_H_
6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_CORE_H_ 6 #define CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_CORE_H_
7 7
8 #include "base/memory/ref_counted.h" 8 #include "base/memory/ref_counted.h"
9 9
10 #include "base/timer/timer.h" 10 #include "base/timer/timer.h"
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
232 syncer::CancelationSignal* GetRequestContextCancelationSignal() { 232 syncer::CancelationSignal* GetRequestContextCancelationSignal() {
233 return &release_request_context_signal_; 233 return &release_request_context_signal_;
234 } 234 }
235 235
236 void GetAllNodesForTypes( 236 void GetAllNodesForTypes(
237 syncer::ModelTypeSet types, 237 syncer::ModelTypeSet types,
238 scoped_refptr<base::SequencedTaskRunner> task_runner, 238 scoped_refptr<base::SequencedTaskRunner> task_runner,
239 base::Callback<void(const std::vector<syncer::ModelType>& type, 239 base::Callback<void(const std::vector<syncer::ModelType>& type,
240 ScopedVector<base::ListValue>) > callback); 240 ScopedVector<base::ListValue>) > callback);
241 241
242 // Tell the sync manager to persist its state by writing to disk.
243 // Called on the sync thread, both by a timer and, on Android, when the
244 // application is backgrounded.
245 void SaveChanges();
246
242 private: 247 private:
243 friend class base::RefCountedThreadSafe<SyncBackendHostCore>; 248 friend class base::RefCountedThreadSafe<SyncBackendHostCore>;
244 friend class SyncBackendHostForProfileSyncTest; 249 friend class SyncBackendHostForProfileSyncTest;
245 250
246 virtual ~SyncBackendHostCore(); 251 virtual ~SyncBackendHostCore();
247 252
248 // Invoked when initialization of syncapi is complete and we can start 253 // Invoked when initialization of syncapi is complete and we can start
249 // our timer. 254 // our timer.
250 // This must be called from the thread on which SaveChanges is intended to 255 // This must be called from the thread on which SaveChanges is intended to
251 // be run on; the host's |registrar_->sync_thread()|. 256 // be run on; the host's |registrar_->sync_thread()|.
252 void StartSavingChanges(); 257 void StartSavingChanges();
253 258
254 // Invoked periodically to tell the syncapi to persist its state
255 // by writing to disk.
256 // This is called from the thread we were created on (which is sync thread),
257 // using a repeating timer that is kicked off as soon as the SyncManager
258 // tells us it completed initialization.
259 void SaveChanges();
260
261 // Name used for debugging. 259 // Name used for debugging.
262 const std::string name_; 260 const std::string name_;
263 261
264 // Path of the folder that stores the sync data files. 262 // Path of the folder that stores the sync data files.
265 const base::FilePath sync_data_folder_path_; 263 const base::FilePath sync_data_folder_path_;
266 264
267 // Our parent SyncBackendHost. 265 // Our parent SyncBackendHost.
268 syncer::WeakHandle<SyncBackendHostImpl> host_; 266 syncer::WeakHandle<SyncBackendHostImpl> host_;
269 267
270 // The loop where all the sync backend operations happen. 268 // The loop where all the sync backend operations happen.
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 bool forward_type_info_; 307 bool forward_type_info_;
310 308
311 base::WeakPtrFactory<SyncBackendHostCore> weak_ptr_factory_; 309 base::WeakPtrFactory<SyncBackendHostCore> weak_ptr_factory_;
312 310
313 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostCore); 311 DISALLOW_COPY_AND_ASSIGN(SyncBackendHostCore);
314 }; 312 };
315 313
316 } // namespace browser_sync 314 } // namespace browser_sync
317 315
318 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_CORE_H_ 316 #endif // CHROME_BROWSER_SYNC_GLUE_SYNC_BACKEND_HOST_CORE_H_
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host.h ('k') | chrome/browser/sync/glue/sync_backend_host_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698