Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1170)

Unified Diff: sync/internal_api/sync_manager.cc

Issue 10701085: Revert "Revert 142517 - [Sync] Refactor sync configuration logic." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile/test Created 8 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: sync/internal_api/sync_manager.cc
diff --git a/sync/internal_api/sync_manager.cc b/sync/internal_api/sync_manager.cc
index b0d9ebb660a8ecb1a0007cc8b8967691c17340f3..d1b721fed6eb5e21239df78cd01bbabc7f7bcfc1 100644
--- a/sync/internal_api/sync_manager.cc
+++ b/sync/internal_api/sync_manager.cc
@@ -32,6 +32,7 @@
#include "sync/internal_api/public/base_node.h"
#include "sync/internal_api/public/configure_reason.h"
#include "sync/internal_api/public/engine/polling_constants.h"
+#include "sync/internal_api/public/http_post_provider_factory.h"
#include "sync/internal_api/public/read_node.h"
#include "sync/internal_api/public/read_transaction.h"
#include "sync/internal_api/public/user_share.h"
@@ -176,14 +177,14 @@ class SyncManager::SyncInternal
int port,
bool use_ssl,
const scoped_refptr<base::TaskRunner>& blocking_task_runner,
- HttpPostProviderFactory* post_factory,
+ scoped_ptr<HttpPostProviderFactory> post_factory,
const syncer::ModelSafeRoutingInfo& model_safe_routing_info,
const std::vector<syncer::ModelSafeWorker*>& workers,
syncer::ExtensionsActivityMonitor*
extensions_activity_monitor,
ChangeDelegate* change_delegate,
const SyncCredentials& credentials,
- syncer::SyncNotifier* sync_notifier,
+ scoped_ptr<syncer::SyncNotifier> sync_notifier,
const std::string& restored_key_for_bootstrapping,
TestingMode testing_mode,
Encryptor* encryptor,
@@ -694,20 +695,20 @@ bool SyncManager::Init(
int sync_server_port,
bool use_ssl,
const scoped_refptr<base::TaskRunner>& blocking_task_runner,
- HttpPostProviderFactory* post_factory,
+ scoped_ptr<HttpPostProviderFactory> post_factory,
const syncer::ModelSafeRoutingInfo& model_safe_routing_info,
const std::vector<syncer::ModelSafeWorker*>& workers,
syncer::ExtensionsActivityMonitor* extensions_activity_monitor,
ChangeDelegate* change_delegate,
const SyncCredentials& credentials,
- syncer::SyncNotifier* sync_notifier,
+ scoped_ptr<syncer::SyncNotifier> sync_notifier,
const std::string& restored_key_for_bootstrapping,
TestingMode testing_mode,
Encryptor* encryptor,
UnrecoverableErrorHandler* unrecoverable_error_handler,
ReportUnrecoverableErrorFunction report_unrecoverable_error_function) {
DCHECK(thread_checker_.CalledOnValidThread());
- DCHECK(post_factory);
+ DCHECK(post_factory.get());
DVLOG(1) << "SyncManager starting Init...";
std::string server_string(sync_server_and_path);
return data_->Init(database_location,
@@ -716,13 +717,13 @@ bool SyncManager::Init(
sync_server_port,
use_ssl,
blocking_task_runner,
- post_factory,
+ post_factory.Pass(),
model_safe_routing_info,
workers,
extensions_activity_monitor,
change_delegate,
credentials,
- sync_notifier,
+ sync_notifier.Pass(),
restored_key_for_bootstrapping,
testing_mode,
encryptor,
@@ -751,6 +752,21 @@ syncer::ModelTypeSet SyncManager::InitialSyncEndedTypes() {
return data_->InitialSyncEndedTypes();
}
+syncer::ModelTypeSet SyncManager::GetTypesWithEmptyProgressMarkerToken(
+ syncer::ModelTypeSet types) {
+ syncer::ModelTypeSet result;
+ for (syncer::ModelTypeSet::Iterator i = types.First();
+ i.Good(); i.Inc()) {
+ sync_pb::DataTypeProgressMarker marker;
+ GetUserShare()->directory->GetDownloadProgress(i.Get(), &marker);
+
+ if (marker.token().empty())
+ result.Put(i.Get());
+
+ }
+ return result;
+}
+
void SyncManager::StartSyncingNormally(
const syncer::ModelSafeRoutingInfo& routing_info) {
DCHECK(thread_checker_.CalledOnValidThread());
@@ -837,13 +853,13 @@ bool SyncManager::SyncInternal::Init(
int port,
bool use_ssl,
const scoped_refptr<base::TaskRunner>& blocking_task_runner,
- HttpPostProviderFactory* post_factory,
+ scoped_ptr<HttpPostProviderFactory> post_factory,
const syncer::ModelSafeRoutingInfo& model_safe_routing_info,
const std::vector<syncer::ModelSafeWorker*>& workers,
syncer::ExtensionsActivityMonitor* extensions_activity_monitor,
ChangeDelegate* change_delegate,
const SyncCredentials& credentials,
- syncer::SyncNotifier* sync_notifier,
+ scoped_ptr<syncer::SyncNotifier> sync_notifier,
const std::string& restored_key_for_bootstrapping,
TestingMode testing_mode,
Encryptor* encryptor,
@@ -862,7 +878,7 @@ bool SyncManager::SyncInternal::Init(
change_delegate_ = change_delegate;
testing_mode_ = testing_mode;
- sync_notifier_.reset(sync_notifier);
+ sync_notifier_ = sync_notifier.Pass();
AddObserver(&js_sync_manager_observer_);
SetJsEventHandler(event_handler);
@@ -896,7 +912,7 @@ bool SyncManager::SyncInternal::Init(
backing_store));
connection_manager_.reset(new SyncAPIServerConnectionManager(
- sync_server_and_path, port, use_ssl, post_factory));
+ sync_server_and_path, port, use_ssl, post_factory.release()));
net::NetworkChangeNotifier::AddIPAddressObserver(this);
observing_ip_address_changes_ = true;
@@ -2472,20 +2488,4 @@ bool InitialSyncEndedForTypes(syncer::ModelTypeSet types,
return true;
}
-syncer::ModelTypeSet GetTypesWithEmptyProgressMarkerToken(
- syncer::ModelTypeSet types,
- syncer::UserShare* share) {
- syncer::ModelTypeSet result;
- for (syncer::ModelTypeSet::Iterator i = types.First();
- i.Good(); i.Inc()) {
- sync_pb::DataTypeProgressMarker marker;
- share->directory->GetDownloadProgress(i.Get(), &marker);
-
- if (marker.token().empty())
- result.Put(i.Get());
-
- }
- return result;
-}
-
} // namespace syncer

Powered by Google App Engine
This is Rietveld 408576698