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

Side by Side Diff: webkit/appcache/appcache_update_job.cc

Issue 8949001: Fix some loose ends around recently introduced AppCache INTERCEPT namespaces (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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
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 "webkit/appcache/appcache_update_job.h" 5 #include "webkit/appcache/appcache_update_job.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/bind_helpers.h" 8 #include "base/bind_helpers.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 if (response_code / 100 == 2) { 546 if (response_code / 100 == 2) {
547 // Associate storage with the new entry. 547 // Associate storage with the new entry.
548 DCHECK(fetcher->response_writer()); 548 DCHECK(fetcher->response_writer());
549 entry.set_response_id(fetcher->response_writer()->response_id()); 549 entry.set_response_id(fetcher->response_writer()->response_id());
550 entry.set_response_size(fetcher->response_writer()->amount_written()); 550 entry.set_response_size(fetcher->response_writer()->amount_written());
551 if (!inprogress_cache_->AddOrModifyEntry(url, entry)) 551 if (!inprogress_cache_->AddOrModifyEntry(url, entry))
552 duplicate_response_ids_.push_back(entry.response_id()); 552 duplicate_response_ids_.push_back(entry.response_id());
553 553
554 // TODO(michaeln): Check for <html manifest=xxx> 554 // TODO(michaeln): Check for <html manifest=xxx>
555 // See http://code.google.com/p/chromium/issues/detail?id=97930 555 // See http://code.google.com/p/chromium/issues/detail?id=97930
556 // if (entry.IsMaster() && !entry.IsExplicit()) 556 // if (entry.IsMaster() && !(entry.IsExplicit() || fallback || intercept))
557 // if (!manifestAttribute) skip it 557 // if (!manifestAttribute) skip it
558 558
559 // Foreign entries will be detected during cache selection. 559 // Foreign entries will be detected during cache selection.
560 // Note: 6.9.4, step 17.9 possible optimization: if resource is HTML or XML 560 // Note: 6.9.4, step 17.9 possible optimization: if resource is HTML or XML
561 // file whose root element is an html element with a manifest attribute 561 // file whose root element is an html element with a manifest attribute
562 // whose value doesn't match the manifest url of the application cache 562 // whose value doesn't match the manifest url of the application cache
563 // being processed, mark the entry as being foreign. 563 // being processed, mark the entry as being foreign.
564 } else { 564 } else {
565 VLOG(1) << "Request status: " << request->status().status() 565 VLOG(1) << "Request status: " << request->status().status()
566 << " error: " << request->status().error() 566 << " error: " << request->status().error()
567 << " response code: " << response_code; 567 << " response code: " << response_code;
568 if (entry.IsExplicit() || entry.IsFallback()) { 568 if (entry.IsExplicit() || entry.IsFallback() || entry.IsIntercept()) {
569 if (response_code == 304 && fetcher->existing_entry().has_response_id()) { 569 if (response_code == 304 && fetcher->existing_entry().has_response_id()) {
570 // Keep the existing response. 570 // Keep the existing response.
571 entry.set_response_id(fetcher->existing_entry().response_id()); 571 entry.set_response_id(fetcher->existing_entry().response_id());
572 entry.set_response_size(fetcher->existing_entry().response_size()); 572 entry.set_response_size(fetcher->existing_entry().response_size());
573 inprogress_cache_->AddOrModifyEntry(url, entry); 573 inprogress_cache_->AddOrModifyEntry(url, entry);
574 } else { 574 } else {
575 const char* kFormatString = "Resource fetch failed (%d) %s"; 575 const char* kFormatString = "Resource fetch failed (%d) %s";
576 const std::string message = base::StringPrintf(kFormatString, 576 const std::string message = base::StringPrintf(kFormatString,
577 response_code, url.spec().c_str()); 577 response_code, url.spec().c_str());
578 HandleCacheFailure(message); 578 HandleCacheFailure(message);
(...skipping 391 matching lines...) Expand 10 before | Expand all | Expand 10 after
970 pending_url_fetches_.size() + urls_to_fetch_.size(); 970 pending_url_fetches_.size() + urls_to_fetch_.size();
971 pending_url_fetches_.clear(); 971 pending_url_fetches_.clear();
972 urls_to_fetch_.clear(); 972 urls_to_fetch_.clear();
973 } 973 }
974 974
975 bool AppCacheUpdateJob::ShouldSkipUrlFetch(const AppCacheEntry& entry) { 975 bool AppCacheUpdateJob::ShouldSkipUrlFetch(const AppCacheEntry& entry) {
976 // 6.6.4 Step 17 976 // 6.6.4 Step 17
977 // If the resource URL being processed was flagged as neither an 977 // If the resource URL being processed was flagged as neither an
978 // "explicit entry" nor or a "fallback entry", then the user agent 978 // "explicit entry" nor or a "fallback entry", then the user agent
979 // may skip this URL. 979 // may skip this URL.
980 if (entry.IsExplicit() || entry.IsFallback()) { 980 if (entry.IsExplicit() || entry.IsFallback() || entry.IsIntercept())
981 return false; 981 return false;
982 }
983 982
984 // TODO(jennb): decide if entry should be skipped to expire it from cache 983 // TODO(jennb): decide if entry should be skipped to expire it from cache
985 return false; 984 return false;
986 } 985 }
987 986
988 bool AppCacheUpdateJob::AlreadyFetchedEntry(const GURL& url, 987 bool AppCacheUpdateJob::AlreadyFetchedEntry(const GURL& url,
989 int entry_type) { 988 int entry_type) {
990 DCHECK(internal_state_ == DOWNLOADING || internal_state_ == NO_UPDATE); 989 DCHECK(internal_state_ == DOWNLOADING || internal_state_ == NO_UPDATE);
991 AppCacheEntry* existing = inprogress_cache_ ? 990 AppCacheEntry* existing = inprogress_cache_ ?
992 inprogress_cache_->GetEntry(url) : 991 inprogress_cache_->GetEntry(url) :
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
1329 1328
1330 // Break the connection with the group so the group cannot call delete 1329 // Break the connection with the group so the group cannot call delete
1331 // on this object after we've posted a task to delete ourselves. 1330 // on this object after we've posted a task to delete ourselves.
1332 group_->SetUpdateStatus(AppCacheGroup::IDLE); 1331 group_->SetUpdateStatus(AppCacheGroup::IDLE);
1333 group_ = NULL; 1332 group_ = NULL;
1334 1333
1335 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 1334 MessageLoop::current()->DeleteSoon(FROM_HERE, this);
1336 } 1335 }
1337 1336
1338 } // namespace appcache 1337 } // namespace appcache
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698