Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(883)

Side by Side Diff: net/disk_cache/entry_impl.cc

Issue 6292011: Disk cache: Prevent obscure file corruption and deal... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2006-2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-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/disk_cache/entry_impl.h" 5 #include "net/disk_cache/entry_impl.h"
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "base/metrics/histogram.h" 8 #include "base/metrics/histogram.h"
9 #include "base/string_util.h" 9 #include "base/string_util.h"
10 #include "base/values.h" 10 #include "base/values.h"
(...skipping 571 matching lines...) Expand 10 before | Expand all | Expand 10 after
582 582
583 backend_->DeleteBlock(node_.address(), false); 583 backend_->DeleteBlock(node_.address(), false);
584 backend_->DeleteBlock(entry_.address(), false); 584 backend_->DeleteBlock(entry_.address(), false);
585 } 585 }
586 586
587 CacheAddr EntryImpl::GetNextAddress() { 587 CacheAddr EntryImpl::GetNextAddress() {
588 return entry_.Data()->next; 588 return entry_.Data()->next;
589 } 589 }
590 590
591 void EntryImpl::SetNextAddress(Addr address) { 591 void EntryImpl::SetNextAddress(Addr address) {
592 DCHECK_NE(address.value(), entry_.address().value());
592 entry_.Data()->next = address.value(); 593 entry_.Data()->next = address.value();
593 bool success = entry_.Store(); 594 bool success = entry_.Store();
594 DCHECK(success); 595 DCHECK(success);
595 } 596 }
596 597
597 bool EntryImpl::LoadNodeAddress() { 598 bool EntryImpl::LoadNodeAddress() {
598 Addr address(entry_.Data()->rankings_node); 599 Addr address(entry_.Data()->rankings_node);
599 if (!node_.LazyInit(backend_->File(address), address)) 600 if (!node_.LazyInit(backend_->File(address), address))
600 return false; 601 return false;
601 return node_.Load(); 602 return node_.Load();
(...skipping 833 matching lines...) Expand 10 before | Expand all | Expand 10 after
1435 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this), 1436 Trace("%s 0x%p 0x%x 0x%x", msg, reinterpret_cast<void*>(this),
1436 entry_.address().value(), node_.address().value()); 1437 entry_.address().value(), node_.address().value());
1437 1438
1438 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0], 1439 Trace(" data: 0x%x 0x%x 0x%x", entry_.Data()->data_addr[0],
1439 entry_.Data()->data_addr[1], entry_.Data()->long_key); 1440 entry_.Data()->data_addr[1], entry_.Data()->long_key);
1440 1441
1441 Trace(" doomed: %d 0x%x", doomed_, dirty); 1442 Trace(" doomed: %d 0x%x", doomed_, dirty);
1442 } 1443 }
1443 1444
1444 } // namespace disk_cache 1445 } // namespace disk_cache
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698