Chromium Code Reviews| Index: chrome/browser/dom_ui/chrome_url_data_manager.h |
| diff --git a/chrome/browser/dom_ui/chrome_url_data_manager.h b/chrome/browser/dom_ui/chrome_url_data_manager.h |
| index 709cdcbdaf5196cbf57ab89f53d4d54196e9f9af..837e2b5b0ccdba29e332a1b93755164b8b8a28b3 100644 |
| --- a/chrome/browser/dom_ui/chrome_url_data_manager.h |
| +++ b/chrome/browser/dom_ui/chrome_url_data_manager.h |
| @@ -12,6 +12,7 @@ |
| #include "base/singleton.h" |
| #include "base/task.h" |
| #include "base/ref_counted.h" |
| +#include "chrome/browser/browser_thread.h" |
| class DictionaryValue; |
| class FilePath; |
| @@ -42,12 +43,13 @@ class ChromeURLDataManager { |
| // asynchronously. DataSources are collectively owned with refcounting smart |
| // pointers and should never be deleted on the IO thread, since their calls |
| // are handled almost always on the UI thread and there's a possibility of a |
| - // data race. |
| + // data race. The |DeleteOnUIThread| trait is used to enforce this. |
| // |
| // An implementation of DataSource should handle calls to |
| // StartDataRequest() by starting its (implementation-specific) asynchronous |
| - // request for the data, then call SendResponse() to notify |
| - class DataSource : public base::RefCountedThreadSafe<DataSource> { |
| + // request for the data, then call SendResponse() to notify. |
| + class DataSource : public base::RefCountedThreadSafe< |
| + DataSource, BrowserThread::DeleteOnUIThread> { |
| public: |
| // See source_name_ and message_loop_ below for docs on these parameters. |
| DataSource(const std::string& source_name, |
| @@ -87,6 +89,8 @@ class ChromeURLDataManager { |
| protected: |
| friend class base::RefCountedThreadSafe<DataSource>; |
| + friend struct BrowserThread::DeleteOnThread<BrowserThread::UI>; |
| + friend class DeleteTask<DataSource>; |
| virtual ~DataSource(); |
| @@ -99,7 +103,7 @@ class ChromeURLDataManager { |
| // The MessageLoop for the thread where this DataSource lives. |
| // Used to send messages to the DataSource. |
| MessageLoop* message_loop_; |
| - }; |
| + }; |
|
eroman
2011/01/24 18:26:39
what happened to the indentation here? looks off.
ahendrickson
2011/01/24 19:58:20
Fixed. Didn't notice when Visual Studio reformatt
|
| // Add a DataSource to the collection of data sources. |
| // Because we don't track users of a given path, we can't know when it's |