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

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

Issue 603913002: [ServiceWorker] Add was_fallback_required flag to ResourceResponseInfo. [2/2 chromium] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: s/which/whose/ 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 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 return new ServiceWorkerReadFromCacheJob( 83 return new ServiceWorkerReadFromCacheJob(
84 request, network_delegate, context_, response_id); 84 request, network_delegate, context_, response_id);
85 } 85 }
86 86
87 // NULL means use the network. 87 // NULL means use the network.
88 return NULL; 88 return NULL;
89 } 89 }
90 90
91 void ServiceWorkerContextRequestHandler::GetExtraResponseInfo( 91 void ServiceWorkerContextRequestHandler::GetExtraResponseInfo(
92 bool* was_fetched_via_service_worker, 92 bool* was_fetched_via_service_worker,
93 bool* was_fallback_required_by_service_worker,
93 GURL* original_url_via_service_worker, 94 GURL* original_url_via_service_worker,
94 base::TimeTicks* fetch_start_time, 95 base::TimeTicks* fetch_start_time,
95 base::TimeTicks* fetch_ready_time, 96 base::TimeTicks* fetch_ready_time,
96 base::TimeTicks* fetch_end_time) const { 97 base::TimeTicks* fetch_end_time) const {
97 *was_fetched_via_service_worker = false; 98 *was_fetched_via_service_worker = false;
99 *was_fallback_required_by_service_worker = false;
98 *original_url_via_service_worker = GURL(); 100 *original_url_via_service_worker = GURL();
99 } 101 }
100 102
101 bool ServiceWorkerContextRequestHandler::ShouldAddToScriptCache( 103 bool ServiceWorkerContextRequestHandler::ShouldAddToScriptCache(
102 const GURL& url) { 104 const GURL& url) {
103 // We only write imports that occur during the initial eval. 105 // We only write imports that occur during the initial eval.
104 if (version_->status() != ServiceWorkerVersion::NEW && 106 if (version_->status() != ServiceWorkerVersion::NEW &&
105 version_->status() != ServiceWorkerVersion::INSTALLING) { 107 version_->status() != ServiceWorkerVersion::INSTALLING) {
106 return false; 108 return false;
107 } 109 }
108 return version_->script_cache_map()->Lookup(url) == 110 return version_->script_cache_map()->Lookup(url) ==
109 kInvalidServiceWorkerResponseId; 111 kInvalidServiceWorkerResponseId;
110 } 112 }
111 113
112 bool ServiceWorkerContextRequestHandler::ShouldReadFromScriptCache( 114 bool ServiceWorkerContextRequestHandler::ShouldReadFromScriptCache(
113 const GURL& url, int64* response_id_out) { 115 const GURL& url, int64* response_id_out) {
114 // 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.
115 if (version_->status() == ServiceWorkerVersion::NEW || 117 if (version_->status() == ServiceWorkerVersion::NEW ||
116 version_->status() == ServiceWorkerVersion::INSTALLING) 118 version_->status() == ServiceWorkerVersion::INSTALLING)
117 return false; 119 return false;
118 *response_id_out = version_->script_cache_map()->Lookup(url); 120 *response_id_out = version_->script_cache_map()->Lookup(url);
119 return *response_id_out != kInvalidServiceWorkerResponseId; 121 return *response_id_out != kInvalidServiceWorkerResponseId;
120 } 122 }
121 123
122 } // namespace content 124 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698