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 ResourceContext** resource_context, | 60 ResourceContext** resource_context, |
55 net::URLRequestContext** request_context) { | 61 net::URLRequestContext** request_context) { |
56 return get_contexts_callback_.Run(resource_type, resource_context, | 62 return get_contexts_callback_.Run(resource_type, resource_context, |
57 request_context); | 63 request_context); |
58 } | 64 } |
59 | 65 |
60 const HostZoomMap* ResourceMessageFilter::GetHostZoomMap() const { | 66 const HostZoomMap* ResourceMessageFilter::GetHostZoomMap() const { |
61 if (host_zoom_level_context_.get()) | 67 if (host_zoom_level_context_.get()) |
62 return host_zoom_level_context_->GetHostZoomMap(); | 68 return host_zoom_level_context_->GetHostZoomMap(); |
63 return NULL; | 69 return NULL; |
64 } | 70 } |
65 | 71 |
66 base::WeakPtr<ResourceMessageFilter> ResourceMessageFilter::GetWeakPtr() { | 72 base::WeakPtr<ResourceMessageFilter> ResourceMessageFilter::GetWeakPtr() { |
| 73 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
67 return weak_ptr_factory_.GetWeakPtr(); | 74 return weak_ptr_factory_.GetWeakPtr(); |
68 } | 75 } |
69 | 76 |
70 } // namespace content | 77 } // namespace content |
OLD | NEW |