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

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

Issue 1894733002: Change scoped_ptr to std::unique_ptr in //net/disk_cache. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « net/disk_cache/blockfile/block_files.h ('k') | net/disk_cache/blockfile/disk_cache_perftest.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/blockfile/block_files.h" 5 #include "net/disk_cache/blockfile/block_files.h"
6 6
7 #include <limits> 7 #include <limits>
8 8
9 #include "base/atomicops.h" 9 #include "base/atomicops.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 414 matching lines...) Expand 10 before | Expand all | Expand 10 after
425 MappedFile* file = GetFile(address); 425 MappedFile* file = GetFile(address);
426 if (!file) 426 if (!file)
427 return false; 427 return false;
428 428
429 BlockHeader header(file); 429 BlockHeader header(file);
430 bool rv = header.UsedMapBlock(address.start_block(), address.num_blocks()); 430 bool rv = header.UsedMapBlock(address.start_block(), address.num_blocks());
431 DCHECK(rv); 431 DCHECK(rv);
432 432
433 static bool read_contents = false; 433 static bool read_contents = false;
434 if (read_contents) { 434 if (read_contents) {
435 scoped_ptr<char[]> buffer; 435 std::unique_ptr<char[]> buffer;
436 buffer.reset(new char[Addr::BlockSizeForFileType(BLOCK_4K) * 4]); 436 buffer.reset(new char[Addr::BlockSizeForFileType(BLOCK_4K) * 4]);
437 size_t size = address.BlockSize() * address.num_blocks(); 437 size_t size = address.BlockSize() * address.num_blocks();
438 size_t offset = address.start_block() * address.BlockSize() + 438 size_t offset = address.start_block() * address.BlockSize() +
439 kBlockHeaderSize; 439 kBlockHeaderSize;
440 bool ok = file->Read(buffer.get(), size, offset); 440 bool ok = file->Read(buffer.get(), size, offset);
441 DCHECK(ok); 441 DCHECK(ok);
442 } 442 }
443 443
444 return rv; 444 return rv;
445 #endif 445 #endif
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after
724 } 724 }
725 725
726 base::FilePath BlockFiles::Name(int index) { 726 base::FilePath BlockFiles::Name(int index) {
727 // The file format allows for 256 files. 727 // The file format allows for 256 files.
728 DCHECK(index < 256 && index >= 0); 728 DCHECK(index < 256 && index >= 0);
729 std::string tmp = base::StringPrintf("%s%d", kBlockName, index); 729 std::string tmp = base::StringPrintf("%s%d", kBlockName, index);
730 return path_.AppendASCII(tmp); 730 return path_.AppendASCII(tmp);
731 } 731 }
732 732
733 } // namespace disk_cache 733 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/blockfile/block_files.h ('k') | net/disk_cache/blockfile/disk_cache_perftest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698