| 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 416dc37faabb6024100b7b30ca09394f63c965df..d38aca76dcd4af34b6d9fdff60810e1b07db09af 100644
|
| --- a/content/browser/loader/resource_message_filter.cc
|
| +++ b/content/browser/loader/resource_message_filter.cc
|
| @@ -46,6 +46,12 @@ bool ResourceMessageFilter::OnMessageReceived(const IPC::Message& message) {
|
| return ResourceDispatcherHostImpl::Get()->OnMessageReceived(message, this);
|
| }
|
|
|
| +void ResourceMessageFilter::OnDestruct() const {
|
| + // Destroy the filter on the IO thread since that's where its weak pointers
|
| + // are being used.
|
| + BrowserThread::DeleteOnIOThread::Destruct(this);
|
| +}
|
| +
|
| void ResourceMessageFilter::GetContexts(
|
| ResourceType resource_type,
|
| int origin_pid,
|
| @@ -55,7 +61,29 @@ void ResourceMessageFilter::GetContexts(
|
| request_context);
|
| }
|
|
|
| +bool ResourceMessageFilter::Send(IPC::Message* message) {
|
| + // We don't support sending synchronous messages from the browser.
|
| + DCHECK(!message->is_sync());
|
| +
|
| + if (!BrowserThread::CurrentlyOn(BrowserThread::IO)) {
|
| + BrowserThread::PostTask(
|
| + BrowserThread::IO, FROM_HERE,
|
| + base::Bind(base::IgnoreResult(&ResourceMessageFilter::Send), this,
|
| + message));
|
| + return true;
|
| + }
|
| +
|
| + if (ResourceDispatcherHostImpl::Get()->SendWithMojoIfPossible(*message,
|
| + this)) {
|
| + delete message;
|
| + return true;
|
| + }
|
| +
|
| + return BrowserMessageFilter::Send(message);
|
| +}
|
| +
|
| base::WeakPtr<ResourceMessageFilter> ResourceMessageFilter::GetWeakPtr() {
|
| + DCHECK_CURRENTLY_ON(BrowserThread::IO);
|
| return weak_ptr_factory_.GetWeakPtr();
|
| }
|
|
|
|
|