| 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 "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "content/browser/appcache/chrome_appcache_service.h" | 8 #include "content/browser/appcache/chrome_appcache_service.h" |
| 9 #include "content/browser/blob_storage/chrome_blob_storage_context.h" | 9 #include "content/browser/blob_storage/chrome_blob_storage_context.h" |
| 10 #include "content/browser/loader/resource_dispatcher_host_impl.h" | 10 #include "content/browser/loader/resource_dispatcher_host_impl.h" |
| (...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 | 81 |
| 82 base::WeakPtr<ResourceMessageFilter> ResourceMessageFilter::GetWeakPtr() { | 82 base::WeakPtr<ResourceMessageFilter> ResourceMessageFilter::GetWeakPtr() { |
| 83 DCHECK(io_thread_task_runner_->BelongsToCurrentThread()); | 83 DCHECK(io_thread_task_runner_->BelongsToCurrentThread()); |
| 84 return is_channel_closed_ ? nullptr : weak_ptr_factory_.GetWeakPtr(); | 84 return is_channel_closed_ ? nullptr : weak_ptr_factory_.GetWeakPtr(); |
| 85 } | 85 } |
| 86 | 86 |
| 87 void ResourceMessageFilter::CreateLoaderAndStart( | 87 void ResourceMessageFilter::CreateLoaderAndStart( |
| 88 mojom::URLLoaderAssociatedRequest request, | 88 mojom::URLLoaderAssociatedRequest request, |
| 89 int32_t routing_id, | 89 int32_t routing_id, |
| 90 int32_t request_id, | 90 int32_t request_id, |
| 91 uint32_t options, |
| 91 const ResourceRequest& url_request, | 92 const ResourceRequest& url_request, |
| 92 mojom::URLLoaderClientPtr client) { | 93 mojom::URLLoaderClientPtr client) { |
| 94 DCHECK_EQ(options, mojom::kURLLoadOptionNone); |
| 93 URLLoaderFactoryImpl::CreateLoaderAndStart( | 95 URLLoaderFactoryImpl::CreateLoaderAndStart( |
| 94 requester_info_.get(), std::move(request), routing_id, request_id, | 96 requester_info_.get(), std::move(request), routing_id, request_id, |
| 95 url_request, std::move(client)); | 97 url_request, std::move(client)); |
| 96 } | 98 } |
| 97 | 99 |
| 98 void ResourceMessageFilter::SyncLoad(int32_t routing_id, | 100 void ResourceMessageFilter::SyncLoad(int32_t routing_id, |
| 99 int32_t request_id, | 101 int32_t request_id, |
| 100 const ResourceRequest& url_request, | 102 const ResourceRequest& url_request, |
| 101 const SyncLoadCallback& callback) { | 103 const SyncLoadCallback& callback) { |
| 102 URLLoaderFactoryImpl::SyncLoad(requester_info_.get(), routing_id, request_id, | 104 URLLoaderFactoryImpl::SyncLoad(requester_info_.get(), routing_id, request_id, |
| 103 url_request, callback); | 105 url_request, callback); |
| 104 } | 106 } |
| 105 | 107 |
| 106 int ResourceMessageFilter::child_id() const { | 108 int ResourceMessageFilter::child_id() const { |
| 107 return requester_info_->child_id(); | 109 return requester_info_->child_id(); |
| 108 } | 110 } |
| 109 | 111 |
| 110 void ResourceMessageFilter::InitializeForTest() { | 112 void ResourceMessageFilter::InitializeForTest() { |
| 111 InitializeOnIOThread(); | 113 InitializeOnIOThread(); |
| 112 } | 114 } |
| 113 | 115 |
| 114 void ResourceMessageFilter::InitializeOnIOThread() { | 116 void ResourceMessageFilter::InitializeOnIOThread() { |
| 115 DCHECK(io_thread_task_runner_->BelongsToCurrentThread()); | 117 DCHECK(io_thread_task_runner_->BelongsToCurrentThread()); |
| 116 // The WeakPtr of the filter must be created on the IO thread. So sets the | 118 // The WeakPtr of the filter must be created on the IO thread. So sets the |
| 117 // WeakPtr of |requester_info_| now. | 119 // WeakPtr of |requester_info_| now. |
| 118 requester_info_->set_filter(GetWeakPtr()); | 120 requester_info_->set_filter(GetWeakPtr()); |
| 119 } | 121 } |
| 120 | 122 |
| 121 } // namespace content | 123 } // namespace content |
| OLD | NEW |