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

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

Issue 10662035: [Sync] Put everything in sync/api into csync namespace (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix comments Created 8 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 <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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after
255 << syncable::ModelTypeToString(dtc->second->type()) 255 << syncable::ModelTypeToString(dtc->second->type())
256 << " in disabled state."; 256 << " in disabled state.";
257 } 257 }
258 } 258 }
259 } 259 }
260 return found_any; 260 return found_any;
261 } 261 }
262 262
263 void ModelAssociationManager::AppendToFailedDatatypesAndLogError( 263 void ModelAssociationManager::AppendToFailedDatatypesAndLogError(
264 DataTypeController::StartResult result, 264 DataTypeController::StartResult result,
265 const SyncError& error) { 265 const csync::SyncError& error) {
266 failed_datatypes_info_.push_back(error); 266 failed_datatypes_info_.push_back(error);
267 LOG(ERROR) << "Failed to associate models for " 267 LOG(ERROR) << "Failed to associate models for "
268 << syncable::ModelTypeToString(error.type()); 268 << syncable::ModelTypeToString(error.type());
269 UMA_HISTOGRAM_ENUMERATION("Sync.ConfigureFailed", 269 UMA_HISTOGRAM_ENUMERATION("Sync.ConfigureFailed",
270 error.type(), 270 error.type(),
271 syncable::MODEL_TYPE_COUNT); 271 syncable::MODEL_TYPE_COUNT);
272 } 272 }
273 273
274 void ModelAssociationManager::TypeStartCallback( 274 void ModelAssociationManager::TypeStartCallback(
275 DataTypeController::StartResult result, 275 DataTypeController::StartResult result,
276 const SyncError& error) { 276 const csync::SyncError& error) {
277 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI)); 277 DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
278 TRACE_EVENT_END0("sync", "ModelAssociation"); 278 TRACE_EVENT_END0("sync", "ModelAssociation");
279 279
280 DVLOG(1) << "ModelAssociationManager: TypeStartCallback"; 280 DVLOG(1) << "ModelAssociationManager: TypeStartCallback";
281 if (state_ == ABORTED) { 281 if (state_ == ABORTED) {
282 // Now that we have finished with the current type we can stop 282 // Now that we have finished with the current type we can stop
283 // if abort was called. 283 // if abort was called.
284 DVLOG(1) << "ModelAssociationManager: Doing an early return" 284 DVLOG(1) << "ModelAssociationManager: Doing an early return"
285 << " because of abort"; 285 << " because of abort";
286 state_ = IDLE; 286 state_ = IDLE;
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 configure_status = DataTypeManager::ABORTED; 323 configure_status = DataTypeManager::ABORTED;
324 break; 324 break;
325 case DataTypeController::UNRECOVERABLE_ERROR: 325 case DataTypeController::UNRECOVERABLE_ERROR:
326 configure_status = DataTypeManager::UNRECOVERABLE_ERROR; 326 configure_status = DataTypeManager::UNRECOVERABLE_ERROR;
327 break; 327 break;
328 default: 328 default:
329 NOTREACHED(); 329 NOTREACHED();
330 break; 330 break;
331 } 331 }
332 332
333 std::list<SyncError> errors; 333 std::list<csync::SyncError> errors;
334 errors.push_back(error); 334 errors.push_back(error);
335 335
336 // Put our state to idle. 336 // Put our state to idle.
337 state_ = IDLE; 337 state_ = IDLE;
338 338
339 DataTypeManager::ConfigureResult configure_result(configure_status, 339 DataTypeManager::ConfigureResult configure_result(configure_status,
340 desired_types_, 340 desired_types_,
341 errors, 341 errors,
342 syncable::ModelTypeSet()); 342 syncable::ModelTypeSet());
343 result_processor_->OnModelAssociationDone(configure_result); 343 result_processor_->OnModelAssociationDone(configure_result);
(...skipping 21 matching lines...) Expand all
365 365
366 DVLOG(1) << "ModelAssociationManager: All types have models loaded." 366 DVLOG(1) << "ModelAssociationManager: All types have models loaded."
367 << "Moving on to StartAssociatingNextType."; 367 << "Moving on to StartAssociatingNextType.";
368 368
369 // If all controllers have their |LoadModels| invoked then pass onto 369 // If all controllers have their |LoadModels| invoked then pass onto
370 // |StartAssociatingNextType|. 370 // |StartAssociatingNextType|.
371 StartAssociatingNextType(); 371 StartAssociatingNextType();
372 } 372 }
373 373
374 void ModelAssociationManager::ModelLoadCallback( 374 void ModelAssociationManager::ModelLoadCallback(
375 syncable::ModelType type, SyncError error) { 375 syncable::ModelType type, csync::SyncError error) {
376 DVLOG(1) << "ModelAssociationManager: ModelLoadCallback for " 376 DVLOG(1) << "ModelAssociationManager: ModelLoadCallback for "
377 << syncable::ModelTypeToString(type); 377 << syncable::ModelTypeToString(type);
378 if (state_ == CONFIGURING) { 378 if (state_ == CONFIGURING) {
379 DVLOG(1) << "ModelAssociationManager: ModelLoadCallback while configuring"; 379 DVLOG(1) << "ModelAssociationManager: ModelLoadCallback while configuring";
380 for (std::vector<DataTypeController*>::iterator it = 380 for (std::vector<DataTypeController*>::iterator it =
381 pending_model_load_.begin(); 381 pending_model_load_.begin();
382 it != pending_model_load_.end(); 382 it != pending_model_load_.end();
383 ++it) { 383 ++it) {
384 if ((*it)->type() == type) { 384 if ((*it)->type() == type) {
385 // Each type is given |kDataTypeLoadWaitTimeInSeconds| time to load 385 // Each type is given |kDataTypeLoadWaitTimeInSeconds| time to load
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after
496 return result; 496 return result;
497 } 497 }
498 498
499 base::OneShotTimer<ModelAssociationManager>* 499 base::OneShotTimer<ModelAssociationManager>*
500 ModelAssociationManager::GetTimerForTesting() { 500 ModelAssociationManager::GetTimerForTesting() {
501 return &timer_; 501 return &timer_;
502 } 502 }
503 503
504 } // namespace browser_sync 504 } // namespace browser_sync
505 505
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