summaryrefslogtreecommitdiffstats
path: root/sync/tools
diff options
context:
space:
mode:
authorzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-17 20:12:15 +0000
committerzea@chromium.org <zea@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2012-07-17 20:12:15 +0000
commitceffdf01e68f732b0aa5731274dbf3d32a27ffde (patch)
tree22976ce293d7bdfd20871a2d1f28524d441157cf /sync/tools
parent3cf1e5d278ee73b5c3365b35614091858b9f5d1a (diff)
downloadchromium_src-ceffdf01e68f732b0aa5731274dbf3d32a27ffde.zip
chromium_src-ceffdf01e68f732b0aa5731274dbf3d32a27ffde.tar.gz
chromium_src-ceffdf01e68f732b0aa5731274dbf3d32a27ffde.tar.bz2
[Sync] Refactor sync manager into interface.
sync_manager.h now defines a pure interface. The actual implementation is in sync_manager_impl.h/cc. In order to support this, we also create a SyncManagerFactory, which allows us to dependency inject a SyncManager implementation into the SyncBackendHost. Follow up patches will make use of this injection, as well as split the SyncManager tests out of syncapi_unittest. R=akalin@chromium.org BUG=133061 TEST= Review URL: https://chromiumcodereview.appspot.com/10704214 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@147076 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'sync/tools')
-rw-r--r--sync/tools/sync_client.cc17
1 files changed, 11 insertions, 6 deletions
diff --git a/sync/tools/sync_client.cc b/sync/tools/sync_client.cc
index d9fd4c5..1b9dbf8 100644
--- a/sync/tools/sync_client.cc
+++ b/sync/tools/sync_client.cc
@@ -32,12 +32,14 @@
#include "sync/internal_api/public/http_bridge.h"
#include "sync/internal_api/public/read_node.h"
#include "sync/internal_api/public/sync_manager.h"
+#include "sync/internal_api/public/sync_manager_factory.h"
#include "sync/internal_api/public/util/report_unrecoverable_error_function.h"
#include "sync/internal_api/public/util/unrecoverable_error_handler.h"
#include "sync/internal_api/public/util/weak_handle.h"
#include "sync/js/js_event_details.h"
#include "sync/js/js_event_handler.h"
#include "sync/notifier/invalidation_state_tracker.h"
+#include "sync/notifier/sync_notifier.h"
#include "sync/notifier/sync_notifier_factory.h"
#include "sync/test/fake_encryptor.h"
@@ -326,7 +328,9 @@ int main(int argc, char* argv[]) {
workers.push_back(passive_model_safe_worker.get());
// Set up sync manager.
- syncer::SyncManager sync_manager("sync_client manager");
+ syncer::SyncManagerFactory sync_manager_factory;
+ scoped_ptr<syncer::SyncManager> sync_manager =
+ sync_manager_factory.CreateSyncManager("sync_client manager");
LoggingJsEventHandler js_event_handler;
const char kSyncServerAndPath[] = "clients4.google.com/chrome-sync/dev";
int kSyncServerPort = 443;
@@ -347,20 +351,21 @@ int main(int argc, char* argv[]) {
syncer::SyncManager::NON_TEST;
NullEncryptor null_encryptor;
LoggingUnrecoverableErrorHandler unrecoverable_error_handler;
- sync_manager.Init(database_dir.path(),
+ sync_manager->Init(database_dir.path(),
syncer::WeakHandle<syncer::JsEventHandler>(
js_event_handler.AsWeakPtr()),
kSyncServerAndPath,
kSyncServerPort,
kUseSsl,
blocking_task_runner,
- post_factory.release(),
+ post_factory.Pass(),
routing_info,
workers,
extensions_activity_monitor,
&change_delegate,
credentials,
- sync_notifier_factory.CreateSyncNotifier(),
+ scoped_ptr<syncer::SyncNotifier>(
+ sync_notifier_factory.CreateSyncNotifier()),
kRestoredKeyForBootstrapping,
kTestingMode,
&null_encryptor,
@@ -368,8 +373,8 @@ int main(int argc, char* argv[]) {
&LogUnrecoverableErrorContext);
// TODO(akalin): We have pass in model parameters multiple times.
// Organize handling of model types.
- sync_manager.UpdateEnabledTypes(model_types);
- sync_manager.StartSyncingNormally(routing_info);
+ sync_manager->UpdateEnabledTypes(model_types);
+ sync_manager->StartSyncingNormally(routing_info);
sync_loop.Run();