| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_update_job.h" | 5 #include "content/browser/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/message_loop.h" | 10 #include "base/message_loop/message_loop.h" |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 572 if (!changed) { | 572 if (!changed) { |
| 573 DCHECK(update_type_ == UPGRADE_ATTEMPT); | 573 DCHECK(update_type_ == UPGRADE_ATTEMPT); |
| 574 internal_state_ = NO_UPDATE; | 574 internal_state_ = NO_UPDATE; |
| 575 | 575 |
| 576 // Wait for pending master entries to download. | 576 // Wait for pending master entries to download. |
| 577 FetchMasterEntries(); | 577 FetchMasterEntries(); |
| 578 MaybeCompleteUpdate(); // if not done, run async 6.9.4 step 7 substeps | 578 MaybeCompleteUpdate(); // if not done, run async 6.9.4 step 7 substeps |
| 579 return; | 579 return; |
| 580 } | 580 } |
| 581 | 581 |
| 582 Manifest manifest; | 582 AppCacheManifest manifest; |
| 583 if (!ParseManifest(manifest_url_, manifest_data_.data(), | 583 if (!ParseManifest(manifest_url_, manifest_data_.data(), |
| 584 manifest_data_.length(), | 584 manifest_data_.length(), |
| 585 manifest_has_valid_mime_type_ ? | 585 manifest_has_valid_mime_type_ ? |
| 586 PARSE_MANIFEST_ALLOWING_INTERCEPTS : | 586 PARSE_MANIFEST_ALLOWING_INTERCEPTS : |
| 587 PARSE_MANIFEST_PER_STANDARD, | 587 PARSE_MANIFEST_PER_STANDARD, |
| 588 manifest)) { | 588 manifest)) { |
| 589 const char* kFormatString = "Failed to parse manifest %s"; | 589 const char* kFormatString = "Failed to parse manifest %s"; |
| 590 const std::string message = base::StringPrintf(kFormatString, | 590 const std::string message = base::StringPrintf(kFormatString, |
| 591 manifest_url_.spec().c_str()); | 591 manifest_url_.spec().c_str()); |
| 592 HandleCacheFailure( | 592 HandleCacheFailure( |
| (...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1087 base::Bind(&AppCacheUpdateJob::OnManifestDataReadComplete, | 1087 base::Bind(&AppCacheUpdateJob::OnManifestDataReadComplete, |
| 1088 base::Unretained(this))); // read more | 1088 base::Unretained(this))); // read more |
| 1089 } else { | 1089 } else { |
| 1090 read_manifest_buffer_ = NULL; | 1090 read_manifest_buffer_ = NULL; |
| 1091 manifest_response_reader_.reset(); | 1091 manifest_response_reader_.reset(); |
| 1092 ContinueHandleManifestFetchCompleted( | 1092 ContinueHandleManifestFetchCompleted( |
| 1093 result < 0 || manifest_data_ != loaded_manifest_data_); | 1093 result < 0 || manifest_data_ != loaded_manifest_data_); |
| 1094 } | 1094 } |
| 1095 } | 1095 } |
| 1096 | 1096 |
| 1097 void AppCacheUpdateJob::BuildUrlFileList(const Manifest& manifest) { | 1097 void AppCacheUpdateJob::BuildUrlFileList(const AppCacheManifest& manifest) { |
| 1098 for (base::hash_set<std::string>::const_iterator it = | 1098 for (base::hash_set<std::string>::const_iterator it = |
| 1099 manifest.explicit_urls.begin(); | 1099 manifest.explicit_urls.begin(); |
| 1100 it != manifest.explicit_urls.end(); ++it) { | 1100 it != manifest.explicit_urls.end(); ++it) { |
| 1101 AddUrlToFileList(GURL(*it), AppCacheEntry::EXPLICIT); | 1101 AddUrlToFileList(GURL(*it), AppCacheEntry::EXPLICIT); |
| 1102 } | 1102 } |
| 1103 | 1103 |
| 1104 const std::vector<AppCacheNamespace>& intercepts = | 1104 const std::vector<AppCacheNamespace>& intercepts = |
| 1105 manifest.intercept_namespaces; | 1105 manifest.intercept_namespaces; |
| 1106 for (std::vector<AppCacheNamespace>::const_iterator it = intercepts.begin(); | 1106 for (std::vector<AppCacheNamespace>::const_iterator it = intercepts.begin(); |
| 1107 it != intercepts.end(); ++it) { | 1107 it != intercepts.end(); ++it) { |
| (...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1604 | 1604 |
| 1605 // Break the connection with the group so the group cannot call delete | 1605 // Break the connection with the group so the group cannot call delete |
| 1606 // on this object after we've posted a task to delete ourselves. | 1606 // on this object after we've posted a task to delete ourselves. |
| 1607 group_->SetUpdateAppCacheStatus(AppCacheGroup::IDLE); | 1607 group_->SetUpdateAppCacheStatus(AppCacheGroup::IDLE); |
| 1608 group_ = NULL; | 1608 group_ = NULL; |
| 1609 | 1609 |
| 1610 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 1610 base::MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
| 1611 } | 1611 } |
| 1612 | 1612 |
| 1613 } // namespace content | 1613 } // namespace content |
| OLD | NEW |