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

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

Issue 1355063004: Template methods on Timer classes instead of the classes themselves. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: timer: fixcaller Created 5 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 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/bind.h" 7 #include "base/bind.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/metrics/histogram.h" 10 #include "base/metrics/histogram.h"
(...skipping 742 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 FROM_HERE, 753 FROM_HERE,
754 base::Bind(callback, types_vector, base::Passed(&node_lists))); 754 base::Bind(callback, types_vector, base::Passed(&node_lists)));
755 } 755 }
756 756
757 void SyncBackendHostCore::StartSavingChanges() { 757 void SyncBackendHostCore::StartSavingChanges() {
758 // We may already be shut down. 758 // We may already be shut down.
759 if (!sync_loop_) 759 if (!sync_loop_)
760 return; 760 return;
761 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); 761 DCHECK_EQ(base::MessageLoop::current(), sync_loop_);
762 DCHECK(!save_changes_timer_.get()); 762 DCHECK(!save_changes_timer_.get());
763 save_changes_timer_.reset(new base::RepeatingTimer<SyncBackendHostCore>()); 763 save_changes_timer_.reset(new base::RepeatingTimer());
764 save_changes_timer_->Start(FROM_HERE, 764 save_changes_timer_->Start(FROM_HERE,
765 base::TimeDelta::FromSeconds(kSaveChangesIntervalSeconds), 765 base::TimeDelta::FromSeconds(kSaveChangesIntervalSeconds),
766 this, &SyncBackendHostCore::SaveChanges); 766 this, &SyncBackendHostCore::SaveChanges);
767 } 767 }
768 768
769 void SyncBackendHostCore::SaveChanges() { 769 void SyncBackendHostCore::SaveChanges() {
770 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); 770 DCHECK_EQ(base::MessageLoop::current(), sync_loop_);
771 sync_manager_->SaveChanges(); 771 sync_manager_->SaveChanges();
772 } 772 }
773 773
774 void SyncBackendHostCore::DoClearServerData( 774 void SyncBackendHostCore::DoClearServerData(
775 const syncer::SyncManager::ClearServerDataCallback& frontend_callback) { 775 const syncer::SyncManager::ClearServerDataCallback& frontend_callback) {
776 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); 776 DCHECK_EQ(base::MessageLoop::current(), sync_loop_);
777 const syncer::SyncManager::ClearServerDataCallback callback = 777 const syncer::SyncManager::ClearServerDataCallback callback =
778 base::Bind(&SyncBackendHostCore::ClearServerDataDone, 778 base::Bind(&SyncBackendHostCore::ClearServerDataDone,
779 weak_ptr_factory_.GetWeakPtr(), frontend_callback); 779 weak_ptr_factory_.GetWeakPtr(), frontend_callback);
780 sync_manager_->ClearServerData(callback); 780 sync_manager_->ClearServerData(callback);
781 } 781 }
782 782
783 void SyncBackendHostCore::ClearServerDataDone( 783 void SyncBackendHostCore::ClearServerDataDone(
784 const base::Closure& frontend_callback) { 784 const base::Closure& frontend_callback) {
785 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); 785 DCHECK_EQ(base::MessageLoop::current(), sync_loop_);
786 host_.Call(FROM_HERE, &SyncBackendHostImpl::ClearServerDataDoneOnFrontendLoop, 786 host_.Call(FROM_HERE, &SyncBackendHostImpl::ClearServerDataDoneOnFrontendLoop,
787 frontend_callback); 787 frontend_callback);
788 } 788 }
789 789
790 790
791 } // namespace browser_sync 791 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/sync_backend_host_core.h ('k') | chrome/browser/sync/profile_sync_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698