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

Side by Side Diff: base/metrics/persistent_memory_allocator.cc

Issue 1852433005: Convert //base to use std::unique_ptr (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase after r384946 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 (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 "base/metrics/persistent_memory_allocator.h" 5 #include "base/metrics/persistent_memory_allocator.h"
6 6
7 #include <assert.h> 7 #include <assert.h>
8 #include <algorithm> 8 #include <algorithm>
9 9
10 #include "base/files/memory_mapped_file.h" 10 #include "base/files/memory_mapped_file.h"
(...skipping 650 matching lines...) Expand 10 before | Expand all | Expand 10 after
661 size, 0, id, name, false) {} 661 size, 0, id, name, false) {}
662 662
663 LocalPersistentMemoryAllocator::~LocalPersistentMemoryAllocator() { 663 LocalPersistentMemoryAllocator::~LocalPersistentMemoryAllocator() {
664 delete [] mem_base_; 664 delete [] mem_base_;
665 } 665 }
666 666
667 667
668 //----- SharedPersistentMemoryAllocator ---------------------------------------- 668 //----- SharedPersistentMemoryAllocator ----------------------------------------
669 669
670 SharedPersistentMemoryAllocator::SharedPersistentMemoryAllocator( 670 SharedPersistentMemoryAllocator::SharedPersistentMemoryAllocator(
671 scoped_ptr<SharedMemory> memory, 671 std::unique_ptr<SharedMemory> memory,
672 uint64_t id, 672 uint64_t id,
673 base::StringPiece name, 673 base::StringPiece name,
674 bool read_only) 674 bool read_only)
675 : PersistentMemoryAllocator(static_cast<uint8_t*>(memory->memory()), 675 : PersistentMemoryAllocator(static_cast<uint8_t*>(memory->memory()),
676 memory->mapped_size(), 0, id, name, read_only), 676 memory->mapped_size(),
677 0,
678 id,
679 name,
680 read_only),
677 shared_memory_(std::move(memory)) {} 681 shared_memory_(std::move(memory)) {}
678 682
679 SharedPersistentMemoryAllocator::~SharedPersistentMemoryAllocator() {} 683 SharedPersistentMemoryAllocator::~SharedPersistentMemoryAllocator() {}
680 684
681 // static 685 // static
682 bool SharedPersistentMemoryAllocator::IsSharedMemoryAcceptable( 686 bool SharedPersistentMemoryAllocator::IsSharedMemoryAcceptable(
683 const SharedMemory& memory) { 687 const SharedMemory& memory) {
684 return IsMemoryAcceptable(memory.memory(), memory.mapped_size(), 0, true); 688 return IsMemoryAcceptable(memory.memory(), memory.mapped_size(), 0, true);
685 } 689 }
686 690
687 691
688 //----- FilePersistentMemoryAllocator ------------------------------------------ 692 //----- FilePersistentMemoryAllocator ------------------------------------------
689 693
690 FilePersistentMemoryAllocator::FilePersistentMemoryAllocator( 694 FilePersistentMemoryAllocator::FilePersistentMemoryAllocator(
691 scoped_ptr<MemoryMappedFile> file, 695 std::unique_ptr<MemoryMappedFile> file,
692 uint64_t id, 696 uint64_t id,
693 base::StringPiece name) 697 base::StringPiece name)
694 : PersistentMemoryAllocator(const_cast<uint8_t*>(file->data()), 698 : PersistentMemoryAllocator(const_cast<uint8_t*>(file->data()),
695 file->length(), 0, id, name, true), 699 file->length(),
700 0,
701 id,
702 name,
703 true),
696 mapped_file_(std::move(file)) {} 704 mapped_file_(std::move(file)) {}
697 705
698 FilePersistentMemoryAllocator::~FilePersistentMemoryAllocator() {} 706 FilePersistentMemoryAllocator::~FilePersistentMemoryAllocator() {}
699 707
700 // static 708 // static
701 bool FilePersistentMemoryAllocator::IsFileAcceptable( 709 bool FilePersistentMemoryAllocator::IsFileAcceptable(
702 const MemoryMappedFile& file) { 710 const MemoryMappedFile& file) {
703 return IsMemoryAcceptable(file.data(), file.length(), 0, true); 711 return IsMemoryAcceptable(file.data(), file.length(), 0, true);
704 } 712 }
705 713
706 } // namespace base 714 } // namespace base
OLDNEW
« no previous file with comments | « base/metrics/persistent_memory_allocator.h ('k') | base/metrics/persistent_memory_allocator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698