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

Unified Diff: ppapi/host/resource_message_filter.cc

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 | « ppapi/host/resource_message_filter.h ('k') | ppapi/host/resource_message_filter_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/host/resource_message_filter.cc
diff --git a/ppapi/host/resource_message_filter.cc b/ppapi/host/resource_message_filter.cc
index ff56cac8c46279759d9b207bb1205a502faf2034..1757ad50bbfe0e5ecdfce9745deee79889d9e723 100644
--- a/ppapi/host/resource_message_filter.cc
+++ b/ppapi/host/resource_message_filter.cc
@@ -16,14 +16,35 @@
namespace ppapi {
namespace host {
+namespace internal {
+
+// static
+void ResourceMessageFilterDeleteTraits::Destruct(
+ const ResourceMessageFilter* filter) {
+ if (!filter->deletion_message_loop_proxy_->BelongsToCurrentThread()) {
+ // During shutdown the object may not be deleted, but it should be okay to
+ // leak in that case.
+ filter->deletion_message_loop_proxy_->DeleteSoon(FROM_HERE, filter);
+ } else {
+ delete filter;
+ }
+}
+
+} // namespace internal
+
ResourceMessageFilter::ResourceMessageFilter()
- : reply_thread_message_loop_proxy_(
+ : deletion_message_loop_proxy_(
base::MessageLoop::current()->message_loop_proxy()),
- resource_host_(NULL) {}
+ reply_thread_message_loop_proxy_(
+ base::MessageLoop::current()->message_loop_proxy()),
+ resource_host_(NULL) {
+}
ResourceMessageFilter::ResourceMessageFilter(
scoped_refptr<base::MessageLoopProxy> reply_thread_message_loop_proxy)
- : reply_thread_message_loop_proxy_(reply_thread_message_loop_proxy),
+ : deletion_message_loop_proxy_(
+ base::MessageLoop::current()->message_loop_proxy()),
+ reply_thread_message_loop_proxy_(reply_thread_message_loop_proxy),
resource_host_(NULL) {
}
« no previous file with comments | « ppapi/host/resource_message_filter.h ('k') | ppapi/host/resource_message_filter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698