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

Side by Side Diff: components/browser_sync/browser/profile_sync_service.cc

Issue 1487873003: Convert enable_pre_sync_backup flag to new flags system. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix Created 5 years 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 | « components/browser_sync.gypi ('k') | components/components_tests.gyp » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 #include "components/browser_sync/browser/profile_sync_service.h" 5 #include "components/browser_sync/browser/profile_sync_service.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <map> 8 #include <map>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 #include "components/sync_driver/change_processor.h" 42 #include "components/sync_driver/change_processor.h"
43 #include "components/sync_driver/data_type_controller.h" 43 #include "components/sync_driver/data_type_controller.h"
44 #include "components/sync_driver/device_info.h" 44 #include "components/sync_driver/device_info.h"
45 #include "components/sync_driver/glue/chrome_report_unrecoverable_error.h" 45 #include "components/sync_driver/glue/chrome_report_unrecoverable_error.h"
46 #include "components/sync_driver/glue/sync_backend_host.h" 46 #include "components/sync_driver/glue/sync_backend_host.h"
47 #include "components/sync_driver/glue/sync_backend_host_impl.h" 47 #include "components/sync_driver/glue/sync_backend_host_impl.h"
48 #include "components/sync_driver/pref_names.h" 48 #include "components/sync_driver/pref_names.h"
49 #include "components/sync_driver/signin_manager_wrapper.h" 49 #include "components/sync_driver/signin_manager_wrapper.h"
50 #include "components/sync_driver/sync_api_component_factory.h" 50 #include "components/sync_driver/sync_api_component_factory.h"
51 #include "components/sync_driver/sync_client.h" 51 #include "components/sync_driver/sync_client.h"
52 #include "components/sync_driver/sync_driver_features.h"
52 #include "components/sync_driver/sync_driver_switches.h" 53 #include "components/sync_driver/sync_driver_switches.h"
53 #include "components/sync_driver/sync_error_controller.h" 54 #include "components/sync_driver/sync_error_controller.h"
54 #include "components/sync_driver/sync_stopped_reporter.h" 55 #include "components/sync_driver/sync_stopped_reporter.h"
55 #include "components/sync_driver/sync_type_preference_provider.h" 56 #include "components/sync_driver/sync_type_preference_provider.h"
56 #include "components/sync_driver/sync_util.h" 57 #include "components/sync_driver/sync_util.h"
57 #include "components/sync_driver/system_encryptor.h" 58 #include "components/sync_driver/system_encryptor.h"
58 #include "components/sync_driver/user_selectable_sync_type.h" 59 #include "components/sync_driver/user_selectable_sync_type.h"
59 #include "components/sync_sessions/favicon_cache.h" 60 #include "components/sync_sessions/favicon_cache.h"
60 #include "components/sync_sessions/session_data_type_controller.h" 61 #include "components/sync_sessions/session_data_type_controller.h"
61 #include "components/sync_sessions/sessions_sync_manager.h" 62 #include "components/sync_sessions/sessions_sync_manager.h"
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 // Backup is needed if user's not signed in or signed in but previous 332 // Backup is needed if user's not signed in or signed in but previous
332 // backup didn't finish, i.e. backend didn't switch from backup to sync. 333 // backup didn't finish, i.e. backend didn't switch from backup to sync.
333 need_backup_ = !IsSignedIn() || sync_prefs_.GetFirstSyncTime().is_null(); 334 need_backup_ = !IsSignedIn() || sync_prefs_.GetFirstSyncTime().is_null();
334 335
335 // Try to resume rollback if it didn't finish in last session. 336 // Try to resume rollback if it didn't finish in last session.
336 running_rollback = backup_rollback_controller_->StartRollback(); 337 running_rollback = backup_rollback_controller_->StartRollback();
337 } else { 338 } else {
338 need_backup_ = false; 339 need_backup_ = false;
339 } 340 }
340 341
341 #if defined(ENABLE_PRE_SYNC_BACKUP) 342 #if BUILDFLAG(ENABLE_PRE_SYNC_BACKUP)
342 if (!running_rollback && !IsSignedIn()) { 343 if (!running_rollback && !IsSignedIn()) {
343 CleanUpBackup(); 344 CleanUpBackup();
344 } 345 }
345 #else 346 #else
346 DCHECK(!running_rollback); 347 DCHECK(!running_rollback);
347 #endif 348 #endif
348 349
349 memory_pressure_listener_.reset(new base::MemoryPressureListener(base::Bind( 350 memory_pressure_listener_.reset(new base::MemoryPressureListener(base::Bind(
350 &ProfileSyncService::OnMemoryPressure, weak_factory_.GetWeakPtr()))); 351 &ProfileSyncService::OnMemoryPressure, weak_factory_.GetWeakPtr())));
351 startup_controller_->Reset(GetRegisteredDataTypes()); 352 startup_controller_->Reset(GetRegisteredDataTypes());
(...skipping 2207 matching lines...) Expand 10 before | Expand all | Expand 10 after
2559 if (first_sync_time.is_null()) 2560 if (first_sync_time.is_null())
2560 return; 2561 return;
2561 2562
2562 sync_client_->GetClearBrowsingDataCallback().Run(first_sync_time, 2563 sync_client_->GetClearBrowsingDataCallback().Run(first_sync_time,
2563 base::Time::Now()); 2564 base::Time::Now());
2564 } 2565 }
2565 2566
2566 void ProfileSyncService::CheckSyncBackupIfNeeded() { 2567 void ProfileSyncService::CheckSyncBackupIfNeeded() {
2567 DCHECK_EQ(backend_mode_, SYNC); 2568 DCHECK_EQ(backend_mode_, SYNC);
2568 2569
2569 #if defined(ENABLE_PRE_SYNC_BACKUP) 2570 #if BUILDFLAG(ENABLE_PRE_SYNC_BACKUP)
2570 const base::Time last_synced_time = sync_prefs_.GetLastSyncedTime(); 2571 const base::Time last_synced_time = sync_prefs_.GetLastSyncedTime();
2571 // Check backup once a day. 2572 // Check backup once a day.
2572 if (!last_backup_time_ && 2573 if (!last_backup_time_ &&
2573 (last_synced_time.is_null() || 2574 (last_synced_time.is_null() ||
2574 base::Time::Now() - last_synced_time >= 2575 base::Time::Now() - last_synced_time >=
2575 base::TimeDelta::FromDays(1))) { 2576 base::TimeDelta::FromDays(1))) {
2576 // If sync thread is set, need to serialize check on sync thread after 2577 // If sync thread is set, need to serialize check on sync thread after
2577 // closing backup DB. 2578 // closing backup DB.
2578 if (sync_thread_) { 2579 if (sync_thread_) {
2579 sync_thread_->task_runner()->PostTask( 2580 sync_thread_->task_runner()->PostTask(
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after
2703 } 2704 }
2704 2705
2705 std::string ProfileSyncService::unrecoverable_error_message() const { 2706 std::string ProfileSyncService::unrecoverable_error_message() const {
2706 return unrecoverable_error_message_; 2707 return unrecoverable_error_message_;
2707 } 2708 }
2708 2709
2709 tracked_objects::Location ProfileSyncService::unrecoverable_error_location() 2710 tracked_objects::Location ProfileSyncService::unrecoverable_error_location()
2710 const { 2711 const {
2711 return unrecoverable_error_location_; 2712 return unrecoverable_error_location_;
2712 } 2713 }
OLDNEW
« no previous file with comments | « components/browser_sync.gypi ('k') | components/components_tests.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698