Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(376)

Side by Side Diff: content/browser/service_worker/service_worker_context_request_handler.cc

Issue 647953003: Service Worker script sizes in database. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git/+/master
Patch Set: Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 *original_url_via_service_worker = GURL(); 100 *original_url_via_service_worker = GURL();
101 } 101 }
102 102
103 bool ServiceWorkerContextRequestHandler::ShouldAddToScriptCache( 103 bool ServiceWorkerContextRequestHandler::ShouldAddToScriptCache(
104 const GURL& url) { 104 const GURL& url) {
105 // We only write imports that occur during the initial eval. 105 // We only write imports that occur during the initial eval.
106 if (version_->status() != ServiceWorkerVersion::NEW && 106 if (version_->status() != ServiceWorkerVersion::NEW &&
107 version_->status() != ServiceWorkerVersion::INSTALLING) { 107 version_->status() != ServiceWorkerVersion::INSTALLING) {
108 return false; 108 return false;
109 } 109 }
110 return version_->script_cache_map()->Lookup(url) == 110 return version_->script_cache_map()->LookupResourceId(url) ==
111 kInvalidServiceWorkerResponseId; 111 kInvalidServiceWorkerResponseId;
112 } 112 }
113 113
114 bool ServiceWorkerContextRequestHandler::ShouldReadFromScriptCache( 114 bool ServiceWorkerContextRequestHandler::ShouldReadFromScriptCache(
115 const GURL& url, int64* response_id_out) { 115 const GURL& url, int64* response_id_out) {
116 // We don't read from the script cache until the version is INSTALLED. 116 // We don't read from the script cache until the version is INSTALLED.
117 if (version_->status() == ServiceWorkerVersion::NEW || 117 if (version_->status() == ServiceWorkerVersion::NEW ||
118 version_->status() == ServiceWorkerVersion::INSTALLING) 118 version_->status() == ServiceWorkerVersion::INSTALLING)
119 return false; 119 return false;
120 *response_id_out = version_->script_cache_map()->Lookup(url); 120 *response_id_out = version_->script_cache_map()->LookupResourceId(url);
121 return *response_id_out != kInvalidServiceWorkerResponseId; 121 return *response_id_out != kInvalidServiceWorkerResponseId;
122 } 122 }
123 123
124 } // namespace content 124 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698