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

Unified Diff: components/sync/driver/shared_change_processor.h

Issue 2257523003: [Sync] Move StartAssociation from NonUIDataTypeController to SharedChangeProcessor. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Move local_service_ WeakPtr to SharedChangeProcessor. Created 4 years, 4 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: components/sync/driver/shared_change_processor.h
diff --git a/components/sync/driver/shared_change_processor.h b/components/sync/driver/shared_change_processor.h
index c068f821145cd0d1f145701827cf8fa8fa7072be..09b77111ffc4b0ef8367ed92ddf83048e4cea76a 100644
--- a/components/sync/driver/shared_change_processor.h
+++ b/components/sync/driver/shared_change_processor.h
@@ -18,6 +18,7 @@
#include "components/sync/api/sync_error.h"
#include "components/sync/api/sync_error_factory.h"
#include "components/sync/api/sync_merge_result.h"
+#include "components/sync/driver/data_type_controller.h"
#include "components/sync/engine/model_safe_worker.h"
namespace syncer {
@@ -53,8 +54,19 @@ class SyncClient;
class SharedChangeProcessor
: public base::RefCountedThreadSafe<SharedChangeProcessor> {
public:
+ typedef base::Callback<void(
+ DataTypeController::ConfigureResult start_result,
+ const syncer::SyncMergeResult& local_merge_result,
+ const syncer::SyncMergeResult& syncer_merge_result)>
+ StartDoneCallback;
+
// Create an uninitialized SharedChangeProcessor.
- SharedChangeProcessor();
+ explicit SharedChangeProcessor(syncer::ModelType type);
+
+ void StartAssociation(StartDoneCallback start_done,
+ SyncClient* const sync_client,
+ syncer::UserShare* user_share,
+ syncer::DataTypeErrorHandler* error_handler);
// Connect to the Syncer and prepare to handle changes for |type|. Will
// create and store a new GenericChangeProcessor and return a weak pointer to
@@ -66,7 +78,6 @@ class SharedChangeProcessor
GenericChangeProcessorFactory* processor_factory,
syncer::UserShare* user_share,
syncer::DataTypeErrorHandler* error_handler,
- syncer::ModelType type,
const base::WeakPtr<syncer::SyncMergeResult>& merge_result);
// Disconnects from the generic change processor. May be called from any
@@ -105,6 +116,9 @@ class SharedChangeProcessor
const tracked_objects::Location& location,
const std::string& message);
+ // Calls local_service_->StopSyncing() and releases our reference to it.
+ void StopLocalService();
+
ChangeProcessor* generic_change_processor();
protected:
@@ -112,6 +126,9 @@ class SharedChangeProcessor
virtual ~SharedChangeProcessor();
private:
+ // Record association time.
+ virtual void RecordAssociationTime(base::TimeDelta time);
+
// Monitor lock for this object. All methods that interact with the change
// processor must aquire this lock and check whether we're disconnected or
// not. Once disconnected, all attempted changes to or loads from the change
@@ -120,8 +137,8 @@ class SharedChangeProcessor
mutable base::Lock monitor_lock_;
bool disconnected_;
- // The sync datatype we were last connected to.
- syncer::ModelType type_;
+ // The sync datatype we process changes for.
+ const syncer::ModelType type_;
// The frontend / UI MessageLoop this object is constructed on. May also be
// destructed and/or disconnected on this loop, see ~SharedChangeProcessor.
@@ -136,6 +153,10 @@ class SharedChangeProcessor
syncer::DataTypeErrorHandler* error_handler_;
+ // The local service for this type. Only set if the DTC for the type uses
+ // SharedChangeProcessor::StartAssociation().
+ base::WeakPtr<syncer::SyncableService> local_service_;
+
DISALLOW_COPY_AND_ASSIGN(SharedChangeProcessor);
};
« no previous file with comments | « components/sync/driver/non_ui_data_type_controller_unittest.cc ('k') | components/sync/driver/shared_change_processor.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698