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

Unified Diff: chrome/browser/sync/glue/non_frontend_data_type_controller.h

Issue 9307079: [Sync] Fix thread-ordering-dependent NULL dereference in NewNonFrontendDTC (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed comments Created 8 years, 11 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: chrome/browser/sync/glue/non_frontend_data_type_controller.h
diff --git a/chrome/browser/sync/glue/non_frontend_data_type_controller.h b/chrome/browser/sync/glue/non_frontend_data_type_controller.h
index 55f56d95f06f878c73f4b9247c7951e9a8955a74..791701c73f39ccdd586292fdae4b3689627d1950 100644
--- a/chrome/browser/sync/glue/non_frontend_data_type_controller.h
+++ b/chrome/browser/sync/glue/non_frontend_data_type_controller.h
@@ -66,8 +66,8 @@ class NonFrontendDataTypeController : public DataTypeController {
// associate models. The default implementation is a no-op.
// Return value:
// True - if models are ready and association can proceed.
- // False - if models are not ready. KickOffAssociation should be called
- // when the models are ready. Refer to Start(_) implementation.
+ // False - if models are not ready. StartAssociationAsync should be called
+ // when the models are ready.
// Note: this is performed on the frontend (UI) thread.
virtual bool StartModels();
@@ -78,10 +78,6 @@ class NonFrontendDataTypeController : public DataTypeController {
const tracked_objects::Location& from_here,
const base::Closure& task) = 0;
- // Build sync components and associate models.
- // Note: this is performed on the datatype's thread.
- virtual void StartAssociation();
-
// Datatype specific creation of sync components.
// Note: this is performed on the datatype's thread.
virtual void CreateSyncComponents() = 0;
@@ -107,10 +103,6 @@ class NonFrontendDataTypeController : public DataTypeController {
// Note: this is performed on the frontend (UI) thread.
virtual void StopModels();
- // Disassociate the models and destroy the sync components.
- // Note: this is performed on the datatype's thread.
- virtual void StopAssociation();
-
// Implementation of OnUnrecoverableError that lives on UI thread.
virtual void OnUnrecoverableErrorImpl(
const tracked_objects::Location& from_here,
@@ -131,12 +123,7 @@ class NonFrontendDataTypeController : public DataTypeController {
// Post the association task to the thread the datatype lives on.
// Note: this is performed on the frontend (UI) thread.
// Return value: True if task posted successfully, False otherwise.
- bool StartAssociationAsync();
-
- // Post the StopAssociation task to the thread the datatype lives on.
- // Note: this is performed on the frontend (UI) thread.
- // Return value: True if task posted successfully, False otherwise.
- bool StopAssociationAsync();
+ virtual bool StartAssociationAsync();
// Accessors and mutators used by derived classes.
ProfileSyncComponentsFactory* profile_sync_factory() const;
@@ -151,6 +138,19 @@ class NonFrontendDataTypeController : public DataTypeController {
virtual void set_change_processor(ChangeProcessor* change_processor);
private:
+ // Build sync components and associate models.
+ // Note: this is performed on the datatype's thread.
+ void StartAssociation();
+
+ // Post the StopAssociation task to the thread the datatype lives on.
+ // Note: this is performed on the frontend (UI) thread.
+ // Return value: True if task posted successfully, False otherwise.
+ bool StopAssociationAsync();
+
+ // Disassociate the models and destroy the sync components.
+ // Note: this is performed on the datatype's thread.
+ void StopAssociation();
+
ProfileSyncComponentsFactory* const profile_sync_factory_;
Profile* const profile_;
ProfileSyncService* const profile_sync_service_;

Powered by Google App Engine
This is Rietveld 408576698