diff options
author | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-01 19:52:30 +0000 |
---|---|---|
committer | phajdan.jr@chromium.org <phajdan.jr@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-02-01 19:52:30 +0000 |
commit | d8ff9e4d5064ac940e3eb4ea160d213c62478e86 (patch) | |
tree | f89c509f1dc1d9b53b3e19c5ecfea239c34f3982 /chrome/browser/automation/automation_provider.h | |
parent | ff52c165aa2d4b98f9a11208ef8d22866aeb407b (diff) | |
download | chromium_src-d8ff9e4d5064ac940e3eb4ea160d213c62478e86.zip chromium_src-d8ff9e4d5064ac940e3eb4ea160d213c62478e86.tar.gz chromium_src-d8ff9e4d5064ac940e3eb4ea160d213c62478e86.tar.bz2 |
Make AutomationProvider RefCountedThreadSafe instead of RefCounted
We are calling AddRef/Release from multiple threads, and just
RefCounted is very dangerous.
This change also ensures AutomationProvider is always
constructed and destroyed on the same thread: UI.
There might be other issues caused by running dtor
on the wrong thread.
BUG=71066, 71456
TEST=none
Review URL: http://codereview.chromium.org/6347065
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73328 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/automation/automation_provider.h')
-rw-r--r-- | chrome/browser/automation/automation_provider.h | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/chrome/browser/automation/automation_provider.h b/chrome/browser/automation/automation_provider.h index a10d71a..b3234ff 100644 --- a/chrome/browser/automation/automation_provider.h +++ b/chrome/browser/automation/automation_provider.h @@ -22,6 +22,7 @@ #include "base/scoped_ptr.h" #include "base/string16.h" #include "chrome/browser/autofill/field_types.h" +#include "chrome/browser/browser_thread.h" #include "chrome/browser/cancelable_request.h" #include "chrome/browser/tab_contents/navigation_entry.h" #include "chrome/common/automation_constants.h" @@ -76,9 +77,11 @@ namespace gfx { class Point; } -class AutomationProvider : public base::RefCounted<AutomationProvider>, - public IPC::Channel::Listener, - public IPC::Message::Sender { +class AutomationProvider + : public IPC::Channel::Listener, + public IPC::Message::Sender, + public base::RefCountedThreadSafe<AutomationProvider, + BrowserThread::DeleteOnUIThread> { public: explicit AutomationProvider(Profile* profile); @@ -173,7 +176,8 @@ class AutomationProvider : public base::RefCounted<AutomationProvider>, DictionaryValue* GetDictionaryFromDownloadItem(const DownloadItem* download); protected: - friend class base::RefCounted<AutomationProvider>; + friend class BrowserThread; + friend class DeleteTask<AutomationProvider>; virtual ~AutomationProvider(); // Helper function to find the browser window that contains a given |