OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/profile_sync_service.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <cstddef> | 8 #include <cstddef> |
9 #include <map> | 9 #include <map> |
10 #include <set> | 10 #include <set> |
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
548 << " -- ProfileSyncService unusable: " << message; | 548 << " -- ProfileSyncService unusable: " << message; |
549 | 549 |
550 // Shut all data types down. | 550 // Shut all data types down. |
551 MessageLoop::current()->PostTask(FROM_HERE, | 551 MessageLoop::current()->PostTask(FROM_HERE, |
552 scoped_runnable_method_factory_.NewRunnableMethod( | 552 scoped_runnable_method_factory_.NewRunnableMethod( |
553 &ProfileSyncService::Shutdown, true)); | 553 &ProfileSyncService::Shutdown, true)); |
554 } | 554 } |
555 | 555 |
556 void ProfileSyncService::OnBackendInitialized( | 556 void ProfileSyncService::OnBackendInitialized( |
557 const WeakHandle<JsBackend>& js_backend, bool success) { | 557 const WeakHandle<JsBackend>& js_backend, bool success) { |
| 558 if (HasSyncSetupCompleted()) { |
| 559 UMA_HISTOGRAM_BOOLEAN("Sync.FirstBackendInitializeSuccess", success); |
| 560 } else { |
| 561 UMA_HISTOGRAM_BOOLEAN("Sync.RestoreBackendInitializeSuccess", success); |
| 562 } |
| 563 |
558 if (!success) { | 564 if (!success) { |
559 // If backend initialization failed, abort. We only want to blow away | 565 // Something went unexpectedly wrong. Play it safe: nuke our current state |
560 // state (DBs, etc) if this was a first-time scenario that failed. | 566 // and prepare ourselves to try again later. |
561 wizard_.Step(SyncSetupWizard::FATAL_ERROR); | 567 DisableForUser(); |
562 Shutdown(!HasSyncSetupCompleted()); | |
563 return; | 568 return; |
564 } | 569 } |
565 | 570 |
566 backend_initialized_ = true; | 571 backend_initialized_ = true; |
567 | 572 |
568 sync_js_controller_.AttachJsBackend(js_backend); | 573 sync_js_controller_.AttachJsBackend(js_backend); |
569 | 574 |
570 // The very first time the backend initializes is effectively the first time | 575 // The very first time the backend initializes is effectively the first time |
571 // we can say we successfully "synced". last_synced_time_ will only be null | 576 // we can say we successfully "synced". last_synced_time_ will only be null |
572 // in this case, because the pref wasn't restored on StartUp. | 577 // in this case, because the pref wasn't restored on StartUp. |
(...skipping 971 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1544 << "Unrecoverable error."; | 1549 << "Unrecoverable error."; |
1545 } else { | 1550 } else { |
1546 VLOG(0) << "ConfigureDataTypeManager not invoked because backend is not " | 1551 VLOG(0) << "ConfigureDataTypeManager not invoked because backend is not " |
1547 << "initialized"; | 1552 << "initialized"; |
1548 } | 1553 } |
1549 } | 1554 } |
1550 | 1555 |
1551 const FailedDatatypesHandler& ProfileSyncService::failed_datatypes_handler() { | 1556 const FailedDatatypesHandler& ProfileSyncService::failed_datatypes_handler() { |
1552 return failed_datatypes_handler_; | 1557 return failed_datatypes_handler_; |
1553 } | 1558 } |
OLD | NEW |