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

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: Fixed crash where writer_ was null 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
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_database.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
OLDNEW
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_database.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698