| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "components/sync_driver/startup_controller.h" | 5 #include "components/sync_driver/startup_controller.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/location.h" | 10 #include "base/location.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 | 71 |
| 72 void StartupController::Reset(const syncer::ModelTypeSet registered_types) { | 72 void StartupController::Reset(const syncer::ModelTypeSet registered_types) { |
| 73 received_start_request_ = false; | 73 received_start_request_ = false; |
| 74 start_up_time_ = base::Time(); | 74 start_up_time_ = base::Time(); |
| 75 start_backend_time_ = base::Time(); | 75 start_backend_time_ = base::Time(); |
| 76 // Don't let previous timers affect us post-reset. | 76 // Don't let previous timers affect us post-reset. |
| 77 weak_factory_.InvalidateWeakPtrs(); | 77 weak_factory_.InvalidateWeakPtrs(); |
| 78 registered_types_ = registered_types; | 78 registered_types_ = registered_types; |
| 79 } | 79 } |
| 80 | 80 |
| 81 void StartupController::set_setup_in_progress(bool in_progress) { | 81 void StartupController::SetSetupInProgress(bool setup_in_progress) { |
| 82 setup_in_progress_ = in_progress; | 82 setup_in_progress_ = setup_in_progress; |
| 83 if (setup_in_progress_) { |
| 84 TryStart(); |
| 85 } |
| 83 } | 86 } |
| 84 | 87 |
| 85 bool StartupController::StartUp(StartUpDeferredOption deferred_option) { | 88 bool StartupController::StartUp(StartUpDeferredOption deferred_option) { |
| 86 const bool first_start = start_up_time_.is_null(); | 89 const bool first_start = start_up_time_.is_null(); |
| 87 if (first_start) | 90 if (first_start) |
| 88 start_up_time_ = base::Time::Now(); | 91 start_up_time_ = base::Time::Now(); |
| 89 | 92 |
| 90 if (deferred_option == STARTUP_BACKEND_DEFERRED && | 93 if (deferred_option == STARTUP_BACKEND_DEFERRED && |
| 91 !base::CommandLine::ForCurrentProcess()->HasSwitch( | 94 !base::CommandLine::ForCurrentProcess()->HasSwitch( |
| 92 switches::kSyncDisableDeferredStartup) && | 95 switches::kSyncDisableDeferredStartup) && |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 211 syncer::MODEL_TYPE_COUNT); | 214 syncer::MODEL_TYPE_COUNT); |
| 212 UMA_HISTOGRAM_ENUMERATION("Sync.Startup.DeferredInitTrigger", | 215 UMA_HISTOGRAM_ENUMERATION("Sync.Startup.DeferredInitTrigger", |
| 213 TRIGGER_DATA_TYPE_REQUEST, | 216 TRIGGER_DATA_TYPE_REQUEST, |
| 214 MAX_TRIGGER_VALUE); | 217 MAX_TRIGGER_VALUE); |
| 215 } | 218 } |
| 216 received_start_request_ = true; | 219 received_start_request_ = true; |
| 217 TryStart(); | 220 TryStart(); |
| 218 } | 221 } |
| 219 | 222 |
| 220 } // namespace browser_sync | 223 } // namespace browser_sync |
| OLD | NEW |