| Index: components/discardable_memory/common/discardable_shared_memory_heap.cc
|
| diff --git a/components/discardable_memory/common/discardable_shared_memory_heap.cc b/components/discardable_memory/common/discardable_shared_memory_heap.cc
|
| index 7eacbeeec77e03d56bbe2efe6edd459c30cdc4d1..0bad4cf2532880ffa3dc4223b68b2d1cb4f638a6 100644
|
| --- a/components/discardable_memory/common/discardable_shared_memory_heap.cc
|
| +++ b/components/discardable_memory/common/discardable_shared_memory_heap.cc
|
| @@ -131,7 +131,7 @@ DiscardableSharedMemoryHeap::Grow(
|
| num_blocks_ += span->length_;
|
|
|
| // Start tracking if segment is resident by adding it to |memory_segments_|.
|
| - memory_segments_.push_back(base::MakeUnique<ScopedMemorySegment>(
|
| + memory_segments_.push_back(new ScopedMemorySegment(
|
| this, std::move(shared_memory), size, id, deleted_callback));
|
|
|
| return span;
|
| @@ -226,10 +226,9 @@ void DiscardableSharedMemoryHeap::ReleaseFreeMemory() {
|
| // Erase all free segments after rearranging the segments in such a way
|
| // that used segments precede all free segments.
|
| memory_segments_.erase(
|
| - std::partition(memory_segments_.begin(), memory_segments_.end(),
|
| - [](const std::unique_ptr<ScopedMemorySegment>& segment) {
|
| - return segment->IsUsed();
|
| - }),
|
| + std::partition(
|
| + memory_segments_.begin(), memory_segments_.end(),
|
| + [](const ScopedMemorySegment* segment) { return segment->IsUsed(); }),
|
| memory_segments_.end());
|
| }
|
|
|
| @@ -238,7 +237,7 @@ void DiscardableSharedMemoryHeap::ReleasePurgedMemory() {
|
| // that resident segments precede all purged segments.
|
| memory_segments_.erase(
|
| std::partition(memory_segments_.begin(), memory_segments_.end(),
|
| - [](const std::unique_ptr<ScopedMemorySegment>& segment) {
|
| + [](const ScopedMemorySegment* segment) {
|
| return segment->IsResident();
|
| }),
|
| memory_segments_.end());
|
| @@ -255,7 +254,7 @@ size_t DiscardableSharedMemoryHeap::GetSizeOfFreeLists() const {
|
| bool DiscardableSharedMemoryHeap::OnMemoryDump(
|
| base::trace_event::ProcessMemoryDump* pmd) {
|
| std::for_each(memory_segments_.begin(), memory_segments_.end(),
|
| - [pmd](const std::unique_ptr<ScopedMemorySegment>& segment) {
|
| + [pmd](const ScopedMemorySegment* segment) {
|
| segment->OnMemoryDump(pmd);
|
| });
|
| return true;
|
| @@ -467,9 +466,9 @@ DiscardableSharedMemoryHeap::CreateMemoryAllocatorDump(
|
| return dump;
|
| }
|
|
|
| - auto it =
|
| + ScopedVector<ScopedMemorySegment>::const_iterator it =
|
| std::find_if(memory_segments_.begin(), memory_segments_.end(),
|
| - [span](const std::unique_ptr<ScopedMemorySegment>& segment) {
|
| + [span](const ScopedMemorySegment* segment) {
|
| return segment->ContainsSpan(span);
|
| });
|
| DCHECK(it != memory_segments_.end());
|
|
|