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

Side by Side Diff: net/disk_cache/blockfile/mapped_file.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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/mapped_file.h" 5 #include "net/disk_cache/blockfile/mapped_file.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8 #include <memory>
9 #include "base/memory/scoped_ptr.h"
10 9
11 namespace disk_cache { 10 namespace disk_cache {
12 11
13 // Note: Most of this class is implemented in platform-specific files. 12 // Note: Most of this class is implemented in platform-specific files.
14 13
15 bool MappedFile::Load(const FileBlock* block) { 14 bool MappedFile::Load(const FileBlock* block) {
16 size_t offset = block->offset() + view_size_; 15 size_t offset = block->offset() + view_size_;
17 return Read(block->buffer(), block->size(), offset); 16 return Read(block->buffer(), block->size(), offset);
18 } 17 }
19 18
(...skipping 11 matching lines...) Expand all
31 30
32 bool MappedFile::Store(const FileBlock* block, 31 bool MappedFile::Store(const FileBlock* block,
33 FileIOCallback* callback, 32 FileIOCallback* callback,
34 bool* completed) { 33 bool* completed) {
35 size_t offset = block->offset() + view_size_; 34 size_t offset = block->offset() + view_size_;
36 return Write(block->buffer(), block->size(), offset, callback, completed); 35 return Write(block->buffer(), block->size(), offset, callback, completed);
37 } 36 }
38 37
39 bool MappedFile::Preload() { 38 bool MappedFile::Preload() {
40 size_t file_len = GetLength(); 39 size_t file_len = GetLength();
41 scoped_ptr<char[]> buf(new char[file_len]); 40 std::unique_ptr<char[]> buf(new char[file_len]);
42 if (!Read(buf.get(), file_len, 0)) 41 if (!Read(buf.get(), file_len, 0))
43 return false; 42 return false;
44 return true; 43 return true;
45 } 44 }
46 } // namespace disk_cache 45 } // namespace disk_cache
OLDNEW
« no previous file with comments | « net/disk_cache/blockfile/index_table_v3_unittest.cc ('k') | net/disk_cache/blockfile/mapped_file_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698