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

Unified Diff: chrome/browser/sync/glue/sync_backend_host_impl.cc

Issue 551843003: Persist Directory to disk when the app is backgrounded. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Use SyncBackendHost to get to the sync thread. Created 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/sync/glue/sync_backend_host_impl.cc
diff --git a/chrome/browser/sync/glue/sync_backend_host_impl.cc b/chrome/browser/sync/glue/sync_backend_host_impl.cc
index 6f4c7e37ddf33d03afb5f97c658ece1ab55ab2c4..e414b37ebcf2eed9019a1a8961b42de04547c4b2 100644
--- a/chrome/browser/sync/glue/sync_backend_host_impl.cc
+++ b/chrome/browser/sync/glue/sync_backend_host_impl.cc
@@ -33,6 +33,7 @@
#include "sync/internal_api/public/sync_manager_factory.h"
#include "sync/internal_api/public/util/experiments.h"
#include "sync/internal_api/public/util/sync_string_conversions.h"
+#include "sync/syncable/directory.h"
// Helper macros to log with the syncer thread name; useful when there
// are multiple syncers involved.
@@ -520,6 +521,18 @@ SyncedDeviceTracker* SyncBackendHostImpl::GetSyncedDeviceTracker() const {
return core_->synced_device_tracker();
}
+void FlushDirectoryWrapper(syncer::syncable::Directory* directory) {
maniscalco 2014/09/10 17:49:03 What's the motivation for using this free function
maxbogue 2014/09/10 20:11:01 Directory::SaveChanges returns a bool, so it canno
maniscalco 2014/09/10 20:19:25 Ah, check out IgnoreResult: https://code.google.c
maxbogue 2014/09/12 16:45:38 Done.
+ directory->SaveChanges();
+}
+
+void SyncBackendHostImpl::FlushDirectory() const {
nyquist 2014/09/10 17:43:09 Does this require the sync engine to be initialize
maxbogue 2014/09/10 20:11:01 I kind of assumed that directory being NULL meant
+ syncer::syncable::Directory* directory = GetUserShare()->directory.get();
+ if (directory != nullptr) {
nyquist 2014/09/10 17:43:09 != NULL ?
maxbogue 2014/09/10 20:11:01 Done.
+ registrar_->sync_thread()->message_loop()->PostTask(FROM_HERE,
+ base::Bind(&FlushDirectoryWrapper, directory));
maniscalco 2014/09/10 20:19:25 As we talked about in person over lunch, it seems
maxbogue 2014/09/12 16:45:38 Routed through SyncBackendHostCore to try to solve
+ }
+}
+
void SyncBackendHostImpl::RequestBufferedProtocolEventsAndEnableForwarding() {
registrar_->sync_thread()->message_loop()->PostTask(
FROM_HERE,

Powered by Google App Engine
This is Rietveld 408576698