OLD | NEW |
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 "base/stringprintf.h" |
(...skipping 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1173 const GURL& url = found->second; | 1173 const GURL& url = found->second; |
1174 | 1174 |
1175 if (!http_info) { | 1175 if (!http_info) { |
1176 LoadFromNewestCacheFailed(url, NULL); // no response found | 1176 LoadFromNewestCacheFailed(url, NULL); // no response found |
1177 } else { | 1177 } else { |
1178 // Check if response can be re-used according to HTTP caching semantics. | 1178 // Check if response can be re-used according to HTTP caching semantics. |
1179 // Responses with a "vary" header get treated as expired. | 1179 // Responses with a "vary" header get treated as expired. |
1180 const std::string name = "vary"; | 1180 const std::string name = "vary"; |
1181 std::string value; | 1181 std::string value; |
1182 void* iter = NULL; | 1182 void* iter = NULL; |
1183 if (http_info->headers->RequiresValidation(http_info->request_time, | 1183 if (!http_info->headers || |
| 1184 http_info->headers->RequiresValidation(http_info->request_time, |
1184 http_info->response_time, | 1185 http_info->response_time, |
1185 base::Time::Now()) || | 1186 base::Time::Now()) || |
1186 http_info->headers->EnumerateHeader(&iter, name, &value)) { | 1187 http_info->headers->EnumerateHeader(&iter, name, &value)) { |
1187 LoadFromNewestCacheFailed(url, response_info); | 1188 LoadFromNewestCacheFailed(url, response_info); |
1188 } else { | 1189 } else { |
1189 DCHECK(group_->newest_complete_cache()); | 1190 DCHECK(group_->newest_complete_cache()); |
1190 AppCacheEntry* copy_me = group_->newest_complete_cache()->GetEntry(url); | 1191 AppCacheEntry* copy_me = group_->newest_complete_cache()->GetEntry(url); |
1191 DCHECK(copy_me); | 1192 DCHECK(copy_me); |
1192 DCHECK(copy_me->response_id() == response_id); | 1193 DCHECK(copy_me->response_id() == response_id); |
1193 | 1194 |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1353 | 1354 |
1354 // 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 |
1355 // 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. |
1356 group_->SetUpdateStatus(AppCacheGroup::IDLE); | 1357 group_->SetUpdateStatus(AppCacheGroup::IDLE); |
1357 group_ = NULL; | 1358 group_ = NULL; |
1358 | 1359 |
1359 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 1360 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
1360 } | 1361 } |
1361 | 1362 |
1362 } // namespace appcache | 1363 } // namespace appcache |
OLD | NEW |