| 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 "components/browser_sync/profile_sync_service.h" | 5 #include "components/browser_sync/profile_sync_service.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <cstddef> | 9 #include <cstddef> |
| 10 #include <map> | 10 #include <map> |
| (...skipping 1283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1294 // StartSyncingWithServer() if migration is now finished. | 1294 // StartSyncingWithServer() if migration is now finished. |
| 1295 migrator_->OnConfigureDone(result); | 1295 migrator_->OnConfigureDone(result); |
| 1296 return; | 1296 return; |
| 1297 } | 1297 } |
| 1298 | 1298 |
| 1299 if (result.was_catch_up_configure) { | 1299 if (result.was_catch_up_configure) { |
| 1300 ClearAndRestartSyncForPassphraseEncryption(); | 1300 ClearAndRestartSyncForPassphraseEncryption(); |
| 1301 return; | 1301 return; |
| 1302 } | 1302 } |
| 1303 | 1303 |
| 1304 RecordMemoryUsageHistograms(); |
| 1305 |
| 1304 StartSyncingWithServer(); | 1306 StartSyncingWithServer(); |
| 1305 } | 1307 } |
| 1306 | 1308 |
| 1307 void ProfileSyncService::OnConfigureStart() { | 1309 void ProfileSyncService::OnConfigureStart() { |
| 1308 DCHECK(thread_checker_.CalledOnValidThread()); | 1310 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1309 sync_configure_start_time_ = base::Time::Now(); | 1311 sync_configure_start_time_ = base::Time::Now(); |
| 1310 engine_->StartConfiguration(); | 1312 engine_->StartConfiguration(); |
| 1311 NotifyObservers(); | 1313 NotifyObservers(); |
| 1312 } | 1314 } |
| 1313 | 1315 |
| (...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2386 UMA_HISTOGRAM_COUNTS("Sync.MemoryPressureWarningBeforeCleanShutdown", | 2388 UMA_HISTOGRAM_COUNTS("Sync.MemoryPressureWarningBeforeCleanShutdown", |
| 2387 warning_received); | 2389 warning_received); |
| 2388 } | 2390 } |
| 2389 } | 2391 } |
| 2390 sync_prefs_.SetMemoryPressureWarningCount(0); | 2392 sync_prefs_.SetMemoryPressureWarningCount(0); |
| 2391 // Will set to true during a clean shutdown, so crash or something else will | 2393 // Will set to true during a clean shutdown, so crash or something else will |
| 2392 // remain this as false. | 2394 // remain this as false. |
| 2393 sync_prefs_.SetCleanShutdown(false); | 2395 sync_prefs_.SetCleanShutdown(false); |
| 2394 } | 2396 } |
| 2395 | 2397 |
| 2398 void ProfileSyncService::RecordMemoryUsageHistograms() { |
| 2399 ModelTypeSet active_types = GetActiveDataTypes(); |
| 2400 for (ModelTypeSet::Iterator type_it = active_types.First(); type_it.Good(); |
| 2401 type_it.Inc()) { |
| 2402 auto dtc_it = data_type_controllers_.find(type_it.Get()); |
| 2403 if (dtc_it != data_type_controllers_.end()) |
| 2404 dtc_it->second->RecordMemoryUsageHistogram(); |
| 2405 } |
| 2406 } |
| 2407 |
| 2396 const GURL& ProfileSyncService::sync_service_url() const { | 2408 const GURL& ProfileSyncService::sync_service_url() const { |
| 2397 DCHECK(thread_checker_.CalledOnValidThread()); | 2409 DCHECK(thread_checker_.CalledOnValidThread()); |
| 2398 return sync_service_url_; | 2410 return sync_service_url_; |
| 2399 } | 2411 } |
| 2400 | 2412 |
| 2401 std::string ProfileSyncService::unrecoverable_error_message() const { | 2413 std::string ProfileSyncService::unrecoverable_error_message() const { |
| 2402 DCHECK(thread_checker_.CalledOnValidThread()); | 2414 DCHECK(thread_checker_.CalledOnValidThread()); |
| 2403 return unrecoverable_error_message_; | 2415 return unrecoverable_error_message_; |
| 2404 } | 2416 } |
| 2405 | 2417 |
| (...skipping 11 matching lines...) Expand all Loading... |
| 2417 return; | 2429 return; |
| 2418 | 2430 |
| 2419 DCHECK(startup_controller_->IsSetupInProgress()); | 2431 DCHECK(startup_controller_->IsSetupInProgress()); |
| 2420 startup_controller_->SetSetupInProgress(false); | 2432 startup_controller_->SetSetupInProgress(false); |
| 2421 | 2433 |
| 2422 if (IsEngineInitialized()) | 2434 if (IsEngineInitialized()) |
| 2423 ReconfigureDatatypeManager(); | 2435 ReconfigureDatatypeManager(); |
| 2424 NotifyObservers(); | 2436 NotifyObservers(); |
| 2425 } | 2437 } |
| 2426 } // namespace browser_sync | 2438 } // namespace browser_sync |
| OLD | NEW |