| Index: chrome/browser/sync/glue/data_type_controller.h
|
| diff --git a/chrome/browser/sync/glue/data_type_controller.h b/chrome/browser/sync/glue/data_type_controller.h
|
| index 2be6064ca679a53be1a74fa74cfbb6175d7efd62..f7a97933aeaad4b0c6573d5543fba868415c85aa 100644
|
| --- a/chrome/browser/sync/glue/data_type_controller.h
|
| +++ b/chrome/browser/sync/glue/data_type_controller.h
|
| @@ -22,11 +22,25 @@ class SyncError;
|
|
|
| namespace browser_sync {
|
|
|
| +// The last reference to a DataTypeController should always be released on the
|
| +// UI thread. This is enforced in NonFrontendDataTypeController by blocking
|
| +// until StopAssociation() has finished executing.
|
| +struct ForceDeleteOnUIThread {
|
| + template<typename T>
|
| + static void Destruct(const T* x) {
|
| + if (content::BrowserThread::CurrentlyOn(content::BrowserThread::UI)) {
|
| + delete x;
|
| + } else {
|
| + NOTREACHED();
|
| + }
|
| + }
|
| +};
|
| +
|
| // Data type controllers need to be refcounted threadsafe, as they may
|
| // need to run model associator or change processor on other threads.
|
| class DataTypeController
|
| : public base::RefCountedThreadSafe<
|
| - DataTypeController, content::BrowserThread::DeleteOnUIThread>,
|
| + DataTypeController, ForceDeleteOnUIThread>,
|
| public DataTypeErrorHandler {
|
| public:
|
| enum State {
|
| @@ -105,8 +119,7 @@ class DataTypeController
|
| syncable::ModelType type) OVERRIDE;
|
|
|
| protected:
|
| - friend struct content::BrowserThread::DeleteOnThread<
|
| - content::BrowserThread::UI>;
|
| + friend struct ForceDeleteOnUIThread;
|
| friend class base::DeleteHelper<DataTypeController>;
|
|
|
| virtual ~DataTypeController() {}
|
|
|