| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/sync_backend_host_core.h" | 5 #include "chrome/browser/sync/glue/sync_backend_host_core.h" |
| 6 | 6 |
| 7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
| 8 #include "base/metrics/histogram.h" | 8 #include "base/metrics/histogram.h" |
| 9 #include "chrome/browser/sync/glue/device_info.h" | 9 #include "chrome/browser/sync/glue/device_info.h" |
| 10 #include "chrome/browser/sync/glue/invalidation_adapter.h" | 10 #include "chrome/browser/sync/glue/invalidation_adapter.h" |
| 11 #include "chrome/browser/sync/glue/sync_backend_registrar.h" | 11 #include "chrome/browser/sync/glue/sync_backend_registrar.h" |
| 12 #include "chrome/browser/sync/glue/synced_device_tracker.h" | 12 #include "chrome/browser/sync/glue/synced_device_tracker.h" |
| 13 #include "chrome/common/chrome_version_info.h" | 13 #include "chrome/common/chrome_version_info.h" |
| 14 #include "components/invalidation/invalidation_util.h" | 14 #include "components/invalidation/invalidation_util.h" |
| 15 #include "components/invalidation/object_id_invalidation_map.h" | 15 #include "components/invalidation/object_id_invalidation_map.h" |
| 16 #include "sync/internal_api/public/events/protocol_event.h" | 16 #include "sync/internal_api/public/events/protocol_event.h" |
| 17 #include "sync/internal_api/public/http_post_provider_factory.h" | 17 #include "sync/internal_api/public/http_post_provider_factory.h" |
| 18 #include "sync/internal_api/public/internal_components_factory.h" | 18 #include "sync/internal_api/public/internal_components_factory.h" |
| 19 #include "sync/internal_api/public/sessions/commit_counters.h" | 19 #include "sync/internal_api/public/sessions/commit_counters.h" |
| 20 #include "sync/internal_api/public/sessions/status_counters.h" | 20 #include "sync/internal_api/public/sessions/status_counters.h" |
| 21 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" | 21 #include "sync/internal_api/public/sessions/sync_session_snapshot.h" |
| 22 #include "sync/internal_api/public/sessions/update_counters.h" | 22 #include "sync/internal_api/public/sessions/update_counters.h" |
| 23 #include "sync/internal_api/public/sync_context_proxy.h" | 23 #include "sync/internal_api/public/sync_context_proxy.h" |
| 24 #include "sync/internal_api/public/sync_manager.h" | 24 #include "sync/internal_api/public/sync_manager.h" |
| 25 #include "sync/internal_api/public/sync_manager_factory.h" | 25 #include "sync/internal_api/public/sync_manager_factory.h" |
| 26 #include "url/gurl.h" |
| 26 | 27 |
| 27 // Helper macros to log with the syncer thread name; useful when there | 28 // Helper macros to log with the syncer thread name; useful when there |
| 28 // are multiple syncers involved. | 29 // are multiple syncers involved. |
| 29 | 30 |
| 30 #define SLOG(severity) LOG(severity) << name_ << ": " | 31 #define SLOG(severity) LOG(severity) << name_ << ": " |
| 31 | 32 |
| 32 #define SDVLOG(verbose_level) DVLOG(verbose_level) << name_ << ": " | 33 #define SDVLOG(verbose_level) DVLOG(verbose_level) << name_ << ": " |
| 33 | 34 |
| 34 static const int kSaveChangesIntervalSeconds = 10; | 35 static const int kSaveChangesIntervalSeconds = 10; |
| 35 | 36 |
| (...skipping 388 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 424 } | 425 } |
| 425 | 426 |
| 426 DCHECK(!registrar_); | 427 DCHECK(!registrar_); |
| 427 registrar_ = options->registrar; | 428 registrar_ = options->registrar; |
| 428 DCHECK(registrar_); | 429 DCHECK(registrar_); |
| 429 | 430 |
| 430 sync_manager_ = options->sync_manager_factory->CreateSyncManager(name_); | 431 sync_manager_ = options->sync_manager_factory->CreateSyncManager(name_); |
| 431 sync_manager_->AddObserver(this); | 432 sync_manager_->AddObserver(this); |
| 432 sync_manager_->Init(sync_data_folder_path_, | 433 sync_manager_->Init(sync_data_folder_path_, |
| 433 options->event_handler, | 434 options->event_handler, |
| 434 options->service_url.host() + options->service_url.path(), | 435 options->service_url, |
| 435 options->service_url.EffectiveIntPort(), | |
| 436 options->service_url.SchemeIsSecure(), | |
| 437 options->http_bridge_factory.Pass(), | 436 options->http_bridge_factory.Pass(), |
| 438 options->workers, | 437 options->workers, |
| 439 options->extensions_activity, | 438 options->extensions_activity, |
| 440 options->registrar /* as SyncManager::ChangeDelegate */, | 439 options->registrar /* as SyncManager::ChangeDelegate */, |
| 441 options->credentials, | 440 options->credentials, |
| 442 options->invalidator_client_id, | 441 options->invalidator_client_id, |
| 443 options->restored_key_for_bootstrapping, | 442 options->restored_key_for_bootstrapping, |
| 444 options->restored_keystore_key_for_bootstrapping, | 443 options->restored_keystore_key_for_bootstrapping, |
| 445 options->internal_components_factory.get(), | 444 options->internal_components_factory.get(), |
| 446 &encryptor_, | 445 &encryptor_, |
| (...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 745 base::TimeDelta::FromSeconds(kSaveChangesIntervalSeconds), | 744 base::TimeDelta::FromSeconds(kSaveChangesIntervalSeconds), |
| 746 this, &SyncBackendHostCore::SaveChanges); | 745 this, &SyncBackendHostCore::SaveChanges); |
| 747 } | 746 } |
| 748 | 747 |
| 749 void SyncBackendHostCore::SaveChanges() { | 748 void SyncBackendHostCore::SaveChanges() { |
| 750 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); | 749 DCHECK_EQ(base::MessageLoop::current(), sync_loop_); |
| 751 sync_manager_->SaveChanges(); | 750 sync_manager_->SaveChanges(); |
| 752 } | 751 } |
| 753 | 752 |
| 754 } // namespace browser_sync | 753 } // namespace browser_sync |
| 755 | |
| OLD | NEW |