summaryrefslogtreecommitdiffstats
path: root/components/sync_driver/generic_change_processor_factory.h
diff options
context:
space:
mode:
authortim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-01 23:39:05 +0000
committertim@chromium.org <tim@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2014-05-01 23:39:05 +0000
commitae16f2921de06c8a1bc8aaab67a7c21a38f04c36 (patch)
tree9715adcb94349235de1b4c5fef0e45d39cb5f5a3 /components/sync_driver/generic_change_processor_factory.h
parent790591d1c8a92f496b43ef87fe2cf48eb09020bb (diff)
downloadchromium_src-ae16f2921de06c8a1bc8aaab67a7c21a38f04c36.zip
chromium_src-ae16f2921de06c8a1bc8aaab67a7c21a38f04c36.tar.gz
chromium_src-ae16f2921de06c8a1bc8aaab67a7c21a38f04c36.tar.bz2
sync: remove CreateGenericChangeProcessor from ProfileSyncComponentsFactory
Instead, pass a GenericChangeProcessorFactory to the SharedChangeProcessor's Connect() method for use when needed. Also moves AttachmentService creation to SharedChangeProcessor via existing SyncApiComponentsFactory. This is a step towards moving SharedChangeProcessor into sync_driver as it removes dependencies on ProfileSync components. BUG=339726 Review URL: https://codereview.chromium.org/260493002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@267666 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'components/sync_driver/generic_change_processor_factory.h')
-rw-r--r--components/sync_driver/generic_change_processor_factory.h45
1 files changed, 45 insertions, 0 deletions
diff --git a/components/sync_driver/generic_change_processor_factory.h b/components/sync_driver/generic_change_processor_factory.h
new file mode 100644
index 0000000..978d313
--- /dev/null
+++ b/components/sync_driver/generic_change_processor_factory.h
@@ -0,0 +1,45 @@
+// Copyright 2014 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_FACTORY_H_
+#define COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_FACTORY_H_
+
+#include "base/memory/weak_ptr.h"
+
+namespace syncer {
+class AttachmentService;
+class SyncableService;
+class SyncMergeResult;
+struct UserShare;
+}
+
+namespace browser_sync {
+
+class DataTypeErrorHandler;
+class GenericChangeProcessor;
+
+// Because GenericChangeProcessors are created and used only from the model
+// thread, their lifetime is strictly shorter than other components like
+// DataTypeController, which live before / after communication with model
+// threads begins and ends.
+// The GCP is created "on the fly" at just the right time, on just the right
+// thread. Given that, we use a factory to instantiate GenericChangeProcessors
+// so that tests can choose to use a fake processor (i.e instead of injection).
+class GenericChangeProcessorFactory {
+ public:
+ GenericChangeProcessorFactory();
+ virtual ~GenericChangeProcessorFactory();
+ virtual scoped_ptr<GenericChangeProcessor> CreateGenericChangeProcessor(
+ syncer::UserShare* user_share,
+ browser_sync::DataTypeErrorHandler* error_handler,
+ const base::WeakPtr<syncer::SyncableService>& local_service,
+ const base::WeakPtr<syncer::SyncMergeResult>& merge_result,
+ scoped_ptr<syncer::AttachmentService> attachment_service);
+ private:
+ DISALLOW_COPY_AND_ASSIGN(GenericChangeProcessorFactory);
+};
+
+} // namespace browser_sync
+
+#endif // COMPONENTS_SYNC_DRIVER_GENERIC_CHANGE_PROCESSOR_FACTORY_H_