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/glue/data_type_manager_impl.h" | 5 #include "chrome/browser/sync/glue/data_type_manager_impl.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <functional> | 8 #include <functional> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 // set of desired types. Either way, |last_requested_types_| will contain | 160 // set of desired types. Either way, |last_requested_types_| will contain |
161 // the most recent set of desired types, so we just call configure. | 161 // the most recent set of desired types, so we just call configure. |
162 // Note: we do this whether or not GetControllersNeedingStart is true, | 162 // Note: we do this whether or not GetControllersNeedingStart is true, |
163 // because we may need to stop datatypes. | 163 // because we may need to stop datatypes. |
164 SetBlockedAndNotify(); | 164 SetBlockedAndNotify(); |
165 DVLOG(1) << "Reconfiguring due to previous configure attempt occuring while" | 165 DVLOG(1) << "Reconfiguring due to previous configure attempt occuring while" |
166 << " busy."; | 166 << " busy."; |
167 | 167 |
168 // Unwind the stack before executing configure. The method configure and its | 168 // Unwind the stack before executing configure. The method configure and its |
169 // callees are not re-entrant. | 169 // callees are not re-entrant. |
170 MessageLoop::current()->PostTask( | 170 base::MessageLoop::current()->PostTask( |
171 FROM_HERE, | 171 FROM_HERE, |
172 base::Bind(&DataTypeManagerImpl::ConfigureImpl, | 172 base::Bind(&DataTypeManagerImpl::ConfigureImpl, |
173 weak_ptr_factory_.GetWeakPtr(), | 173 weak_ptr_factory_.GetWeakPtr(), |
174 last_requested_types_, | 174 last_requested_types_, |
175 last_configure_reason_)); | 175 last_configure_reason_)); |
176 | 176 |
177 needs_reconfigure_ = false; | 177 needs_reconfigure_ = false; |
178 last_configure_reason_ = syncer::CONFIGURE_REASON_UNKNOWN; | 178 last_configure_reason_ = syncer::CONFIGURE_REASON_UNKNOWN; |
179 return true; | 179 return true; |
180 } | 180 } |
(...skipping 178 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 << configure_time_delta_.InSecondsF() << "s"; | 359 << configure_time_delta_.InSecondsF() << "s"; |
360 observer_->OnConfigureBlocked(); | 360 observer_->OnConfigureBlocked(); |
361 } | 361 } |
362 | 362 |
363 void DataTypeManagerImpl::AddToConfigureTime() { | 363 void DataTypeManagerImpl::AddToConfigureTime() { |
364 DCHECK(!last_restart_time_.is_null()); | 364 DCHECK(!last_restart_time_.is_null()); |
365 configure_time_delta_ += (base::Time::Now() - last_restart_time_); | 365 configure_time_delta_ += (base::Time::Now() - last_restart_time_); |
366 } | 366 } |
367 | 367 |
368 } // namespace browser_sync | 368 } // namespace browser_sync |
OLD | NEW |