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

Unified Diff: content/child/resource_scheduling_filter.cc

Issue 2494493003: Fix ResourceSchedulingFilter crash after ResourceDispatcher deleted (Closed)
Patch Set: Created 4 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 | « content/child/resource_scheduling_filter.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/child/resource_scheduling_filter.cc
diff --git a/content/child/resource_scheduling_filter.cc b/content/child/resource_scheduling_filter.cc
index 9621fe4e08230fc73bdc6d5bcba702143e48d54a..2bcb6943b3613620c9031c6a3f9fd14ea8719883 100644
--- a/content/child/resource_scheduling_filter.cc
+++ b/content/child/resource_scheduling_filter.cc
@@ -18,10 +18,9 @@ ResourceSchedulingFilter::ResourceSchedulingFilter(
const scoped_refptr<base::SingleThreadTaskRunner>& main_thread_task_runner,
ResourceDispatcher* resource_dispatcher)
: main_thread_task_runner_(main_thread_task_runner),
- resource_dispatcher_(resource_dispatcher),
+ resource_dispatcher_(resource_dispatcher->GetWeakPtr()),
weak_ptr_factory_(this) {
DCHECK(main_thread_task_runner_.get());
- DCHECK(resource_dispatcher_);
}
ResourceSchedulingFilter::~ResourceSchedulingFilter() {
@@ -71,7 +70,8 @@ bool ResourceSchedulingFilter::GetSupportedMessageClasses(
}
void ResourceSchedulingFilter::DispatchMessage(const IPC::Message& message) {
- resource_dispatcher_->OnMessageReceived(message);
+ if (resource_dispatcher_)
+ resource_dispatcher_->OnMessageReceived(message);
}
} // namespace content
« no previous file with comments | « content/child/resource_scheduling_filter.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698