| 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 "base/time/time.h" | 7 #include "base/time/time.h" |
| 8 #include "content/browser/service_worker/service_worker_context_core.h" | 8 #include "content/browser/service_worker/service_worker_context_core.h" |
| 9 #include "content/browser/service_worker/service_worker_provider_host.h" | 9 #include "content/browser/service_worker/service_worker_provider_host.h" |
| 10 #include "content/browser/service_worker/service_worker_read_from_cache_job.h" | 10 #include "content/browser/service_worker/service_worker_read_from_cache_job.h" |
| (...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 102 *original_url_via_service_worker = GURL(); | 102 *original_url_via_service_worker = GURL(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 bool ServiceWorkerContextRequestHandler::ShouldAddToScriptCache( | 105 bool ServiceWorkerContextRequestHandler::ShouldAddToScriptCache( |
| 106 const GURL& url) { | 106 const GURL& url) { |
| 107 // We only write imports that occur during the initial eval. | 107 // We only write imports that occur during the initial eval. |
| 108 if (version_->status() != ServiceWorkerVersion::NEW && | 108 if (version_->status() != ServiceWorkerVersion::NEW && |
| 109 version_->status() != ServiceWorkerVersion::INSTALLING) { | 109 version_->status() != ServiceWorkerVersion::INSTALLING) { |
| 110 return false; | 110 return false; |
| 111 } | 111 } |
| 112 return version_->script_cache_map()->Lookup(url) == | 112 return version_->script_cache_map()->LookupResourceId(url) == |
| 113 kInvalidServiceWorkerResponseId; | 113 kInvalidServiceWorkerResponseId; |
| 114 } | 114 } |
| 115 | 115 |
| 116 bool ServiceWorkerContextRequestHandler::ShouldReadFromScriptCache( | 116 bool ServiceWorkerContextRequestHandler::ShouldReadFromScriptCache( |
| 117 const GURL& url, int64* response_id_out) { | 117 const GURL& url, int64* response_id_out) { |
| 118 // We don't read from the script cache until the version is INSTALLED. | 118 // We don't read from the script cache until the version is INSTALLED. |
| 119 if (version_->status() == ServiceWorkerVersion::NEW || | 119 if (version_->status() == ServiceWorkerVersion::NEW || |
| 120 version_->status() == ServiceWorkerVersion::INSTALLING) | 120 version_->status() == ServiceWorkerVersion::INSTALLING) |
| 121 return false; | 121 return false; |
| 122 *response_id_out = version_->script_cache_map()->Lookup(url); | 122 *response_id_out = version_->script_cache_map()->LookupResourceId(url); |
| 123 return *response_id_out != kInvalidServiceWorkerResponseId; | 123 return *response_id_out != kInvalidServiceWorkerResponseId; |
| 124 } | 124 } |
| 125 | 125 |
| 126 } // namespace content | 126 } // namespace content |
| OLD | NEW |