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

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

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase again Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 "chrome/browser/sync/glue/bookmark_model_associator.h" 5 #include "chrome/browser/sync/glue/bookmark_model_associator.h"
6 6
7 #include <stack> 7 #include <stack>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 627 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 journals_to_purge.insert(bk_delete_journals[i].id); 638 journals_to_purge.insert(bk_delete_journals[i].id);
639 syncer::DeleteJournal::PurgeDeleteJournals(trans, journals_to_purge); 639 syncer::DeleteJournal::PurgeDeleteJournals(trans, journals_to_purge);
640 640
641 return num_bookmark_deleted; 641 return num_bookmark_deleted;
642 } 642 }
643 643
644 void BookmarkModelAssociator::PostPersistAssociationsTask() { 644 void BookmarkModelAssociator::PostPersistAssociationsTask() {
645 // No need to post a task if a task is already pending. 645 // No need to post a task if a task is already pending.
646 if (weak_factory_.HasWeakPtrs()) 646 if (weak_factory_.HasWeakPtrs())
647 return; 647 return;
648 MessageLoop::current()->PostTask( 648 base::MessageLoop::current()->PostTask(
649 FROM_HERE, 649 FROM_HERE,
650 base::Bind( 650 base::Bind(
651 &BookmarkModelAssociator::PersistAssociations, 651 &BookmarkModelAssociator::PersistAssociations,
652 weak_factory_.GetWeakPtr())); 652 weak_factory_.GetWeakPtr()));
653 } 653 }
654 654
655 void BookmarkModelAssociator::PersistAssociations() { 655 void BookmarkModelAssociator::PersistAssociations() {
656 // If there are no dirty associations we have nothing to do. We handle this 656 // If there are no dirty associations we have nothing to do. We handle this
657 // explicity instead of letting the for loop do it to avoid creating a write 657 // explicity instead of letting the for loop do it to avoid creating a write
658 // transaction in this case. 658 // transaction in this case.
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
712 ModelTypeToHistogramInt(syncer::BOOKMARKS), 712 ModelTypeToHistogramInt(syncer::BOOKMARKS),
713 syncer::MODEL_TYPE_COUNT); 713 syncer::MODEL_TYPE_COUNT);
714 // Clear version on bookmark model so that we only report error once. 714 // Clear version on bookmark model so that we only report error once.
715 bookmark_model_->DeleteNodeMetaInfo(bookmark_model_->root_node(), 715 bookmark_model_->DeleteNodeMetaInfo(bookmark_model_->root_node(),
716 kBookmarkTransactionVersionKey); 716 kBookmarkTransactionVersionKey);
717 } 717 }
718 } 718 }
719 } 719 }
720 720
721 } // namespace browser_sync 721 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698