diff options
author | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-21 19:31:14 +0000 |
---|---|---|
committer | jam@chromium.org <jam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-21 19:31:14 +0000 |
commit | 76b70f91d71f6e36489dd5c9876a54e65af46f7c (patch) | |
tree | c14dfd7cf8eab67080de557ffce07feff63103a9 /content/browser/plugin_data_remover_impl.h | |
parent | d3bc7eeb717e2af49f244777bdd34e6d276157b1 (diff) | |
download | chromium_src-76b70f91d71f6e36489dd5c9876a54e65af46f7c.zip chromium_src-76b70f91d71f6e36489dd5c9876a54e65af46f7c.tar.gz chromium_src-76b70f91d71f6e36489dd5c9876a54e65af46f7c.tar.bz2 |
Fix race in PluginDataRemoverImpl going away while it's still being used on the IO thread, which was introduced in 110530. This also fix the incorrect usage of PluginService::OpenChannelToNpapiPlugin on the UI thread which existed before.
BUG=104553,cros:23179
Review URL: http://codereview.chromium.org/8603012
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@110979 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/browser/plugin_data_remover_impl.h')
-rw-r--r-- | content/browser/plugin_data_remover_impl.h | 50 |
1 files changed, 7 insertions, 43 deletions
diff --git a/content/browser/plugin_data_remover_impl.h b/content/browser/plugin_data_remover_impl.h index 248f9a5..881f998 100644 --- a/content/browser/plugin_data_remover_impl.h +++ b/content/browser/plugin_data_remover_impl.h @@ -9,14 +9,10 @@ #include <string> #include "base/compiler_specific.h" -#include "base/memory/weak_ptr.h" -#include "content/browser/plugin_process_host.h" +#include "base/memory/ref_counted.h" #include "content/public/browser/plugin_data_remover.h" -class CONTENT_EXPORT PluginDataRemoverImpl - : public content::PluginDataRemover, - public NON_EXPORTED_BASE(PluginProcessHost::Client), - public IPC::Channel::Listener { +class CONTENT_EXPORT PluginDataRemoverImpl : public content::PluginDataRemover { public: explicit PluginDataRemoverImpl( const content::ResourceContext& resource_context); @@ -30,48 +26,16 @@ class CONTENT_EXPORT PluginDataRemoverImpl // different plug-in (for example in tests). void set_mime_type(const std::string& mime_type) { mime_type_ = mime_type; } - // PluginProcessHost::Client methods. - virtual int ID() OVERRIDE; - virtual bool OffTheRecord() OVERRIDE; - virtual const content::ResourceContext& GetResourceContext() OVERRIDE; - virtual void SetPluginInfo(const webkit::WebPluginInfo& info) OVERRIDE; - virtual void OnFoundPluginProcessHost(PluginProcessHost* host) OVERRIDE; - virtual void OnSentPluginChannelRequest() OVERRIDE; - virtual void OnChannelOpened(const IPC::ChannelHandle& handle) OVERRIDE; - virtual void OnError() OVERRIDE; - - // IPC::Channel::Listener methods. - virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; - virtual void OnChannelError() OVERRIDE; - private: - // Signals that we are finished with removing data (successful or not). This - // method is safe to call multiple times. - void SignalDone(); - // Connects the client side of a newly opened plug-in channel. - void ConnectToChannel(const IPC::ChannelHandle& handle); - // Handles the PluginHostMsg_ClearSiteDataResult message. - void OnClearSiteDataResult(bool success); - // Called when a timeout happens in order not to block the client - // indefinitely. - void OnTimeout(); + class Context; std::string mime_type_; - bool is_starting_process_; - bool is_removing_; - // The point in time when we start removing data. - base::Time remove_start_time_; - // The point in time from which on we remove data. - base::Time begin_time_; // The resource context for the profile. - const content::ResourceContext& context_; - scoped_ptr<base::WaitableEvent> event_; - // We own the channel, but it's used on the IO thread, so it needs to be - // deleted there. It's NULL until we have opened a connection to the plug-in - // process. - IPC::Channel* channel_; + const content::ResourceContext& resource_context_; - base::WeakPtrFactory<PluginDataRemoverImpl> weak_factory_; + // This allows this object to be deleted on the UI thread while it's still + // being used on the IO thread. + scoped_refptr<Context> context_; DISALLOW_COPY_AND_ASSIGN(PluginDataRemoverImpl); }; |