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

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

Issue 280423005: Adds class ServiceWorkerScriptCacheMap and new ServiceWorkerVersion::Listener methods related to sc… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_script_cache_map.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 "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
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
OLDNEW
« no previous file with comments | « no previous file | content/browser/service_worker/service_worker_script_cache_map.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698