OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/appcache/appcache_request_handler.h" | 5 #include "content/browser/appcache/appcache_request_handler.h" |
6 | 6 |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "content/browser/appcache/appcache.h" | 10 #include "content/browser/appcache/appcache.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
51 } | 51 } |
52 if (service_) | 52 if (service_) |
53 service_->RemoveObserver(this); | 53 service_->RemoveObserver(this); |
54 } | 54 } |
55 | 55 |
56 AppCacheStorage* AppCacheRequestHandler::storage() const { | 56 AppCacheStorage* AppCacheRequestHandler::storage() const { |
57 DCHECK(host_); | 57 DCHECK(host_); |
58 return host_->storage(); | 58 return host_->storage(); |
59 } | 59 } |
60 | 60 |
61 AppCacheURLRequestJob* AppCacheRequestHandler::MaybeLoadResource( | 61 AppCacheJob* AppCacheRequestHandler::MaybeLoadResource( |
62 net::NetworkDelegate* network_delegate) { | 62 net::NetworkDelegate* network_delegate) { |
63 maybe_load_resource_executed_ = true; | 63 maybe_load_resource_executed_ = true; |
64 if (!host_ || | 64 if (!host_ || |
65 !AppCacheRequest::IsSchemeAndMethodSupportedForAppCache(request_.get()) || | 65 !AppCacheRequest::IsSchemeAndMethodSupportedForAppCache(request_.get()) || |
66 cache_entry_not_found_) { | 66 cache_entry_not_found_) { |
67 return NULL; | 67 return NULL; |
68 } | 68 } |
69 | 69 |
70 // This method can get called multiple times over the life | 70 // This method can get called multiple times over the life |
71 // of a request. The case we detect here is having scheduled | 71 // of a request. The case we detect here is having scheduled |
72 // delivery of a "network response" using a job set up on an | 72 // delivery of a "network response" using a job set up on an |
73 // earlier call through this method. To send the request through | 73 // earlier call through this method. To send the request through |
74 // to the network involves restarting the request altogether, | 74 // to the network involves restarting the request altogether, |
75 // which will call through to our interception layer again. | 75 // which will call through to our interception layer again. |
76 // This time through, we return NULL so the request hits the wire. | 76 // This time through, we return NULL so the request hits the wire. |
77 if (is_delivering_network_response_) { | 77 if (is_delivering_network_response_) { |
78 is_delivering_network_response_ = false; | 78 is_delivering_network_response_ = false; |
79 return NULL; | 79 return NULL; |
80 } | 80 } |
81 | 81 |
82 // Clear out our 'found' fields since we're starting a request for a | 82 // Clear out our 'found' fields since we're starting a request for a |
83 // new resource, any values in those fields are no longer valid. | 83 // new resource, any values in those fields are no longer valid. |
84 found_entry_ = AppCacheEntry(); | 84 found_entry_ = AppCacheEntry(); |
85 found_fallback_entry_ = AppCacheEntry(); | 85 found_fallback_entry_ = AppCacheEntry(); |
86 found_cache_id_ = kAppCacheNoCacheId; | 86 found_cache_id_ = kAppCacheNoCacheId; |
87 found_manifest_url_ = GURL(); | 87 found_manifest_url_ = GURL(); |
88 found_network_namespace_ = false; | 88 found_network_namespace_ = false; |
89 | 89 |
90 std::unique_ptr<AppCacheURLRequestJob> job; | 90 std::unique_ptr<AppCacheJob> job; |
91 if (is_main_resource()) | 91 if (is_main_resource()) |
92 job = MaybeLoadMainResource(network_delegate); | 92 job = MaybeLoadMainResource(network_delegate); |
93 else | 93 else |
94 job = MaybeLoadSubResource(network_delegate); | 94 job = MaybeLoadSubResource(network_delegate); |
95 | 95 |
96 // If its been setup to deliver a network response, we can just delete | 96 // If its been setup to deliver a network response, we can just delete |
97 // it now and return NULL instead to achieve that since it couldn't | 97 // it now and return NULL instead to achieve that since it couldn't |
98 // have been started yet. | 98 // have been started yet. |
99 if (job && job->is_delivering_network_response()) { | 99 if (job && job->IsDeliveringNetworkResponse()) { |
100 DCHECK(!job->has_been_started()); | 100 DCHECK(!job->IsStarted()); |
101 job.reset(); | 101 job.reset(); |
102 } | 102 } |
103 | 103 |
104 return job.release(); | 104 return job.release(); |
105 } | 105 } |
106 | 106 |
107 AppCacheURLRequestJob* AppCacheRequestHandler::MaybeLoadFallbackForRedirect( | 107 AppCacheJob* AppCacheRequestHandler::MaybeLoadFallbackForRedirect( |
108 net::NetworkDelegate* network_delegate, | 108 net::NetworkDelegate* network_delegate, |
109 const GURL& location) { | 109 const GURL& location) { |
110 if (!host_ || | 110 if (!host_ || |
111 !AppCacheRequest::IsSchemeAndMethodSupportedForAppCache(request_.get()) || | 111 !AppCacheRequest::IsSchemeAndMethodSupportedForAppCache(request_.get()) || |
112 cache_entry_not_found_) | 112 cache_entry_not_found_) |
113 return NULL; | 113 return NULL; |
114 if (is_main_resource()) | 114 if (is_main_resource()) |
115 return NULL; | 115 return NULL; |
116 // TODO(vabr) This is a temporary fix (see crbug/141114). We should get rid of | 116 // TODO(vabr) This is a temporary fix (see crbug/141114). We should get rid of |
117 // it once a more general solution to crbug/121325 is in place. | 117 // it once a more general solution to crbug/121325 is in place. |
118 if (!maybe_load_resource_executed_) | 118 if (!maybe_load_resource_executed_) |
119 return NULL; | 119 return NULL; |
120 if (request_->GetURL().GetOrigin() == location.GetOrigin()) | 120 if (request_->GetURL().GetOrigin() == location.GetOrigin()) |
121 return NULL; | 121 return NULL; |
122 | 122 |
123 DCHECK(!job_.get()); // our jobs never generate redirects | 123 DCHECK(!job_.get()); // our jobs never generate redirects |
124 | 124 |
125 std::unique_ptr<AppCacheURLRequestJob> job; | 125 std::unique_ptr<AppCacheJob> job; |
126 if (found_fallback_entry_.has_response_id()) { | 126 if (found_fallback_entry_.has_response_id()) { |
127 // 6.9.6, step 4: If this results in a redirect to another origin, | 127 // 6.9.6, step 4: If this results in a redirect to another origin, |
128 // get the resource of the fallback entry. | 128 // get the resource of the fallback entry. |
129 job = CreateJob(network_delegate); | 129 job = CreateJob(network_delegate); |
130 DeliverAppCachedResponse(found_fallback_entry_, found_cache_id_, | 130 DeliverAppCachedResponse(found_fallback_entry_, found_cache_id_, |
131 found_manifest_url_, true, | 131 found_manifest_url_, true, |
132 found_namespace_entry_url_); | 132 found_namespace_entry_url_); |
133 } else if (!found_network_namespace_) { | 133 } else if (!found_network_namespace_) { |
134 // 6.9.6, step 6: Fail the resource load. | 134 // 6.9.6, step 6: Fail the resource load. |
135 job = CreateJob(network_delegate); | 135 job = CreateJob(network_delegate); |
136 DeliverErrorResponse(); | 136 DeliverErrorResponse(); |
137 } else { | 137 } else { |
138 // 6.9.6 step 3 and 5: Fetch the resource normally. | 138 // 6.9.6 step 3 and 5: Fetch the resource normally. |
139 } | 139 } |
140 | 140 |
141 return job.release(); | 141 return job.release(); |
142 } | 142 } |
143 | 143 |
144 AppCacheURLRequestJob* AppCacheRequestHandler::MaybeLoadFallbackForResponse( | 144 AppCacheJob* AppCacheRequestHandler::MaybeLoadFallbackForResponse( |
145 net::NetworkDelegate* network_delegate) { | 145 net::NetworkDelegate* network_delegate) { |
146 if (!host_ || | 146 if (!host_ || |
147 !AppCacheRequest::IsSchemeAndMethodSupportedForAppCache(request_.get()) || | 147 !AppCacheRequest::IsSchemeAndMethodSupportedForAppCache(request_.get()) || |
148 cache_entry_not_found_) | 148 cache_entry_not_found_) |
149 return NULL; | 149 return NULL; |
150 if (!found_fallback_entry_.has_response_id()) | 150 if (!found_fallback_entry_.has_response_id()) |
151 return NULL; | 151 return NULL; |
152 | 152 |
153 if (request_->IsCancelled()) { | 153 if (request_->IsCancelled()) { |
154 // 6.9.6, step 4: But not if the user canceled the download. | 154 // 6.9.6, step 4: But not if the user canceled the download. |
155 return NULL; | 155 return NULL; |
156 } | 156 } |
157 | 157 |
158 // We don't fallback for responses that we delivered. | 158 // We don't fallback for responses that we delivered. |
159 if (job_.get()) { | 159 if (job_.get()) { |
160 DCHECK(!job_->is_delivering_network_response()); | 160 DCHECK(!job_->IsDeliveringNetworkResponse()); |
161 return NULL; | 161 return NULL; |
162 } | 162 } |
163 | 163 |
164 if (request_->IsSuccess()) { | 164 if (request_->IsSuccess()) { |
165 int code_major = request_->GetResponseCode() / 100; | 165 int code_major = request_->GetResponseCode() / 100; |
166 if (code_major !=4 && code_major != 5) | 166 if (code_major !=4 && code_major != 5) |
167 return NULL; | 167 return NULL; |
168 | 168 |
169 // Servers can override the fallback behavior with a response header. | 169 // Servers can override the fallback behavior with a response header. |
170 const std::string kFallbackOverrideHeader( | 170 const std::string kFallbackOverrideHeader( |
171 "x-chromium-appcache-fallback-override"); | 171 "x-chromium-appcache-fallback-override"); |
172 const std::string kFallbackOverrideValue( | 172 const std::string kFallbackOverrideValue( |
173 "disallow-fallback"); | 173 "disallow-fallback"); |
174 std::string header_value; | 174 std::string header_value; |
175 header_value = request_->GetResponseHeaderByName(kFallbackOverrideHeader); | 175 header_value = request_->GetResponseHeaderByName(kFallbackOverrideHeader); |
176 if (header_value == kFallbackOverrideValue) | 176 if (header_value == kFallbackOverrideValue) |
177 return NULL; | 177 return NULL; |
178 } | 178 } |
179 | 179 |
180 // 6.9.6, step 4: If this results in a 4xx or 5xx status code | 180 // 6.9.6, step 4: If this results in a 4xx or 5xx status code |
181 // or there were network errors, get the resource of the fallback entry. | 181 // or there were network errors, get the resource of the fallback entry. |
182 std::unique_ptr<AppCacheURLRequestJob> job = CreateJob(network_delegate); | 182 std::unique_ptr<AppCacheJob> job = CreateJob(network_delegate); |
183 DeliverAppCachedResponse(found_fallback_entry_, found_cache_id_, | 183 DeliverAppCachedResponse(found_fallback_entry_, found_cache_id_, |
184 found_manifest_url_, true, | 184 found_manifest_url_, true, |
185 found_namespace_entry_url_); | 185 found_namespace_entry_url_); |
186 return job.release(); | 186 return job.release(); |
187 } | 187 } |
188 | 188 |
189 void AppCacheRequestHandler::GetExtraResponseInfo(int64_t* cache_id, | 189 void AppCacheRequestHandler::GetExtraResponseInfo(int64_t* cache_id, |
190 GURL* manifest_url) { | 190 GURL* manifest_url) { |
191 *cache_id = cache_id_; | 191 *cache_id = cache_id_; |
192 *manifest_url = manifest_url_; | 192 *manifest_url = manifest_url_; |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
247 OnDestructionImminent(host_); | 247 OnDestructionImminent(host_); |
248 host_for_cross_site_transfer_.reset(); | 248 host_for_cross_site_transfer_.reset(); |
249 } | 249 } |
250 | 250 |
251 void AppCacheRequestHandler::DeliverAppCachedResponse( | 251 void AppCacheRequestHandler::DeliverAppCachedResponse( |
252 const AppCacheEntry& entry, | 252 const AppCacheEntry& entry, |
253 int64_t cache_id, | 253 int64_t cache_id, |
254 const GURL& manifest_url, | 254 const GURL& manifest_url, |
255 bool is_fallback, | 255 bool is_fallback, |
256 const GURL& namespace_entry_url) { | 256 const GURL& namespace_entry_url) { |
257 DCHECK(host_ && job_.get() && job_->is_waiting()); | 257 DCHECK(host_ && job_.get() && job_->IsWaiting()); |
258 DCHECK(entry.has_response_id()); | 258 DCHECK(entry.has_response_id()); |
259 | 259 |
260 // Cache information about the response, for use by GetExtraResponseInfo. | 260 // Cache information about the response, for use by GetExtraResponseInfo. |
261 cache_id_ = cache_id; | 261 cache_id_ = cache_id; |
262 manifest_url_ = manifest_url; | 262 manifest_url_ = manifest_url; |
263 | 263 |
264 if (IsResourceTypeFrame(resource_type_) && !namespace_entry_url.is_empty()) | 264 if (IsResourceTypeFrame(resource_type_) && !namespace_entry_url.is_empty()) |
265 host_->NotifyMainResourceIsNamespaceEntry(namespace_entry_url); | 265 host_->NotifyMainResourceIsNamespaceEntry(namespace_entry_url); |
266 | 266 |
267 job_->DeliverAppCachedResponse(manifest_url, cache_id, entry, is_fallback); | 267 job_->DeliverAppCachedResponse(manifest_url, cache_id, entry, is_fallback); |
268 } | 268 } |
269 | 269 |
270 void AppCacheRequestHandler::DeliverErrorResponse() { | 270 void AppCacheRequestHandler::DeliverErrorResponse() { |
271 DCHECK(job_.get() && job_->is_waiting()); | 271 DCHECK(job_.get() && job_->IsWaiting()); |
272 DCHECK_EQ(kAppCacheNoCacheId, cache_id_); | 272 DCHECK_EQ(kAppCacheNoCacheId, cache_id_); |
273 DCHECK(manifest_url_.is_empty()); | 273 DCHECK(manifest_url_.is_empty()); |
274 job_->DeliverErrorResponse(); | 274 job_->DeliverErrorResponse(); |
275 } | 275 } |
276 | 276 |
277 void AppCacheRequestHandler::DeliverNetworkResponse() { | 277 void AppCacheRequestHandler::DeliverNetworkResponse() { |
278 DCHECK(job_.get() && job_->is_waiting()); | 278 DCHECK(job_.get() && job_->IsWaiting()); |
279 DCHECK_EQ(kAppCacheNoCacheId, cache_id_); | 279 DCHECK_EQ(kAppCacheNoCacheId, cache_id_); |
280 DCHECK(manifest_url_.is_empty()); | 280 DCHECK(manifest_url_.is_empty()); |
281 job_->DeliverNetworkResponse(); | 281 job_->DeliverNetworkResponse(); |
282 } | 282 } |
283 | 283 |
284 void AppCacheRequestHandler::OnPrepareToRestart() { | 284 void AppCacheRequestHandler::OnPrepareToRestart() { |
285 DCHECK(job_->is_delivering_network_response() || | 285 DCHECK(job_->IsDeliveringNetworkResponse() || job_->IsCacheEntryNotFound()); |
286 job_->cache_entry_not_found()); | |
287 | 286 |
288 // Any information about the source of the response is no longer relevant. | 287 // Any information about the source of the response is no longer relevant. |
289 cache_id_ = kAppCacheNoCacheId; | 288 cache_id_ = kAppCacheNoCacheId; |
290 manifest_url_ = GURL(); | 289 manifest_url_ = GURL(); |
291 | 290 |
292 cache_entry_not_found_ = job_->cache_entry_not_found(); | 291 cache_entry_not_found_ = job_->IsCacheEntryNotFound(); |
293 is_delivering_network_response_ = job_->is_delivering_network_response(); | 292 is_delivering_network_response_ = job_->IsDeliveringNetworkResponse(); |
294 | 293 |
295 storage()->CancelDelegateCallbacks(this); | 294 storage()->CancelDelegateCallbacks(this); |
296 | 295 |
297 job_.reset(); | 296 job_.reset(); |
298 } | 297 } |
299 | 298 |
300 std::unique_ptr<AppCacheURLRequestJob> AppCacheRequestHandler::CreateJob( | 299 std::unique_ptr<AppCacheJob> AppCacheRequestHandler::CreateJob( |
301 net::NetworkDelegate* network_delegate) { | 300 net::NetworkDelegate* network_delegate) { |
302 std::unique_ptr<AppCacheURLRequestJob> job(new AppCacheURLRequestJob( | 301 std::unique_ptr<AppCacheJob> job = AppCacheJob::Create( |
jam
2017/05/05 23:15:25
why not just create the two concrete classes here
ananta
2017/05/06 03:01:35
Removed the enum. I thought it is better to leave
| |
303 request_->GetURLRequest(), network_delegate, storage(), host_, | 302 AppCacheJob::kJobType::URL_REQUEST_JOB, is_main_resource(), host_, |
304 is_main_resource(), | 303 storage(), request_.get(), network_delegate, |
305 base::Bind(&AppCacheRequestHandler::OnPrepareToRestart, | 304 base::Bind(&AppCacheRequestHandler::OnPrepareToRestart, |
306 base::Unretained(this)))); | 305 base::Unretained(this))); |
307 job_ = job->GetWeakPtr(); | 306 job_ = job->GetWeakPtr(); |
308 return job; | 307 return job; |
309 } | 308 } |
310 | 309 |
311 // Main-resource handling ---------------------------------------------- | 310 // Main-resource handling ---------------------------------------------- |
312 | 311 |
313 std::unique_ptr<AppCacheURLRequestJob> | 312 std::unique_ptr<AppCacheJob> AppCacheRequestHandler::MaybeLoadMainResource( |
314 AppCacheRequestHandler::MaybeLoadMainResource( | |
315 net::NetworkDelegate* network_delegate) { | 313 net::NetworkDelegate* network_delegate) { |
316 DCHECK(!job_.get()); | 314 DCHECK(!job_.get()); |
317 DCHECK(host_); | 315 DCHECK(host_); |
318 | 316 |
319 // If a page falls into the scope of a ServiceWorker, any matching AppCaches | 317 // If a page falls into the scope of a ServiceWorker, any matching AppCaches |
320 // should be ignored. This depends on the ServiceWorker handler being invoked | 318 // should be ignored. This depends on the ServiceWorker handler being invoked |
321 // prior to the AppCache handler. | 319 // prior to the AppCache handler. |
322 if (ServiceWorkerRequestHandler::IsControlledByServiceWorker( | 320 if (ServiceWorkerRequestHandler::IsControlledByServiceWorker( |
323 request_->GetURLRequest())) { | 321 request_->GetURLRequest())) { |
324 host_->enable_cache_selection(false); | 322 host_->enable_cache_selection(false); |
325 return nullptr; | 323 return nullptr; |
326 } | 324 } |
327 | 325 |
328 host_->enable_cache_selection(true); | 326 host_->enable_cache_selection(true); |
329 | 327 |
330 const AppCacheHost* spawning_host = | 328 const AppCacheHost* spawning_host = |
331 (resource_type_ == RESOURCE_TYPE_SHARED_WORKER) ? | 329 (resource_type_ == RESOURCE_TYPE_SHARED_WORKER) ? |
332 host_ : host_->GetSpawningHost(); | 330 host_ : host_->GetSpawningHost(); |
333 GURL preferred_manifest_url = spawning_host ? | 331 GURL preferred_manifest_url = spawning_host ? |
334 spawning_host->preferred_manifest_url() : GURL(); | 332 spawning_host->preferred_manifest_url() : GURL(); |
335 | 333 |
336 // We may have to wait for our storage query to complete, but | 334 // We may have to wait for our storage query to complete, but |
337 // this query can also complete syncrhonously. | 335 // this query can also complete syncrhonously. |
338 std::unique_ptr<AppCacheURLRequestJob> job = CreateJob(network_delegate); | 336 std::unique_ptr<AppCacheJob> job = CreateJob(network_delegate); |
339 storage()->FindResponseForMainRequest(request_->GetURL(), | 337 storage()->FindResponseForMainRequest(request_->GetURL(), |
340 preferred_manifest_url, this); | 338 preferred_manifest_url, this); |
341 return job; | 339 return job; |
342 } | 340 } |
343 | 341 |
344 void AppCacheRequestHandler::OnMainResponseFound( | 342 void AppCacheRequestHandler::OnMainResponseFound( |
345 const GURL& url, | 343 const GURL& url, |
346 const AppCacheEntry& entry, | 344 const AppCacheEntry& entry, |
347 const GURL& namespace_entry_url, | 345 const GURL& namespace_entry_url, |
348 const AppCacheEntry& fallback_entry, | 346 const AppCacheEntry& fallback_entry, |
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
405 DCHECK(!found_fallback_entry_.has_response_id()); | 403 DCHECK(!found_fallback_entry_.has_response_id()); |
406 DeliverAppCachedResponse(found_entry_, found_cache_id_, found_manifest_url_, | 404 DeliverAppCachedResponse(found_entry_, found_cache_id_, found_manifest_url_, |
407 false, found_namespace_entry_url_); | 405 false, found_namespace_entry_url_); |
408 } else { | 406 } else { |
409 DeliverNetworkResponse(); | 407 DeliverNetworkResponse(); |
410 } | 408 } |
411 } | 409 } |
412 | 410 |
413 // Sub-resource handling ---------------------------------------------- | 411 // Sub-resource handling ---------------------------------------------- |
414 | 412 |
415 std::unique_ptr<AppCacheURLRequestJob> | 413 std::unique_ptr<AppCacheJob> AppCacheRequestHandler::MaybeLoadSubResource( |
416 AppCacheRequestHandler::MaybeLoadSubResource( | |
417 net::NetworkDelegate* network_delegate) { | 414 net::NetworkDelegate* network_delegate) { |
418 DCHECK(!job_.get()); | 415 DCHECK(!job_.get()); |
419 | 416 |
420 if (host_->is_selection_pending()) { | 417 if (host_->is_selection_pending()) { |
421 // We have to wait until cache selection is complete and the | 418 // We have to wait until cache selection is complete and the |
422 // selected cache is loaded. | 419 // selected cache is loaded. |
423 is_waiting_for_cache_selection_ = true; | 420 is_waiting_for_cache_selection_ = true; |
424 return CreateJob(network_delegate); | 421 return CreateJob(network_delegate); |
425 } | 422 } |
426 | 423 |
427 if (!host_->associated_cache() || | 424 if (!host_->associated_cache() || |
428 !host_->associated_cache()->is_complete() || | 425 !host_->associated_cache()->is_complete() || |
429 host_->associated_cache()->owning_group()->is_being_deleted()) { | 426 host_->associated_cache()->owning_group()->is_being_deleted()) { |
430 return nullptr; | 427 return nullptr; |
431 } | 428 } |
432 | 429 |
433 std::unique_ptr<AppCacheURLRequestJob> job = CreateJob(network_delegate); | 430 std::unique_ptr<AppCacheJob> job = CreateJob(network_delegate); |
434 ContinueMaybeLoadSubResource(); | 431 ContinueMaybeLoadSubResource(); |
435 return job; | 432 return job; |
436 } | 433 } |
437 | 434 |
438 void AppCacheRequestHandler::ContinueMaybeLoadSubResource() { | 435 void AppCacheRequestHandler::ContinueMaybeLoadSubResource() { |
439 // 6.9.6 Changes to the networking model | 436 // 6.9.6 Changes to the networking model |
440 // If the resource is not to be fetched using the HTTP GET mechanism or | 437 // If the resource is not to be fetched using the HTTP GET mechanism or |
441 // equivalent ... then fetch the resource normally. | 438 // equivalent ... then fetch the resource normally. |
442 DCHECK(job_.get()); | 439 DCHECK(job_.get()); |
443 DCHECK(host_->associated_cache() && host_->associated_cache()->is_complete()); | 440 DCHECK(host_->associated_cache() && host_->associated_cache()->is_complete()); |
444 | 441 |
445 const GURL& url = job_->request()->url(); | 442 const GURL& url = job_->GetURL(); |
446 AppCache* cache = host_->associated_cache(); | 443 AppCache* cache = host_->associated_cache(); |
447 storage()->FindResponseForSubRequest( | 444 storage()->FindResponseForSubRequest( |
448 host_->associated_cache(), url, | 445 host_->associated_cache(), url, |
449 &found_entry_, &found_fallback_entry_, &found_network_namespace_); | 446 &found_entry_, &found_fallback_entry_, &found_network_namespace_); |
450 | 447 |
451 if (found_entry_.has_response_id()) { | 448 if (found_entry_.has_response_id()) { |
452 // Step 2: If there's an entry, get it instead. | 449 // Step 2: If there's an entry, get it instead. |
453 DCHECK(!found_network_namespace_ && | 450 DCHECK(!found_network_namespace_ && |
454 !found_fallback_entry_.has_response_id()); | 451 !found_fallback_entry_.has_response_id()); |
455 found_cache_id_ = cache->cache_id(); | 452 found_cache_id_ = cache->cache_id(); |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
501 if (!host_->associated_cache() || | 498 if (!host_->associated_cache() || |
502 !host_->associated_cache()->is_complete()) { | 499 !host_->associated_cache()->is_complete()) { |
503 DeliverNetworkResponse(); | 500 DeliverNetworkResponse(); |
504 return; | 501 return; |
505 } | 502 } |
506 | 503 |
507 ContinueMaybeLoadSubResource(); | 504 ContinueMaybeLoadSubResource(); |
508 } | 505 } |
509 | 506 |
510 } // namespace content | 507 } // namespace content |
OLD | NEW |