| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/service_worker/service_worker_context_request_handler.
h" | 5 #include "content/browser/service_worker/service_worker_context_request_handler.
h" |
| 6 | 6 |
| 7 #include "content/browser/service_worker/service_worker_context_core.h" | 7 #include "content/browser/service_worker/service_worker_context_core.h" |
| 8 #include "content/browser/service_worker/service_worker_provider_host.h" | 8 #include "content/browser/service_worker/service_worker_provider_host.h" |
| 9 #include "content/browser/service_worker/service_worker_read_from_cache_job.h" | 9 #include "content/browser/service_worker/service_worker_read_from_cache_job.h" |
| 10 #include "content/browser/service_worker/service_worker_storage.h" | 10 #include "content/browser/service_worker/service_worker_storage.h" |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 : ServiceWorkerRequestHandler(context, provider_host, resource_type), | 21 : ServiceWorkerRequestHandler(context, provider_host, resource_type), |
| 22 version_(provider_host_->running_hosted_version()) { | 22 version_(provider_host_->running_hosted_version()) { |
| 23 DCHECK(provider_host_->IsHostToRunningServiceWorker()); | 23 DCHECK(provider_host_->IsHostToRunningServiceWorker()); |
| 24 } | 24 } |
| 25 | 25 |
| 26 ServiceWorkerContextRequestHandler::~ServiceWorkerContextRequestHandler() { | 26 ServiceWorkerContextRequestHandler::~ServiceWorkerContextRequestHandler() { |
| 27 } | 27 } |
| 28 | 28 |
| 29 net::URLRequestJob* ServiceWorkerContextRequestHandler::MaybeCreateJob( | 29 net::URLRequestJob* ServiceWorkerContextRequestHandler::MaybeCreateJob( |
| 30 net::URLRequest* request, | 30 net::URLRequest* request, |
| 31 net::NetworkDelegate* network_delegate) { | 31 net::NetworkDelegate* network_delegate, |
| 32 const scoped_refptr<ChromeBlobStorageContext>& blog_storage_context) { |
| 32 if (!provider_host_ || !version_ || !context_) | 33 if (!provider_host_ || !version_ || !context_) |
| 33 return NULL; | 34 return NULL; |
| 34 | 35 |
| 35 // We currently have no use case for hijacking a redirected request. | 36 // We currently have no use case for hijacking a redirected request. |
| 36 if (request->url_chain().size() > 1) | 37 if (request->url_chain().size() > 1) |
| 37 return NULL; | 38 return NULL; |
| 38 | 39 |
| 39 // We only use the script cache for main script loading and | 40 // We only use the script cache for main script loading and |
| 40 // importScripts(), even if a cached script is xhr'd, we don't | 41 // importScripts(), even if a cached script is xhr'd, we don't |
| 41 // retrieve it from the script cache. | 42 // retrieve it from the script cache. |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 77 const GURL& url, int64* response_id_out) { | 78 const GURL& url, int64* response_id_out) { |
| 78 // We don't read from the script cache until the version is INSTALLED. | 79 // We don't read from the script cache until the version is INSTALLED. |
| 79 if (version_->status() == ServiceWorkerVersion::NEW || | 80 if (version_->status() == ServiceWorkerVersion::NEW || |
| 80 version_->status() == ServiceWorkerVersion::INSTALLING) | 81 version_->status() == ServiceWorkerVersion::INSTALLING) |
| 81 return false; | 82 return false; |
| 82 *response_id_out = version_->script_cache_map()->Lookup(url); | 83 *response_id_out = version_->script_cache_map()->Lookup(url); |
| 83 return *response_id_out != kInvalidServiceWorkerResponseId; | 84 return *response_id_out != kInvalidServiceWorkerResponseId; |
| 84 } | 85 } |
| 85 | 86 |
| 86 } // namespace content | 87 } // namespace content |
| OLD | NEW |