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

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

Issue 16290004: Update chrome/ to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: 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 (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 "chrome/browser/sync/glue/model_association_manager.h" 5 #include "chrome/browser/sync/glue/model_association_manager.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <functional> 8 #include <functional>
9 9
10 #include "base/debug/trace_event.h" 10 #include "base/debug/trace_event.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 GetControllersNeedingStart(&needs_start_); 173 GetControllersNeedingStart(&needs_start_);
174 // Sort these according to kStartOrder. 174 // Sort these according to kStartOrder.
175 std::sort(needs_start_.begin(), 175 std::sort(needs_start_.begin(),
176 needs_start_.end(), 176 needs_start_.end(),
177 SortComparator(&start_order_)); 177 SortComparator(&start_order_));
178 178
179 // Add any data type controllers into that needs_stop_ list that are 179 // Add any data type controllers into that needs_stop_ list that are
180 // currently MODEL_STARTING, ASSOCIATING, RUNNING or DISABLED. 180 // currently MODEL_STARTING, ASSOCIATING, RUNNING or DISABLED.
181 for (DataTypeController::TypeMap::const_iterator it = controllers_->begin(); 181 for (DataTypeController::TypeMap::const_iterator it = controllers_->begin();
182 it != controllers_->end(); ++it) { 182 it != controllers_->end(); ++it) {
183 DataTypeController* dtc = (*it).second; 183 DataTypeController* dtc = (*it).second.get();
184 if (!desired_types.Has(dtc->type()) && ( 184 if (!desired_types.Has(dtc->type()) &&
185 dtc->state() == DataTypeController::MODEL_STARTING || 185 (dtc->state() == DataTypeController::MODEL_STARTING ||
186 dtc->state() == DataTypeController::ASSOCIATING || 186 dtc->state() == DataTypeController::ASSOCIATING ||
187 dtc->state() == DataTypeController::RUNNING || 187 dtc->state() == DataTypeController::RUNNING ||
188 dtc->state() == DataTypeController::DISABLED)) { 188 dtc->state() == DataTypeController::DISABLED)) {
189 needs_stop_.push_back(dtc); 189 needs_stop_.push_back(dtc);
190 DVLOG(1) << "ModelTypeToString: Will stop " << dtc->name(); 190 DVLOG(1) << "ModelTypeToString: Will stop " << dtc->name();
191 } 191 }
192 } 192 }
193 // Sort these according to kStartOrder. 193 // Sort these according to kStartOrder.
194 std::sort(needs_stop_.begin(), 194 std::sort(needs_stop_.begin(),
195 needs_stop_.end(), 195 needs_stop_.end(),
196 SortComparator(&start_order_)); 196 SortComparator(&start_order_));
197 } 197 }
198 198
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after
258 // We are in the midle of model association. We need to inform the caller 258 // We are in the midle of model association. We need to inform the caller
259 // so the caller can send notificationst to PSS layer. 259 // so the caller can send notificationst to PSS layer.
260 need_to_call_model_association_done = true; 260 need_to_call_model_association_done = true;
261 } 261 }
262 262
263 // Now continue stopping any types that have already started. 263 // Now continue stopping any types that have already started.
264 DCHECK(state_ == IDLE || 264 DCHECK(state_ == IDLE ||
265 state_ == INITIALIZED_TO_CONFIGURE); 265 state_ == INITIALIZED_TO_CONFIGURE);
266 for (DataTypeController::TypeMap::const_iterator it = controllers_->begin(); 266 for (DataTypeController::TypeMap::const_iterator it = controllers_->begin();
267 it != controllers_->end(); ++it) { 267 it != controllers_->end(); ++it) {
268 DataTypeController* dtc = (*it).second; 268 DataTypeController* dtc = (*it).second.get();
269 if (dtc->state() != DataTypeController::NOT_RUNNING && 269 if (dtc->state() != DataTypeController::NOT_RUNNING &&
270 dtc->state() != DataTypeController::STOPPING) { 270 dtc->state() != DataTypeController::STOPPING) {
271 dtc->Stop(); 271 dtc->Stop();
272 DVLOG(1) << "ModelAssociationManager: Stopped " << dtc->name(); 272 DVLOG(1) << "ModelAssociationManager: Stopped " << dtc->name();
273 } 273 }
274 } 274 }
275 275
276 if (need_to_call_model_association_done) { 276 if (need_to_call_model_association_done) {
277 DVLOG(1) << "ModelAssociationManager: Calling OnModelAssociationDone"; 277 DVLOG(1) << "ModelAssociationManager: Calling OnModelAssociationDone";
278 DataTypeManager::ConfigureResult result(DataTypeManager::ABORTED, 278 DataTypeManager::ConfigureResult result(DataTypeManager::ABORTED,
(...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after
580 } 580 }
581 return result; 581 return result;
582 } 582 }
583 583
584 base::OneShotTimer<ModelAssociationManager>* 584 base::OneShotTimer<ModelAssociationManager>*
585 ModelAssociationManager::GetTimerForTesting() { 585 ModelAssociationManager::GetTimerForTesting() {
586 return &timer_; 586 return &timer_;
587 } 587 }
588 588
589 } // namespace browser_sync 589 } // namespace browser_sync
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698