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

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

Issue 3404027: webkit: Append base:: in the StringPrintf calls. (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: Created 10 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
« no previous file with comments | « webkit/appcache/appcache_host.cc ('k') | webkit/appcache/appcache_url_request_job.cc » ('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 (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/stringprintf.h"
10 #include "net/base/io_buffer.h" 11 #include "net/base/io_buffer.h"
11 #include "net/base/load_flags.h" 12 #include "net/base/load_flags.h"
12 #include "net/base/net_errors.h" 13 #include "net/base/net_errors.h"
13 #include "net/http/http_request_headers.h" 14 #include "net/http/http_request_headers.h"
14 #include "net/http/http_response_headers.h" 15 #include "net/http/http_response_headers.h"
15 #include "webkit/appcache/appcache_group.h" 16 #include "webkit/appcache/appcache_group.h"
16 #include "webkit/appcache/appcache_policy.h" 17 #include "webkit/appcache/appcache_policy.h"
17 18
18 namespace appcache { 19 namespace appcache {
19 20
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
525 else 526 else
526 ContinueHandleManifestFetchCompleted(true); 527 ContinueHandleManifestFetchCompleted(true);
527 } else if (response_code == 304 && update_type_ == UPGRADE_ATTEMPT) { 528 } else if (response_code == 304 && update_type_ == UPGRADE_ATTEMPT) {
528 ContinueHandleManifestFetchCompleted(false); 529 ContinueHandleManifestFetchCompleted(false);
529 } else if (response_code == 404 || response_code == 410) { 530 } else if (response_code == 404 || response_code == 410) {
530 service_->storage()->MakeGroupObsolete(group_, this); // async 531 service_->storage()->MakeGroupObsolete(group_, this); // async
531 } else { 532 } else {
532 std::string message; 533 std::string message;
533 if (!is_valid_response_code) { 534 if (!is_valid_response_code) {
534 const char* kFormatString = "Manifest fetch failed (%d) %s"; 535 const char* kFormatString = "Manifest fetch failed (%d) %s";
535 message = StringPrintf(kFormatString, response_code, 536 message = base::StringPrintf(kFormatString, response_code,
536 manifest_url_.spec().c_str()); 537 manifest_url_.spec().c_str());
537 } else { 538 } else {
538 DCHECK(!is_valid_mime_type); 539 DCHECK(!is_valid_mime_type);
539 const char* kFormatString = "Invalid manifest mime type (%s) %s"; 540 const char* kFormatString = "Invalid manifest mime type (%s) %s";
540 message = StringPrintf(kFormatString, mime_type.c_str(), 541 message = base::StringPrintf(kFormatString, mime_type.c_str(),
541 manifest_url_.spec().c_str()); 542 manifest_url_.spec().c_str());
542 } 543 }
543 HandleCacheFailure(message); 544 HandleCacheFailure(message);
544 } 545 }
545 } 546 }
546 547
547 void AppCacheUpdateJob::OnGroupMadeObsolete(AppCacheGroup* group, 548 void AppCacheUpdateJob::OnGroupMadeObsolete(AppCacheGroup* group,
548 bool success) { 549 bool success) {
549 DCHECK(master_entry_fetches_.empty()); 550 DCHECK(master_entry_fetches_.empty());
550 CancelAllMasterEntryFetches("The group has been made obsolete"); 551 CancelAllMasterEntryFetches("The group has been made obsolete");
551 if (success) { 552 if (success) {
(...skipping 17 matching lines...) Expand all
569 // Wait for pending master entries to download. 570 // Wait for pending master entries to download.
570 FetchMasterEntries(); 571 FetchMasterEntries();
571 MaybeCompleteUpdate(); // if not done, run async 6.9.4 step 7 substeps 572 MaybeCompleteUpdate(); // if not done, run async 6.9.4 step 7 substeps
572 return; 573 return;
573 } 574 }
574 575
575 Manifest manifest; 576 Manifest manifest;
576 if (!ParseManifest(manifest_url_, manifest_data_.data(), 577 if (!ParseManifest(manifest_url_, manifest_data_.data(),
577 manifest_data_.length(), manifest)) { 578 manifest_data_.length(), manifest)) {
578 const char* kFormatString = "Failed to parse manifest %s"; 579 const char* kFormatString = "Failed to parse manifest %s";
579 const std::string message = StringPrintf(kFormatString, 580 const std::string message = base::StringPrintf(kFormatString,
580 manifest_url_.spec().c_str()); 581 manifest_url_.spec().c_str());
581 HandleCacheFailure(message); 582 HandleCacheFailure(message);
582 LOG(INFO) << message; 583 LOG(INFO) << message;
583 return; 584 return;
584 } 585 }
585 586
586 // Proceed with update process. Section 6.9.4 steps 8-20. 587 // Proceed with update process. Section 6.9.4 steps 8-20.
587 internal_state_ = DOWNLOADING; 588 internal_state_ = DOWNLOADING;
588 inprogress_cache_ = new AppCache(service_, 589 inprogress_cache_ = new AppCache(service_,
589 service_->storage()->NewCacheId()); 590 service_->storage()->NewCacheId());
590 BuildUrlFileList(manifest); 591 BuildUrlFileList(manifest);
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
638 << " os_error: " << request->status().os_error() 639 << " os_error: " << request->status().os_error()
639 << " response code: " << response_code; 640 << " response code: " << response_code;
640 if (entry.IsExplicit() || entry.IsFallback()) { 641 if (entry.IsExplicit() || entry.IsFallback()) {
641 if (response_code == 304 && info->existing_entry_.has_response_id()) { 642 if (response_code == 304 && info->existing_entry_.has_response_id()) {
642 // Keep the existing response. 643 // Keep the existing response.
643 entry.set_response_id(info->existing_entry_.response_id()); 644 entry.set_response_id(info->existing_entry_.response_id());
644 entry.set_response_size(info->existing_entry_.response_size()); 645 entry.set_response_size(info->existing_entry_.response_size());
645 inprogress_cache_->AddOrModifyEntry(url, entry); 646 inprogress_cache_->AddOrModifyEntry(url, entry);
646 } else { 647 } else {
647 const char* kFormatString = "Resource fetch failed (%d) %s"; 648 const char* kFormatString = "Resource fetch failed (%d) %s";
648 const std::string message = StringPrintf(kFormatString, response_code, 649 const std::string message = base::StringPrintf(kFormatString,
649 request->url().spec().c_str()); 650 response_code, request->url().spec().c_str());
650 HandleCacheFailure(message); 651 HandleCacheFailure(message);
651 return; 652 return;
652 } 653 }
653 } else if (response_code == 404 || response_code == 410) { 654 } else if (response_code == 404 || response_code == 410) {
654 // Entry is skipped. They are dropped from the cache. 655 // Entry is skipped. They are dropped from the cache.
655 } else if (update_type_ == UPGRADE_ATTEMPT && 656 } else if (update_type_ == UPGRADE_ATTEMPT &&
656 info->existing_entry_.has_response_id()) { 657 info->existing_entry_.has_response_id()) {
657 // Keep the existing response. 658 // Keep the existing response.
658 // TODO(michaeln): Not sure this is a good idea. This is spec compliant 659 // TODO(michaeln): Not sure this is a good idea. This is spec compliant
659 // but the old resource may or may not be compatible with the new contents 660 // but the old resource may or may not be compatible with the new contents
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 723
723 // In downloading case, disassociate host from inprogress cache. 724 // In downloading case, disassociate host from inprogress cache.
724 if (inprogress_cache_) 725 if (inprogress_cache_)
725 host->AssociateCache(NULL); 726 host->AssociateCache(NULL);
726 727
727 host->RemoveObserver(this); 728 host->RemoveObserver(this);
728 } 729 }
729 hosts.clear(); 730 hosts.clear();
730 731
731 const char* kFormatString = "Master entry fetch failed (%d) %s"; 732 const char* kFormatString = "Master entry fetch failed (%d) %s";
732 const std::string message = StringPrintf(kFormatString, response_code, 733 const std::string message = base::StringPrintf(kFormatString,
733 request->url().spec().c_str()); 734 response_code, request->url().spec().c_str());
734 host_notifier.SendErrorNotifications(message); 735 host_notifier.SendErrorNotifications(message);
735 736
736 // In downloading case, update result is different if all master entries 737 // In downloading case, update result is different if all master entries
737 // failed vs. only some failing. 738 // failed vs. only some failing.
738 if (inprogress_cache_) { 739 if (inprogress_cache_) {
739 // Only count successful downloads to know if all master entries failed. 740 // Only count successful downloads to know if all master entries failed.
740 pending_master_entries_.erase(found); 741 pending_master_entries_.erase(found);
741 --master_entries_completed_; 742 --master_entries_completed_;
742 743
743 // Section 6.9.4, step 22.3. 744 // Section 6.9.4, step 22.3.
(...skipping 649 matching lines...) Expand 10 before | Expand all | Expand 10 after
1393 1394
1394 // Break the connection with the group so the group cannot call delete 1395 // Break the connection with the group so the group cannot call delete
1395 // on this object after we've posted a task to delete ourselves. 1396 // on this object after we've posted a task to delete ourselves.
1396 group_->SetUpdateStatus(AppCacheGroup::IDLE); 1397 group_->SetUpdateStatus(AppCacheGroup::IDLE);
1397 group_ = NULL; 1398 group_ = NULL;
1398 1399
1399 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 1400 MessageLoop::current()->DeleteSoon(FROM_HERE, this);
1400 } 1401 }
1401 1402
1402 } // namespace appcache 1403 } // namespace appcache
OLDNEW
« no previous file with comments | « webkit/appcache/appcache_host.cc ('k') | webkit/appcache/appcache_url_request_job.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698