| OLD | NEW |
| 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 "components/sync/driver/glue/sync_backend_host_core.h" | 5 #include "components/sync/driver/glue/sync_backend_host_core.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/files/file_util.h" | 10 #include "base/files/file_util.h" |
| (...skipping 637 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 SLOG(DFATAL) << "Could not delete the Sync Data folder."; | 648 SLOG(DFATAL) << "Could not delete the Sync Data folder."; |
| 649 } | 649 } |
| 650 } | 650 } |
| 651 | 651 |
| 652 void SyncBackendHostCore::StartSavingChanges() { | 652 void SyncBackendHostCore::StartSavingChanges() { |
| 653 // We may already be shut down. | 653 // We may already be shut down. |
| 654 if (!sync_loop_) | 654 if (!sync_loop_) |
| 655 return; | 655 return; |
| 656 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 656 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); |
| 657 DCHECK(!save_changes_timer_.get()); | 657 DCHECK(!save_changes_timer_.get()); |
| 658 save_changes_timer_.reset(new base::RepeatingTimer()); | 658 save_changes_timer_ = base::MakeUnique<base::RepeatingTimer>(); |
| 659 save_changes_timer_->Start( | 659 save_changes_timer_->Start( |
| 660 FROM_HERE, base::TimeDelta::FromSeconds(kSaveChangesIntervalSeconds), | 660 FROM_HERE, base::TimeDelta::FromSeconds(kSaveChangesIntervalSeconds), |
| 661 this, &SyncBackendHostCore::SaveChanges); | 661 this, &SyncBackendHostCore::SaveChanges); |
| 662 } | 662 } |
| 663 | 663 |
| 664 void SyncBackendHostCore::SaveChanges() { | 664 void SyncBackendHostCore::SaveChanges() { |
| 665 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 665 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); |
| 666 sync_manager_->SaveChanges(); | 666 sync_manager_->SaveChanges(); |
| 667 } | 667 } |
| 668 | 668 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 682 } | 682 } |
| 683 | 683 |
| 684 void SyncBackendHostCore::ClearServerDataDone( | 684 void SyncBackendHostCore::ClearServerDataDone( |
| 685 const base::Closure& frontend_callback) { | 685 const base::Closure& frontend_callback) { |
| 686 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); | 686 DCHECK(sync_loop_->task_runner()->BelongsToCurrentThread()); |
| 687 host_.Call(FROM_HERE, &SyncBackendHostImpl::ClearServerDataDoneOnFrontendLoop, | 687 host_.Call(FROM_HERE, &SyncBackendHostImpl::ClearServerDataDoneOnFrontendLoop, |
| 688 frontend_callback); | 688 frontend_callback); |
| 689 } | 689 } |
| 690 | 690 |
| 691 } // namespace syncer | 691 } // namespace syncer |
| OLD | NEW |