| Index: content/browser/loader/resource_message_filter.cc
|
| diff --git a/content/browser/loader/resource_message_filter.cc b/content/browser/loader/resource_message_filter.cc
|
| index 7fd049eb4034192ded7c7a8ff033e9b92617fe9f..2ee8ff5c7a7b7916dff0d16b123d05fb36f36d6a 100644
|
| --- a/content/browser/loader/resource_message_filter.cc
|
| +++ b/content/browser/loader/resource_message_filter.cc
|
| @@ -27,6 +27,7 @@ ResourceMessageFilter::ResourceMessageFilter(
|
| BrowserAssociatedInterface<mojom::URLLoaderFactory>(this, this),
|
| child_id_(child_id),
|
| process_type_(process_type),
|
| + is_channel_closed_(false),
|
| appcache_service_(appcache_service),
|
| blob_storage_context_(blob_storage_context),
|
| file_system_context_(file_system_context),
|
| @@ -34,12 +35,21 @@ ResourceMessageFilter::ResourceMessageFilter(
|
| get_contexts_callback_(get_contexts_callback),
|
| weak_ptr_factory_(this) {}
|
|
|
| -ResourceMessageFilter::~ResourceMessageFilter() {}
|
| +ResourceMessageFilter::~ResourceMessageFilter() {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| + DCHECK(is_channel_closed_);
|
| + DCHECK(!weak_ptr_factory_.HasWeakPtrs());
|
| +}
|
|
|
| void ResourceMessageFilter::OnChannelClosing() {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| +
|
| // Unhook us from all pending network requests so they don't get sent to a
|
| // deleted object.
|
| ResourceDispatcherHostImpl::Get()->CancelRequestsForProcess(child_id_);
|
| +
|
| + weak_ptr_factory_.InvalidateWeakPtrs();
|
| + is_channel_closed_ = true;
|
| }
|
|
|
| bool ResourceMessageFilter::OnMessageReceived(const IPC::Message& message) {
|
| @@ -62,7 +72,7 @@ void ResourceMessageFilter::GetContexts(
|
|
|
| base::WeakPtr<ResourceMessageFilter> ResourceMessageFilter::GetWeakPtr() {
|
| DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| - return weak_ptr_factory_.GetWeakPtr();
|
| + return is_channel_closed_ ? nullptr : weak_ptr_factory_.GetWeakPtr();
|
| }
|
|
|
| void ResourceMessageFilter::CreateLoaderAndStart(
|
|
|