| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/appcache/appcache_request_handler.h" | 5 #include "content/browser/appcache/appcache_request_handler.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "content/browser/appcache/appcache.h" | 10 #include "content/browser/appcache/appcache.h" |
| 11 #include "content/browser/appcache/appcache_backend_impl.h" | 11 #include "content/browser/appcache/appcache_backend_impl.h" |
| 12 #include "content/browser/appcache/appcache_network_service_handler.h" |
| 12 #include "content/browser/appcache/appcache_policy.h" | 13 #include "content/browser/appcache/appcache_policy.h" |
| 13 #include "content/browser/appcache/appcache_request.h" | 14 #include "content/browser/appcache/appcache_request.h" |
| 14 #include "content/browser/appcache/appcache_url_request_job.h" | 15 #include "content/browser/appcache/appcache_url_request_job.h" |
| 15 #include "content/browser/service_worker/service_worker_request_handler.h" | 16 #include "content/browser/service_worker/service_worker_request_handler.h" |
| 16 #include "net/url_request/url_request.h" | 17 #include "net/url_request/url_request.h" |
| 17 #include "net/url_request/url_request_job.h" | 18 #include "net/url_request/url_request_job.h" |
| 18 | 19 |
| 19 namespace content { | 20 namespace content { |
| 20 | 21 |
| 21 AppCacheRequestHandler::AppCacheRequestHandler( | 22 AppCacheRequestHandler::AppCacheRequestHandler( |
| (...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 216 | 217 |
| 217 void AppCacheRequestHandler::MaybeCompleteCrossSiteTransferInOldProcess( | 218 void AppCacheRequestHandler::MaybeCompleteCrossSiteTransferInOldProcess( |
| 218 int old_process_id) { | 219 int old_process_id) { |
| 219 if (!host_ || !host_for_cross_site_transfer_.get() || | 220 if (!host_ || !host_for_cross_site_transfer_.get() || |
| 220 old_process_id != old_process_id_) { | 221 old_process_id != old_process_id_) { |
| 221 return; | 222 return; |
| 222 } | 223 } |
| 223 CompleteCrossSiteTransfer(old_process_id_, old_host_id_); | 224 CompleteCrossSiteTransfer(old_process_id_, old_host_id_); |
| 224 } | 225 } |
| 225 | 226 |
| 227 // static. |
| 228 void AppCacheRequestHandler::InitializeForNavigationNetworkService( |
| 229 std::unique_ptr<ResourceRequest> resource_request, |
| 230 ResourceContext* resource_context, |
| 231 AppCacheNavigationHandleCore* navigation_handle_core, |
| 232 ResourceType resource_type, |
| 233 base::Callback<void(mojom::URLLoaderFactoryPtrInfo, |
| 234 std::unique_ptr<ResourceRequest>)> callback) { |
| 235 // This instance is deleted when it receives a callback from the |
| 236 // AppCacheStorage class which contains information about the AppCache |
| 237 // status for the URL being served by the |resource_request|. |
| 238 AppCacheNetworkServiceHandler* network_service_handler = |
| 239 new AppCacheNetworkServiceHandler( |
| 240 std::move(resource_request), resource_context, navigation_handle_core, |
| 241 resource_type, callback); |
| 242 network_service_handler->Start(); |
| 243 } |
| 244 |
| 226 void AppCacheRequestHandler::OnDestructionImminent(AppCacheHost* host) { | 245 void AppCacheRequestHandler::OnDestructionImminent(AppCacheHost* host) { |
| 227 storage()->CancelDelegateCallbacks(this); | 246 storage()->CancelDelegateCallbacks(this); |
| 228 host_ = NULL; // no need to RemoveObserver, the host is being deleted | 247 host_ = NULL; // no need to RemoveObserver, the host is being deleted |
| 229 | 248 |
| 230 // Since the host is being deleted, we don't have to complete any job | 249 // Since the host is being deleted, we don't have to complete any job |
| 231 // that is current running. It's destined for the bit bucket anyway. | 250 // that is current running. It's destined for the bit bucket anyway. |
| 232 if (job_.get()) { | 251 if (job_.get()) { |
| 233 job_->Kill(); | 252 job_->Kill(); |
| 234 job_.reset(); | 253 job_.reset(); |
| 235 } | 254 } |
| (...skipping 261 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 497 if (!host_->associated_cache() || | 516 if (!host_->associated_cache() || |
| 498 !host_->associated_cache()->is_complete()) { | 517 !host_->associated_cache()->is_complete()) { |
| 499 DeliverNetworkResponse(); | 518 DeliverNetworkResponse(); |
| 500 return; | 519 return; |
| 501 } | 520 } |
| 502 | 521 |
| 503 ContinueMaybeLoadSubResource(); | 522 ContinueMaybeLoadSubResource(); |
| 504 } | 523 } |
| 505 | 524 |
| 506 } // namespace content | 525 } // namespace content |
| OLD | NEW |