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

Side by Side Diff: chrome/browser/sync/glue/sync_backend_host_core.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: Add a test and use SyncBackendHostCore::SaveChanges(). 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 #include "chrome/browser/sync/glue/sync_backend_host_core.h" 5 #include "chrome/browser/sync/glue/sync_backend_host_core.h"
6 6
7 #include "base/files/file_util.h" 7 #include "base/files/file_util.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "chrome/browser/sync/glue/invalidation_adapter.h" 9 #include "chrome/browser/sync/glue/invalidation_adapter.h"
10 #include "chrome/browser/sync/glue/local_device_info_provider_impl.h" 10 #include "chrome/browser/sync/glue/local_device_info_provider_impl.h"
11 #include "chrome/browser/sync/glue/sync_backend_registrar.h" 11 #include "chrome/browser/sync/glue/sync_backend_registrar.h"
12 #include "chrome/common/chrome_version_info.h" 12 #include "chrome/common/chrome_version_info.h"
13 #include "components/invalidation/invalidation_util.h" 13 #include "components/invalidation/invalidation_util.h"
14 #include "components/invalidation/object_id_invalidation_map.h" 14 #include "components/invalidation/object_id_invalidation_map.h"
15 #include "sync/internal_api/public/events/protocol_event.h" 15 #include "sync/internal_api/public/events/protocol_event.h"
16 #include "sync/internal_api/public/http_post_provider_factory.h" 16 #include "sync/internal_api/public/http_post_provider_factory.h"
17 #include "sync/internal_api/public/internal_components_factory.h" 17 #include "sync/internal_api/public/internal_components_factory.h"
18 #include "sync/internal_api/public/sessions/commit_counters.h" 18 #include "sync/internal_api/public/sessions/commit_counters.h"
19 #include "sync/internal_api/public/sessions/status_counters.h" 19 #include "sync/internal_api/public/sessions/status_counters.h"
20 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" 20 #include "sync/internal_api/public/sessions/sync_session_snapshot.h"
21 #include "sync/internal_api/public/sessions/update_counters.h" 21 #include "sync/internal_api/public/sessions/update_counters.h"
22 #include "sync/internal_api/public/sync_context_proxy.h" 22 #include "sync/internal_api/public/sync_context_proxy.h"
23 #include "sync/internal_api/public/sync_manager.h" 23 #include "sync/internal_api/public/sync_manager.h"
24 #include "sync/internal_api/public/sync_manager_factory.h" 24 #include "sync/internal_api/public/sync_manager_factory.h"
25 #include "sync/internal_api/public/user_share.h"
Nicolas Zea 2014/09/30 21:20:22 Is this needed?
maxbogue 2014/09/30 21:59:34 Nope; good catch.
25 #include "url/gurl.h" 26 #include "url/gurl.h"
26 27
27 // Helper macros to log with the syncer thread name; useful when there 28 // Helper macros to log with the syncer thread name; useful when there
28 // are multiple syncers involved. 29 // are multiple syncers involved.
29 30
30 #define SLOG(severity) LOG(severity) << name_ << ": " 31 #define SLOG(severity) LOG(severity) << name_ << ": "
31 32
32 #define SDVLOG(verbose_level) DVLOG(verbose_level) << name_ << ": " 33 #define SDVLOG(verbose_level) DVLOG(verbose_level) << name_ << ": "
33 34
34 static const int kSaveChangesIntervalSeconds = 10; 35 static const int kSaveChangesIntervalSeconds = 10;
(...skipping 693 matching lines...) Expand 10 before | Expand all | Expand 10 after
728 base::TimeDelta::FromSeconds(kSaveChangesIntervalSeconds), 729 base::TimeDelta::FromSeconds(kSaveChangesIntervalSeconds),
729 this, &SyncBackendHostCore::SaveChanges); 730 this, &SyncBackendHostCore::SaveChanges);
730 } 731 }
731 732
732 void SyncBackendHostCore::SaveChanges() { 733 void SyncBackendHostCore::SaveChanges() {
733 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); 734 DCHECK_EQ(base::MessageLoop::current(), sync_loop_);
734 sync_manager_->SaveChanges(); 735 sync_manager_->SaveChanges();
735 } 736 }
736 737
737 } // namespace browser_sync 738 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698