OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "content/browser/loader/resource_message_filter.h" | 5 #include "content/browser/loader/resource_message_filter.h" |
6 | 6 |
7 #include "content/browser/appcache/chrome_appcache_service.h" | 7 #include "content/browser/appcache/chrome_appcache_service.h" |
8 #include "content/browser/blob_storage/chrome_blob_storage_context.h" | 8 #include "content/browser/blob_storage/chrome_blob_storage_context.h" |
9 #include "content/browser/host_zoom_level_context.h" | 9 #include "content/browser/host_zoom_level_context.h" |
10 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 10 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 void ResourceMessageFilter::OnChannelClosing() { | 42 void ResourceMessageFilter::OnChannelClosing() { |
43 // Unhook us from all pending network requests so they don't get sent to a | 43 // Unhook us from all pending network requests so they don't get sent to a |
44 // deleted object. | 44 // deleted object. |
45 ResourceDispatcherHostImpl::Get()->CancelRequestsForProcess(child_id_); | 45 ResourceDispatcherHostImpl::Get()->CancelRequestsForProcess(child_id_); |
46 } | 46 } |
47 | 47 |
48 bool ResourceMessageFilter::OnMessageReceived(const IPC::Message& message) { | 48 bool ResourceMessageFilter::OnMessageReceived(const IPC::Message& message) { |
49 return ResourceDispatcherHostImpl::Get()->OnMessageReceived(message, this); | 49 return ResourceDispatcherHostImpl::Get()->OnMessageReceived(message, this); |
50 } | 50 } |
51 | 51 |
| 52 void ResourceMessageFilter::OnDestruct() const { |
| 53 // Destroy the filter on the IO thread since that's where its weak pointers |
| 54 // are being used. |
| 55 BrowserThread::DeleteOnIOThread::Destruct(this); |
| 56 } |
| 57 |
52 void ResourceMessageFilter::GetContexts( | 58 void ResourceMessageFilter::GetContexts( |
53 ResourceType resource_type, | 59 ResourceType resource_type, |
54 int origin_pid, | 60 int origin_pid, |
55 ResourceContext** resource_context, | 61 ResourceContext** resource_context, |
56 net::URLRequestContext** request_context) { | 62 net::URLRequestContext** request_context) { |
57 return get_contexts_callback_.Run(resource_type, origin_pid, resource_context, | 63 return get_contexts_callback_.Run(resource_type, origin_pid, resource_context, |
58 request_context); | 64 request_context); |
59 } | 65 } |
60 | 66 |
61 const HostZoomMap* ResourceMessageFilter::GetHostZoomMap() const { | 67 const HostZoomMap* ResourceMessageFilter::GetHostZoomMap() const { |
62 if (host_zoom_level_context_.get()) | 68 if (host_zoom_level_context_.get()) |
63 return host_zoom_level_context_->GetHostZoomMap(); | 69 return host_zoom_level_context_->GetHostZoomMap(); |
64 return NULL; | 70 return NULL; |
65 } | 71 } |
66 | 72 |
67 base::WeakPtr<ResourceMessageFilter> ResourceMessageFilter::GetWeakPtr() { | 73 base::WeakPtr<ResourceMessageFilter> ResourceMessageFilter::GetWeakPtr() { |
| 74 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
68 return weak_ptr_factory_.GetWeakPtr(); | 75 return weak_ptr_factory_.GetWeakPtr(); |
69 } | 76 } |
70 | 77 |
71 } // namespace content | 78 } // namespace content |
OLD | NEW |