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

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

Issue 14113053: chrome: Use base::MessageLoop. (Part 3) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 8 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/session_model_associator.h" 5 #include "chrome/browser/sync/glue/session_model_associator.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <set> 8 #include <set>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 // modified to match. 1127 // modified to match.
1128 bool SessionModelAssociator::ShouldSyncTab(const SyncedTabDelegate& tab) const { 1128 bool SessionModelAssociator::ShouldSyncTab(const SyncedTabDelegate& tab) const {
1129 DCHECK(CalledOnValidThread()); 1129 DCHECK(CalledOnValidThread());
1130 if (!IsValidTab(tab)) 1130 if (!IsValidTab(tab))
1131 return false; 1131 return false;
1132 return TabHasValidEntry(tab); 1132 return TabHasValidEntry(tab);
1133 } 1133 }
1134 1134
1135 void SessionModelAssociator::QuitLoopForSubtleTesting() { 1135 void SessionModelAssociator::QuitLoopForSubtleTesting() {
1136 if (waiting_for_change_) { 1136 if (waiting_for_change_) {
1137 DVLOG(1) << "Quitting MessageLoop for test."; 1137 DVLOG(1) << "Quitting base::MessageLoop for test.";
1138 waiting_for_change_ = false; 1138 waiting_for_change_ = false;
1139 test_weak_factory_.InvalidateWeakPtrs(); 1139 test_weak_factory_.InvalidateWeakPtrs();
1140 MessageLoop::current()->Quit(); 1140 base::MessageLoop::current()->Quit();
1141 } 1141 }
1142 } 1142 }
1143 1143
1144 FaviconCache* SessionModelAssociator::GetFaviconCache() { 1144 FaviconCache* SessionModelAssociator::GetFaviconCache() {
1145 return &favicon_cache_; 1145 return &favicon_cache_;
1146 } 1146 }
1147 1147
1148 void SessionModelAssociator::BlockUntilLocalChangeForTest( 1148 void SessionModelAssociator::BlockUntilLocalChangeForTest(
1149 base::TimeDelta timeout) { 1149 base::TimeDelta timeout) {
1150 if (test_weak_factory_.HasWeakPtrs()) 1150 if (test_weak_factory_.HasWeakPtrs())
1151 return; 1151 return;
1152 waiting_for_change_ = true; 1152 waiting_for_change_ = true;
1153 MessageLoop::current()->PostDelayedTask( 1153 base::MessageLoop::current()->PostDelayedTask(
1154 FROM_HERE, 1154 FROM_HERE,
1155 base::Bind(&SessionModelAssociator::QuitLoopForSubtleTesting, 1155 base::Bind(&SessionModelAssociator::QuitLoopForSubtleTesting,
1156 test_weak_factory_.GetWeakPtr()), 1156 test_weak_factory_.GetWeakPtr()),
1157 timeout); 1157 timeout);
1158 } 1158 }
1159 1159
1160 bool SessionModelAssociator::CryptoReadyIfNecessary() { 1160 bool SessionModelAssociator::CryptoReadyIfNecessary() {
1161 // We only access the cryptographer while holding a transaction. 1161 // We only access the cryptographer while holding a transaction.
1162 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare()); 1162 syncer::ReadTransaction trans(FROM_HERE, sync_service_->GetUserShare());
1163 const syncer::ModelTypeSet encrypted_types = trans.GetEncryptedTypes(); 1163 const syncer::ModelTypeSet encrypted_types = trans.GetEncryptedTypes();
1164 return !encrypted_types.Has(SESSIONS) || 1164 return !encrypted_types.Has(SESSIONS) ||
1165 sync_service_->IsCryptographerReady(&trans); 1165 sync_service_->IsCryptographerReady(&trans);
1166 } 1166 }
1167 1167
1168 } // namespace browser_sync 1168 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698