OLD | NEW |
---|---|
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/profile_sync_service.h" | 5 #include "chrome/browser/sync/profile_sync_service.h" |
6 | 6 |
7 #include <cstddef> | 7 #include <cstddef> |
8 #include <map> | 8 #include <map> |
9 #include <set> | 9 #include <set> |
10 #include <utility> | 10 #include <utility> |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
378 // In platforms with auto start we would just wait for the | 378 // In platforms with auto start we would just wait for the |
379 // configure to finish. In other platforms we would throw | 379 // configure to finish. In other platforms we would throw |
380 // an unrecoverable error. The reason we do this is so that | 380 // an unrecoverable error. The reason we do this is so that |
381 // the login dialog would show an error and the user would have | 381 // the login dialog would show an error and the user would have |
382 // to relogin. | 382 // to relogin. |
383 // Also if backend has been initialized(the user is authenticated | 383 // Also if backend has been initialized(the user is authenticated |
384 // and nigori is downloaded) we would simply wait rather than going into | 384 // and nigori is downloaded) we would simply wait rather than going into |
385 // unrecoverable error, even if the platform has auto start disabled. | 385 // unrecoverable error, even if the platform has auto start disabled. |
386 // Note: In those scenarios the UI does not wait for the configuration | 386 // Note: In those scenarios the UI does not wait for the configuration |
387 // to finish. | 387 // to finish. |
388 // | |
389 // TODO(rlarocque): Consider making this UnrecoverableError less special. | |
390 // This exception made sense at the time it was implemented, but our new | |
391 // directory corruption recovery mechanism makes it obsolete. By the time we | |
392 // get here, we will have already tried and failed to delete the directory. | |
393 // Whether or not we try to delete it again after the error is thrown likely | |
394 // won't make a difference. | |
tim (not reviewing)
2012/08/01 21:31:59
Hmm... I don't follow. I thought this was called
rlarocque
2012/08/01 21:53:50
Woops, that was a dumb mistake. This comment belo
| |
388 if (!auto_start_enabled_ && !backend_initialized_) { | 395 if (!auto_start_enabled_ && !backend_initialized_) { |
389 OnInternalUnrecoverableError(FROM_HERE, | 396 OnInternalUnrecoverableError(FROM_HERE, |
390 "Configure failed to download.", | 397 "Configure failed to download.", |
391 true, | 398 true, |
392 ERROR_REASON_CONFIGURATION_RETRY); | 399 ERROR_REASON_CONFIGURATION_RETRY); |
393 } | 400 } |
394 | 401 |
395 NotifyObservers(); | 402 NotifyObservers(); |
396 } | 403 } |
397 | 404 |
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
633 | 640 |
634 MessageLoop::current()->PostTask(FROM_HERE, | 641 MessageLoop::current()->PostTask(FROM_HERE, |
635 base::Bind(&ProfileSyncService::ReconfigureDatatypeManager, | 642 base::Bind(&ProfileSyncService::ReconfigureDatatypeManager, |
636 weak_factory_.GetWeakPtr())); | 643 weak_factory_.GetWeakPtr())); |
637 } | 644 } |
638 | 645 |
639 void ProfileSyncService::OnBackendInitialized( | 646 void ProfileSyncService::OnBackendInitialized( |
640 const syncer::WeakHandle<syncer::JsBackend>& js_backend, bool success) { | 647 const syncer::WeakHandle<syncer::JsBackend>& js_backend, bool success) { |
641 is_first_time_sync_configure_ = !HasSyncSetupCompleted(); | 648 is_first_time_sync_configure_ = !HasSyncSetupCompleted(); |
642 | 649 |
643 if (is_first_time_sync_configure_) { | 650 if (is_first_time_sync_configure_) { |
rlarocque
2012/08/01 00:25:10
I'm considering removing these UMAs. They were us
| |
644 UMA_HISTOGRAM_BOOLEAN("Sync.BackendInitializeFirstTimeSuccess", success); | 651 UMA_HISTOGRAM_BOOLEAN("Sync.BackendInitializeFirstTimeSuccess", success); |
645 } else { | 652 } else { |
646 UMA_HISTOGRAM_BOOLEAN("Sync.BackendInitializeRestoreSuccess", success); | 653 UMA_HISTOGRAM_BOOLEAN("Sync.BackendInitializeRestoreSuccess", success); |
647 } | 654 } |
648 | 655 |
649 if (!start_up_time_.is_null()) { | 656 if (!start_up_time_.is_null()) { |
650 base::Time on_backend_initialized_time = base::Time::Now(); | 657 base::Time on_backend_initialized_time = base::Time::Now(); |
651 base::TimeDelta delta = on_backend_initialized_time - start_up_time_; | 658 base::TimeDelta delta = on_backend_initialized_time - start_up_time_; |
652 if (is_first_time_sync_configure_) { | 659 if (is_first_time_sync_configure_) { |
653 UMA_HISTOGRAM_LONG_TIMES("Sync.BackendInitializeFirstTime", delta); | 660 UMA_HISTOGRAM_LONG_TIMES("Sync.BackendInitializeFirstTime", delta); |
(...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1755 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru. | 1762 // See http://stackoverflow.com/questions/6224121/is-new-this-myclass-undefine d-behaviour-after-directly-calling-the-destru. |
1756 ProfileSyncService* old_this = this; | 1763 ProfileSyncService* old_this = this; |
1757 this->~ProfileSyncService(); | 1764 this->~ProfileSyncService(); |
1758 new(old_this) ProfileSyncService( | 1765 new(old_this) ProfileSyncService( |
1759 new ProfileSyncComponentsFactoryImpl(profile, | 1766 new ProfileSyncComponentsFactoryImpl(profile, |
1760 CommandLine::ForCurrentProcess()), | 1767 CommandLine::ForCurrentProcess()), |
1761 profile, | 1768 profile, |
1762 signin, | 1769 signin, |
1763 behavior); | 1770 behavior); |
1764 } | 1771 } |
OLD | NEW |