| 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 "net/http/http_cache.h" | 5 #include "net/http/http_cache.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 | 8 |
| 9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
| 10 | 10 |
| (...skipping 387 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 398 } | 398 } |
| 399 | 399 |
| 400 void HttpCache::Suspend(bool suspend) { | 400 void HttpCache::Suspend(bool suspend) { |
| 401 network_layer_->Suspend(suspend); | 401 network_layer_->Suspend(suspend); |
| 402 } | 402 } |
| 403 | 403 |
| 404 // static | 404 // static |
| 405 bool HttpCache::ParseResponseInfo(const char* data, int len, | 405 bool HttpCache::ParseResponseInfo(const char* data, int len, |
| 406 HttpResponseInfo* response_info, | 406 HttpResponseInfo* response_info, |
| 407 bool* response_truncated) { | 407 bool* response_truncated) { |
| 408 // This block is here just to debug a Linux-only crash (bug 56449). | |
| 409 // TODO(rvargas): Remove this. | |
| 410 if (len < 4) | |
| 411 return false; | |
| 412 int payload_size = *reinterpret_cast<const int*>(data); | |
| 413 if (payload_size < 4) | |
| 414 return false; | |
| 415 | |
| 416 Pickle pickle(data, len); | 408 Pickle pickle(data, len); |
| 417 return response_info->InitFromPickle(pickle, response_truncated); | 409 return response_info->InitFromPickle(pickle, response_truncated); |
| 418 } | 410 } |
| 419 | 411 |
| 420 void HttpCache::WriteMetadata(const GURL& url, | 412 void HttpCache::WriteMetadata(const GURL& url, |
| 421 base::Time expected_response_time, IOBuffer* buf, | 413 base::Time expected_response_time, IOBuffer* buf, |
| 422 int buf_len) { | 414 int buf_len) { |
| 423 if (!buf_len) | 415 if (!buf_len) |
| 424 return; | 416 return; |
| 425 | 417 |
| (...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1096 building_backend_ = false; | 1088 building_backend_ = false; |
| 1097 DeletePendingOp(pending_op); | 1089 DeletePendingOp(pending_op); |
| 1098 } | 1090 } |
| 1099 | 1091 |
| 1100 // The cache may be gone when we return from the callback. | 1092 // The cache may be gone when we return from the callback. |
| 1101 if (!item->DoCallback(result, backend)) | 1093 if (!item->DoCallback(result, backend)) |
| 1102 item->NotifyTransaction(result, NULL); | 1094 item->NotifyTransaction(result, NULL); |
| 1103 } | 1095 } |
| 1104 | 1096 |
| 1105 } // namespace net | 1097 } // namespace net |
| OLD | NEW |