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

Side by Side Diff: content/browser/appcache/appcache_request_handler.cc

Issue 2902653002: Get main frame and subframe AppCache loads to work. (Closed)
Patch Set: Address portions of the review comments Created 3 years, 6 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 (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 298 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 // Main-resource handling ---------------------------------------------- 309 // Main-resource handling ----------------------------------------------
310 310
311 std::unique_ptr<AppCacheJob> AppCacheRequestHandler::MaybeLoadMainResource( 311 std::unique_ptr<AppCacheJob> AppCacheRequestHandler::MaybeLoadMainResource(
312 net::NetworkDelegate* network_delegate) { 312 net::NetworkDelegate* network_delegate) {
313 DCHECK(!job_.get()); 313 DCHECK(!job_.get());
314 DCHECK(host_); 314 DCHECK(host_);
315 315
316 // If a page falls into the scope of a ServiceWorker, any matching AppCaches 316 // If a page falls into the scope of a ServiceWorker, any matching AppCaches
317 // should be ignored. This depends on the ServiceWorker handler being invoked 317 // should be ignored. This depends on the ServiceWorker handler being invoked
318 // prior to the AppCache handler. 318 // prior to the AppCache handler.
319 if (ServiceWorkerRequestHandler::IsControlledByServiceWorker( 319 // TODO(ananta)
320 // We need to handle this for AppCache requests initiated for the network
321 // service
322 if (request_->GetURLRequest() &&
323 ServiceWorkerRequestHandler::IsControlledByServiceWorker(
320 request_->GetURLRequest())) { 324 request_->GetURLRequest())) {
321 host_->enable_cache_selection(false); 325 host_->enable_cache_selection(false);
322 return nullptr; 326 return nullptr;
323 } 327 }
324 328
329 if (service_->storage()->IsInitialized() &&
michaeln 2017/06/02 23:47:27 Please use the storage() method to access the stor
ananta 2017/06/03 01:55:56 Done.
330 service_->storage()->usage_map()->find(request_->GetURL().GetOrigin()) ==
331 service_->storage()->usage_map()->end()) {
332 return nullptr;
333 }
334
325 host_->enable_cache_selection(true); 335 host_->enable_cache_selection(true);
326 336
327 const AppCacheHost* spawning_host = 337 const AppCacheHost* spawning_host =
328 (resource_type_ == RESOURCE_TYPE_SHARED_WORKER) ? 338 (resource_type_ == RESOURCE_TYPE_SHARED_WORKER) ?
329 host_ : host_->GetSpawningHost(); 339 host_ : host_->GetSpawningHost();
330 GURL preferred_manifest_url = spawning_host ? 340 GURL preferred_manifest_url = spawning_host ?
331 spawning_host->preferred_manifest_url() : GURL(); 341 spawning_host->preferred_manifest_url() : GURL();
332 342
333 // We may have to wait for our storage query to complete, but 343 // We may have to wait for our storage query to complete, but
334 // this query can also complete syncrhonously. 344 // this query can also complete syncrhonously.
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
497 if (!host_->associated_cache() || 507 if (!host_->associated_cache() ||
498 !host_->associated_cache()->is_complete()) { 508 !host_->associated_cache()->is_complete()) {
499 DeliverNetworkResponse(); 509 DeliverNetworkResponse();
500 return; 510 return;
501 } 511 }
502 512
503 ContinueMaybeLoadSubResource(); 513 ContinueMaybeLoadSubResource();
504 } 514 }
505 515
506 } // namespace content 516 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698