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

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

Issue 17948002: Update Linux to use scoped_refptr<T>::get() rather than implicit "operator T*" (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebased Created 7 years, 6 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
« no previous file with comments | « net/cert/x509_certificate.cc ('k') | net/disk_cache/simple/simple_backend_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/block_files.h" 5 #include "net/disk_cache/block_files.h"
6 6
7 #include "base/atomicops.h" 7 #include "base/atomicops.h"
8 #include "base/files/file_path.h" 8 #include "base/files/file_path.h"
9 #include "base/metrics/histogram.h" 9 #include "base/metrics/histogram.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 LOG(ERROR) << "Failed to open " << name.value(); 443 LOG(ERROR) << "Failed to open " << name.value();
444 return false; 444 return false;
445 } 445 }
446 446
447 size_t file_len = file->GetLength(); 447 size_t file_len = file->GetLength();
448 if (file_len < static_cast<size_t>(kBlockHeaderSize)) { 448 if (file_len < static_cast<size_t>(kBlockHeaderSize)) {
449 LOG(ERROR) << "File too small " << name.value(); 449 LOG(ERROR) << "File too small " << name.value();
450 return false; 450 return false;
451 } 451 }
452 452
453 BlockHeader header(file); 453 BlockHeader header(file.get());
454 if (kBlockMagic != header->magic || kBlockVersion2 != header->version) { 454 if (kBlockMagic != header->magic || kBlockVersion2 != header->version) {
455 LOG(ERROR) << "Invalid file version or magic " << name.value(); 455 LOG(ERROR) << "Invalid file version or magic " << name.value();
456 return false; 456 return false;
457 } 457 }
458 458
459 if (header->updating || !header.ValidateCounters()) { 459 if (header->updating || !header.ValidateCounters()) {
460 // Last instance was not properly shutdown, or counters are out of sync. 460 // Last instance was not properly shutdown, or counters are out of sync.
461 if (!FixBlockFileHeader(file.get())) { 461 if (!FixBlockFileHeader(file.get())) {
462 LOG(ERROR) << "Unable to fix block file " << name.value(); 462 LOG(ERROR) << "Unable to fix block file " << name.value();
463 return false; 463 return false;
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
686 } 686 }
687 687
688 base::FilePath BlockFiles::Name(int index) { 688 base::FilePath BlockFiles::Name(int index) {
689 // The file format allows for 256 files. 689 // The file format allows for 256 files.
690 DCHECK(index < 256 || index >= 0); 690 DCHECK(index < 256 || index >= 0);
691 std::string tmp = base::StringPrintf("%s%d", kBlockName, index); 691 std::string tmp = base::StringPrintf("%s%d", kBlockName, index);
692 return path_.AppendASCII(tmp); 692 return path_.AppendASCII(tmp);
693 } 693 }
694 694
695 } // namespace disk_cache 695 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/cert/x509_certificate.cc ('k') | net/disk_cache/simple/simple_backend_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698