Chromium Code Reviews| 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 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 68 request, network_delegate, context_, response_id); | 68 request, network_delegate, context_, response_id); |
| 69 } | 69 } |
| 70 | 70 |
| 71 // NULL means use the network. | 71 // NULL means use the network. |
| 72 return NULL; | 72 return NULL; |
| 73 } | 73 } |
| 74 | 74 |
| 75 bool ServiceWorkerContextRequestHandler::ShouldAddToScriptCache( | 75 bool ServiceWorkerContextRequestHandler::ShouldAddToScriptCache( |
| 76 const GURL& url) { | 76 const GURL& url) { |
| 77 // We only write imports that occur during the initial eval. | 77 // We only write imports that occur during the initial eval. |
| 78 if (version_->status() != ServiceWorkerVersion::NEW) | 78 if (version_->status() != ServiceWorkerVersion::NEW && |
| 79 version_->status() != ServiceWorkerVersion::INSTALLING) { | |
|
falken
2014/07/07 07:05:16
I'm curious whether this can be more restrictive?
nhiroki
2014/07/07 08:26:41
I think the both are necessary. Normally the versi
| |
| 79 return false; | 80 return false; |
| 81 } | |
| 80 return version_->script_cache_map()->Lookup(url) == | 82 return version_->script_cache_map()->Lookup(url) == |
| 81 kInvalidServiceWorkerResponseId; | 83 kInvalidServiceWorkerResponseId; |
| 82 } | 84 } |
| 83 | 85 |
| 84 bool ServiceWorkerContextRequestHandler::ShouldReadFromScriptCache( | 86 bool ServiceWorkerContextRequestHandler::ShouldReadFromScriptCache( |
| 85 const GURL& url, int64* response_id_out) { | 87 const GURL& url, int64* response_id_out) { |
| 86 // We don't read from the script cache until the version is INSTALLED. | 88 // We don't read from the script cache until the version is INSTALLED. |
| 87 if (version_->status() == ServiceWorkerVersion::NEW || | 89 if (version_->status() == ServiceWorkerVersion::NEW || |
| 88 version_->status() == ServiceWorkerVersion::INSTALLING) | 90 version_->status() == ServiceWorkerVersion::INSTALLING) |
| 89 return false; | 91 return false; |
| 90 *response_id_out = version_->script_cache_map()->Lookup(url); | 92 *response_id_out = version_->script_cache_map()->Lookup(url); |
| 91 return *response_id_out != kInvalidServiceWorkerResponseId; | 93 return *response_id_out != kInvalidServiceWorkerResponseId; |
| 92 } | 94 } |
| 93 | 95 |
| 94 } // namespace content | 96 } // namespace content |
| OLD | NEW |