| 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 "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 "base/stringprintf.h" |
| (...skipping 588 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 if (!inprogress_cache_->AddOrModifyEntry(url, entry)) | 599 if (!inprogress_cache_->AddOrModifyEntry(url, entry)) |
| 600 duplicate_response_ids_.push_back(entry.response_id()); | 600 duplicate_response_ids_.push_back(entry.response_id()); |
| 601 | 601 |
| 602 // Foreign entries will be detected during cache selection. | 602 // Foreign entries will be detected during cache selection. |
| 603 // Note: 6.9.4, step 17.9 possible optimization: if resource is HTML or XML | 603 // Note: 6.9.4, step 17.9 possible optimization: if resource is HTML or XML |
| 604 // file whose root element is an html element with a manifest attribute | 604 // file whose root element is an html element with a manifest attribute |
| 605 // whose value doesn't match the manifest url of the application cache | 605 // whose value doesn't match the manifest url of the application cache |
| 606 // being processed, mark the entry as being foreign. | 606 // being processed, mark the entry as being foreign. |
| 607 } else { | 607 } else { |
| 608 VLOG(1) << "Request status: " << request->status().status() | 608 VLOG(1) << "Request status: " << request->status().status() |
| 609 << " os_error: " << request->status().os_error() | 609 << " error: " << request->status().error() |
| 610 << " response code: " << response_code; | 610 << " response code: " << response_code; |
| 611 if (entry.IsExplicit() || entry.IsFallback()) { | 611 if (entry.IsExplicit() || entry.IsFallback()) { |
| 612 if (response_code == 304 && fetcher->existing_entry().has_response_id()) { | 612 if (response_code == 304 && fetcher->existing_entry().has_response_id()) { |
| 613 // Keep the existing response. | 613 // Keep the existing response. |
| 614 entry.set_response_id(fetcher->existing_entry().response_id()); | 614 entry.set_response_id(fetcher->existing_entry().response_id()); |
| 615 entry.set_response_size(fetcher->existing_entry().response_size()); | 615 entry.set_response_size(fetcher->existing_entry().response_size()); |
| 616 inprogress_cache_->AddOrModifyEntry(url, entry); | 616 inprogress_cache_->AddOrModifyEntry(url, entry); |
| 617 } else { | 617 } else { |
| 618 const char* kFormatString = "Resource fetch failed (%d) %s"; | 618 const char* kFormatString = "Resource fetch failed (%d) %s"; |
| 619 const std::string message = base::StringPrintf(kFormatString, | 619 const std::string message = base::StringPrintf(kFormatString, |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 743 StoreGroupAndCache(); | 743 StoreGroupAndCache(); |
| 744 } else { | 744 } else { |
| 745 manifest_response_writer_.reset(CreateResponseWriter()); | 745 manifest_response_writer_.reset(CreateResponseWriter()); |
| 746 scoped_refptr<HttpResponseInfoIOBuffer> io_buffer( | 746 scoped_refptr<HttpResponseInfoIOBuffer> io_buffer( |
| 747 new HttpResponseInfoIOBuffer(manifest_response_info_.release())); | 747 new HttpResponseInfoIOBuffer(manifest_response_info_.release())); |
| 748 manifest_response_writer_->WriteInfo(io_buffer, | 748 manifest_response_writer_->WriteInfo(io_buffer, |
| 749 &manifest_info_write_callback_); | 749 &manifest_info_write_callback_); |
| 750 } | 750 } |
| 751 } else { | 751 } else { |
| 752 VLOG(1) << "Request status: " << request->status().status() | 752 VLOG(1) << "Request status: " << request->status().status() |
| 753 << " os_error: " << request->status().os_error() | 753 << " error: " << request->status().error() |
| 754 << " response code: " << response_code; | 754 << " response code: " << response_code; |
| 755 ScheduleUpdateRetry(kRerunDelayMs); | 755 ScheduleUpdateRetry(kRerunDelayMs); |
| 756 HandleCacheFailure("Manifest changed during update, scheduling retry"); | 756 HandleCacheFailure("Manifest changed during update, scheduling retry"); |
| 757 } | 757 } |
| 758 } | 758 } |
| 759 | 759 |
| 760 void AppCacheUpdateJob::OnManifestInfoWriteComplete(int result) { | 760 void AppCacheUpdateJob::OnManifestInfoWriteComplete(int result) { |
| 761 if (result > 0) { | 761 if (result > 0) { |
| 762 scoped_refptr<net::StringIOBuffer> io_buffer( | 762 scoped_refptr<net::StringIOBuffer> io_buffer( |
| 763 new net::StringIOBuffer(manifest_data_)); | 763 new net::StringIOBuffer(manifest_data_)); |
| (...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1354 | 1354 |
| 1355 // Break the connection with the group so the group cannot call delete | 1355 // Break the connection with the group so the group cannot call delete |
| 1356 // on this object after we've posted a task to delete ourselves. | 1356 // on this object after we've posted a task to delete ourselves. |
| 1357 group_->SetUpdateStatus(AppCacheGroup::IDLE); | 1357 group_->SetUpdateStatus(AppCacheGroup::IDLE); |
| 1358 group_ = NULL; | 1358 group_ = NULL; |
| 1359 | 1359 |
| 1360 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 1360 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 1361 } | 1361 } |
| 1362 | 1362 |
| 1363 } // namespace appcache | 1363 } // namespace appcache |
| OLD | NEW |