| 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 "net/disk_cache/entry_impl.h" | 5 #include "net/disk_cache/entry_impl.h" |
| 6 | 6 |
| 7 #include "base/hash.h" | 7 #include "base/hash.h" |
| 8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
| 9 #include "base/metrics/histogram.h" | 9 #include "base/metrics/histogram.h" |
| 10 #include "base/string_util.h" | 10 #include "base/string_util.h" |
| (...skipping 433 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 node->dirty = backend_->GetCurrentEntryId(); | 444 node->dirty = backend_->GetCurrentEntryId(); |
| 445 Log("Create Entry "); | 445 Log("Create Entry "); |
| 446 return true; | 446 return true; |
| 447 } | 447 } |
| 448 | 448 |
| 449 bool EntryImpl::IsSameEntry(const std::string& key, uint32 hash) { | 449 bool EntryImpl::IsSameEntry(const std::string& key, uint32 hash) { |
| 450 if (entry_.Data()->hash != hash || | 450 if (entry_.Data()->hash != hash || |
| 451 static_cast<size_t>(entry_.Data()->key_len) != key.size()) | 451 static_cast<size_t>(entry_.Data()->key_len) != key.size()) |
| 452 return false; | 452 return false; |
| 453 | 453 |
| 454 std::string my_key = GetKey(); | 454 return (key.compare(GetKey()) == 0); |
| 455 return key.compare(my_key) ? false : true; | |
| 456 } | 455 } |
| 457 | 456 |
| 458 void EntryImpl::InternalDoom() { | 457 void EntryImpl::InternalDoom() { |
| 459 net_log_.AddEvent(net::NetLog::TYPE_ENTRY_DOOM); | 458 net_log_.AddEvent(net::NetLog::TYPE_ENTRY_DOOM); |
| 460 DCHECK(node_.HasData()); | 459 DCHECK(node_.HasData()); |
| 461 if (!node_.Data()->dirty) { | 460 if (!node_.Data()->dirty) { |
| 462 node_.Data()->dirty = backend_->GetCurrentEntryId(); | 461 node_.Data()->dirty = backend_->GetCurrentEntryId(); |
| 463 node_.Store(); | 462 node_.Store(); |
| 464 } | 463 } |
| 465 doomed_ = true; | 464 doomed_ = true; |
| (...skipping 1072 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1538 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this), | 1537 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this), |
| 1539 entry_.address().value(), node_.address().value()); | 1538 entry_.address().value(), node_.address().value()); |
| 1540 | 1539 |
| 1541 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0], | 1540 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0], |
| 1542 entry_.Data()->data_addr[1], entry_.Data()->long_key); | 1541 entry_.Data()->data_addr[1], entry_.Data()->long_key); |
| 1543 | 1542 |
| 1544 Trace(" doomed: %d 0x%x", doomed_, dirty); | 1543 Trace(" doomed: %d 0x%x", doomed_, dirty); |
| 1545 } | 1544 } |
| 1546 | 1545 |
| 1547 } // namespace disk_cache | 1546 } // namespace disk_cache |
| OLD | NEW |