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_provider_host.h" | 7 #include "content/browser/service_worker/service_worker_provider_host.h" |
8 #include "content/browser/service_worker/service_worker_read_from_cache_job.h" | 8 #include "content/browser/service_worker/service_worker_read_from_cache_job.h" |
9 #include "content/browser/service_worker/service_worker_version.h" | 9 #include "content/browser/service_worker/service_worker_version.h" |
10 #include "net/url_request/url_request.h" | 10 #include "net/url_request/url_request.h" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 // NULL means use the network. | 53 // NULL means use the network. |
54 return NULL; | 54 return NULL; |
55 } | 55 } |
56 | 56 |
57 bool ServiceWorkerContextRequestHandler::ShouldAddToScriptCache( | 57 bool ServiceWorkerContextRequestHandler::ShouldAddToScriptCache( |
58 const GURL& url) { | 58 const GURL& url) { |
59 // TODO(michaeln): Ensure the transition to INSTALLING can't | 59 // TODO(michaeln): Ensure the transition to INSTALLING can't |
60 // happen prior to the initial eval completion. | 60 // happen prior to the initial eval completion. |
61 if (version_->status() != ServiceWorkerVersion::NEW) | 61 if (version_->status() != ServiceWorkerVersion::NEW) |
62 return false; | 62 return false; |
63 return version_->LookupInScriptCache(url) == kInvalidServiceWorkerResponseId; | 63 return version_->script_cache_map()->Lookup(url) == |
| 64 kInvalidServiceWorkerResponseId; |
64 } | 65 } |
65 | 66 |
66 bool ServiceWorkerContextRequestHandler::ShouldReadFromScriptCache( | 67 bool ServiceWorkerContextRequestHandler::ShouldReadFromScriptCache( |
67 const GURL& url, int64* response_id_out) { | 68 const GURL& url, int64* response_id_out) { |
68 // We don't read from the script cache until the version is INSTALLED. | 69 // We don't read from the script cache until the version is INSTALLED. |
69 if (version_->status() == ServiceWorkerVersion::NEW || | 70 if (version_->status() == ServiceWorkerVersion::NEW || |
70 version_->status() == ServiceWorkerVersion::INSTALLING) | 71 version_->status() == ServiceWorkerVersion::INSTALLING) |
71 return false; | 72 return false; |
72 *response_id_out = version_->LookupInScriptCache(url); | 73 *response_id_out = version_->script_cache_map()->Lookup(url); |
73 return *response_id_out != kInvalidServiceWorkerResponseId; | 74 return *response_id_out != kInvalidServiceWorkerResponseId; |
74 } | 75 } |
75 | 76 |
76 } // namespace content | 77 } // namespace content |
OLD | NEW |