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

Unified Diff: ppapi/host/resource_message_filter.h

Issue 53153002: Pepper: always delete ResourceMessageFilter objects on the creation thread. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 1 month 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
« no previous file with comments | « no previous file | ppapi/host/resource_message_filter.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/host/resource_message_filter.h
diff --git a/ppapi/host/resource_message_filter.h b/ppapi/host/resource_message_filter.h
index ef00cf7ae22f7ee33430b9cfa48c46ca7f532591..b72a7df7db286fb8a2d1c7dff6c6e0d217286e45 100644
--- a/ppapi/host/resource_message_filter.h
+++ b/ppapi/host/resource_message_filter.h
@@ -24,6 +24,15 @@ namespace ppapi {
namespace host {
class ResourceHost;
+class ResourceMessageFilter;
+
+namespace internal {
+
+struct PPAPI_HOST_EXPORT ResourceMessageFilterDeleteTraits {
+ static void Destruct(const ResourceMessageFilter* filter);
+};
+
+} // namespace internal
// This is the base class of resource message filters that can handle resource
// messages on another thread. ResourceHosts can handle most messages
@@ -65,13 +74,15 @@ class ResourceHost;
// AddFilter(make_scoped_refptr(new MyMessageFilter));
class PPAPI_HOST_EXPORT ResourceMessageFilter
: public ResourceMessageHandler,
- public base::RefCountedThreadSafe<ResourceMessageFilter> {
+ public base::RefCountedThreadSafe<
+ ResourceMessageFilter, internal::ResourceMessageFilterDeleteTraits> {
public:
// This object must be constructed on the same thread that a reply message
// should be sent, i.e. the IO thread when constructed in the browser process
// or the main thread when constructed in the renderer process. Since
// ResourceMessageFilters are usually constructed in the constructor of the
// owning ResourceHost, this will almost always be the case anyway.
+ // The object will be deleted on the creation thread.
ResourceMessageFilter();
// Test constructor. Allows you to specify the message loop which will be used
// to dispatch replies on.
@@ -93,7 +104,6 @@ class PPAPI_HOST_EXPORT ResourceMessageFilter
const IPC::Message& msg) OVERRIDE;
protected:
- friend class base::RefCountedThreadSafe<ResourceMessageFilter>;
virtual ~ResourceMessageFilter();
// If you want the message to be handled on another thread, return a non-null
@@ -102,10 +112,17 @@ class PPAPI_HOST_EXPORT ResourceMessageFilter
const IPC::Message& message);
private:
+ friend class base::DeleteHelper<ResourceMessageFilter>;
+ friend class base::RefCountedThreadSafe<
+ ResourceMessageFilter, internal::ResourceMessageFilterDeleteTraits>;
+ friend struct internal::ResourceMessageFilterDeleteTraits;
+
// This method is posted to the target thread and runs the message handler.
void DispatchMessage(const IPC::Message& msg,
HostMessageContext context);
+ scoped_refptr<base::MessageLoopProxy> deletion_message_loop_proxy_;
+
// Message loop to send resource message replies on. This will be the message
// loop proxy of the IO thread for the browser process or the main thread for
// the renderer process.
« no previous file with comments | « no previous file | ppapi/host/resource_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698