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

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

Issue 10698014: [Sync] Rename csync namespace to syncer (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address comments Created 8 years, 5 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 <algorithm> 5 #include <algorithm>
6 #include <functional> 6 #include <functional>
7 7
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 9
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 246 matching lines...) Expand 10 before | Expand all | Expand 10 after
257 << syncable::ModelTypeToString(dtc->second->type()) 257 << syncable::ModelTypeToString(dtc->second->type())
258 << " in disabled state."; 258 << " in disabled state.";
259 } 259 }
260 } 260 }
261 } 261 }
262 return found_any; 262 return found_any;
263 } 263 }
264 264
265 void ModelAssociationManager::AppendToFailedDatatypesAndLogError( 265 void ModelAssociationManager::AppendToFailedDatatypesAndLogError(
266 DataTypeController::StartResult result, 266 DataTypeController::StartResult result,
267 const csync::SyncError& error) { 267 const syncer::SyncError& error) {
268 failed_datatypes_info_.push_back(error); 268 failed_datatypes_info_.push_back(error);
269 LOG(ERROR) << "Failed to associate models for " 269 LOG(ERROR) << "Failed to associate models for "
270 << syncable::ModelTypeToString(error.type()); 270 << syncable::ModelTypeToString(error.type());
271 UMA_HISTOGRAM_ENUMERATION("Sync.ConfigureFailed", 271 UMA_HISTOGRAM_ENUMERATION("Sync.ConfigureFailed",
272 error.type(), 272 error.type(),
273 syncable::MODEL_TYPE_COUNT); 273 syncable::MODEL_TYPE_COUNT);
274 } 274 }
275 275
276 void ModelAssociationManager::TypeStartCallback( 276 void ModelAssociationManager::TypeStartCallback(
277 DataTypeController::StartResult result, 277 DataTypeController::StartResult result,
278 const csync::SyncError& error) { 278 const syncer::SyncError& error) {
279 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 279 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
280 TRACE_EVENT_END0("sync", "ModelAssociation"); 280 TRACE_EVENT_END0("sync", "ModelAssociation");
281 281
282 DVLOG(1) << "ModelAssociationManager: TypeStartCallback"; 282 DVLOG(1) << "ModelAssociationManager: TypeStartCallback";
283 if (state_ == ABORTED) { 283 if (state_ == ABORTED) {
284 // Now that we have finished with the current type we can stop 284 // Now that we have finished with the current type we can stop
285 // if abort was called. 285 // if abort was called.
286 DVLOG(1) << "ModelAssociationManager: Doing an early return" 286 DVLOG(1) << "ModelAssociationManager: Doing an early return"
287 << " because of abort"; 287 << " because of abort";
288 state_ = IDLE; 288 state_ = IDLE;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 configure_status = DataTypeManager::ABORTED; 325 configure_status = DataTypeManager::ABORTED;
326 break; 326 break;
327 case DataTypeController::UNRECOVERABLE_ERROR: 327 case DataTypeController::UNRECOVERABLE_ERROR:
328 configure_status = DataTypeManager::UNRECOVERABLE_ERROR; 328 configure_status = DataTypeManager::UNRECOVERABLE_ERROR;
329 break; 329 break;
330 default: 330 default:
331 NOTREACHED(); 331 NOTREACHED();
332 break; 332 break;
333 } 333 }
334 334
335 std::list<csync::SyncError> errors; 335 std::list<syncer::SyncError> errors;
336 errors.push_back(error); 336 errors.push_back(error);
337 337
338 // Put our state to idle. 338 // Put our state to idle.
339 state_ = IDLE; 339 state_ = IDLE;
340 340
341 DataTypeManager::ConfigureResult configure_result(configure_status, 341 DataTypeManager::ConfigureResult configure_result(configure_status,
342 desired_types_, 342 desired_types_,
343 errors, 343 errors,
344 syncable::ModelTypeSet()); 344 syncable::ModelTypeSet());
345 result_processor_->OnModelAssociationDone(configure_result); 345 result_processor_->OnModelAssociationDone(configure_result);
(...skipping 21 matching lines...) Expand all
367 367
368 DVLOG(1) << "ModelAssociationManager: All types have models loaded." 368 DVLOG(1) << "ModelAssociationManager: All types have models loaded."
369 << "Moving on to StartAssociatingNextType."; 369 << "Moving on to StartAssociatingNextType.";
370 370
371 // If all controllers have their |LoadModels| invoked then pass onto 371 // If all controllers have their |LoadModels| invoked then pass onto
372 // |StartAssociatingNextType|. 372 // |StartAssociatingNextType|.
373 StartAssociatingNextType(); 373 StartAssociatingNextType();
374 } 374 }
375 375
376 void ModelAssociationManager::ModelLoadCallback( 376 void ModelAssociationManager::ModelLoadCallback(
377 syncable::ModelType type, csync::SyncError error) { 377 syncable::ModelType type, syncer::SyncError error) {
378 DVLOG(1) << "ModelAssociationManager: ModelLoadCallback for " 378 DVLOG(1) << "ModelAssociationManager: ModelLoadCallback for "
379 << syncable::ModelTypeToString(type); 379 << syncable::ModelTypeToString(type);
380 if (state_ == CONFIGURING) { 380 if (state_ == CONFIGURING) {
381 DVLOG(1) << "ModelAssociationManager: ModelLoadCallback while configuring"; 381 DVLOG(1) << "ModelAssociationManager: ModelLoadCallback while configuring";
382 for (std::vector<DataTypeController*>::iterator it = 382 for (std::vector<DataTypeController*>::iterator it =
383 pending_model_load_.begin(); 383 pending_model_load_.begin();
384 it != pending_model_load_.end(); 384 it != pending_model_load_.end();
385 ++it) { 385 ++it) {
386 if ((*it)->type() == type) { 386 if ((*it)->type() == type) {
387 // Each type is given |kDataTypeLoadWaitTimeInSeconds| time to load 387 // Each type is given |kDataTypeLoadWaitTimeInSeconds| time to load
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
502 } 502 }
503 return result; 503 return result;
504 } 504 }
505 505
506 base::OneShotTimer<ModelAssociationManager>* 506 base::OneShotTimer<ModelAssociationManager>*
507 ModelAssociationManager::GetTimerForTesting() { 507 ModelAssociationManager::GetTimerForTesting() {
508 return &timer_; 508 return &timer_;
509 } 509 }
510 510
511 } // namespace browser_sync 511 } // namespace browser_sync
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/model_association_manager.h ('k') | chrome/browser/sync/glue/model_association_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698