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

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

Issue 2017403003: Disable file operations on NACL builds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
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 736 matching lines...) Expand 10 before | Expand all | Expand 10 after
747 747
748 SharedPersistentMemoryAllocator::~SharedPersistentMemoryAllocator() {} 748 SharedPersistentMemoryAllocator::~SharedPersistentMemoryAllocator() {}
749 749
750 // static 750 // static
751 bool SharedPersistentMemoryAllocator::IsSharedMemoryAcceptable( 751 bool SharedPersistentMemoryAllocator::IsSharedMemoryAcceptable(
752 const SharedMemory& memory) { 752 const SharedMemory& memory) {
753 return IsMemoryAcceptable(memory.memory(), memory.mapped_size(), 0, false); 753 return IsMemoryAcceptable(memory.memory(), memory.mapped_size(), 0, false);
754 } 754 }
755 755
756 756
757 #if !defined(OS_NACL)
757 //----- FilePersistentMemoryAllocator ------------------------------------------ 758 //----- FilePersistentMemoryAllocator ------------------------------------------
758 759
759 FilePersistentMemoryAllocator::FilePersistentMemoryAllocator( 760 FilePersistentMemoryAllocator::FilePersistentMemoryAllocator(
760 std::unique_ptr<MemoryMappedFile> file, 761 std::unique_ptr<MemoryMappedFile> file,
761 size_t max_size, 762 size_t max_size,
762 uint64_t id, 763 uint64_t id,
763 base::StringPiece name, 764 base::StringPiece name,
764 bool read_only) 765 bool read_only)
765 : PersistentMemoryAllocator(const_cast<uint8_t*>(file->data()), 766 : PersistentMemoryAllocator(const_cast<uint8_t*>(file->data()),
766 max_size != 0 ? max_size : file->length(), 767 max_size != 0 ? max_size : file->length(),
767 0, 768 0,
768 id, 769 id,
769 name, 770 name,
770 read_only), 771 read_only),
771 mapped_file_(std::move(file)) {} 772 mapped_file_(std::move(file)) {}
772 773
773 FilePersistentMemoryAllocator::~FilePersistentMemoryAllocator() {} 774 FilePersistentMemoryAllocator::~FilePersistentMemoryAllocator() {}
774 775
775 // static 776 // static
776 bool FilePersistentMemoryAllocator::IsFileAcceptable( 777 bool FilePersistentMemoryAllocator::IsFileAcceptable(
777 const MemoryMappedFile& file, 778 const MemoryMappedFile& file,
778 bool read_only) { 779 bool read_only) {
779 return IsMemoryAcceptable(file.data(), file.length(), 0, read_only); 780 return IsMemoryAcceptable(file.data(), file.length(), 0, read_only);
780 } 781 }
782 #endif // !defined(OS_NACL)
781 783
782 } // namespace base 784 } // 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