Chromium Code Reviews| Index: components/discardable_memory/common/discardable_shared_memory_heap.cc |
| diff --git a/content/common/discardable_shared_memory_heap.cc b/components/discardable_memory/common/discardable_shared_memory_heap.cc |
| similarity index 97% |
| rename from content/common/discardable_shared_memory_heap.cc |
| rename to components/discardable_memory/common/discardable_shared_memory_heap.cc |
| index b6559af4c103d42b6c631631d76fa9e32847342c..c6e72b79996f7077539e8033311b2e98da4bc545 100644 |
| --- a/content/common/discardable_shared_memory_heap.cc |
| +++ b/components/discardable_memory/common/discardable_shared_memory_heap.cc |
| @@ -2,7 +2,7 @@ |
| // Use of this source code is governed by a BSD-style license that can be |
| // found in the LICENSE file. |
| -#include "content/common/discardable_shared_memory_heap.h" |
| +#include "components/discardable_memory/common/discardable_shared_memory_heap.h" |
| #include <algorithm> |
| #include <utility> |
| @@ -14,7 +14,7 @@ |
| #include "base/strings/stringprintf.h" |
| #include "base/trace_event/memory_dump_manager.h" |
| -namespace content { |
| +namespace discardable_memory { |
| namespace { |
| bool IsPowerOfTwo(size_t x) { |
| @@ -36,8 +36,7 @@ DiscardableSharedMemoryHeap::Span::Span( |
| length_(length), |
| is_locked_(false) {} |
| -DiscardableSharedMemoryHeap::Span::~Span() { |
| -} |
| +DiscardableSharedMemoryHeap::Span::~Span() {} |
| DiscardableSharedMemoryHeap::ScopedMemorySegment::ScopedMemorySegment( |
| DiscardableSharedMemoryHeap* heap, |
| @@ -254,11 +253,10 @@ size_t DiscardableSharedMemoryHeap::GetSizeOfFreeLists() const { |
| bool DiscardableSharedMemoryHeap::OnMemoryDump( |
| base::trace_event::ProcessMemoryDump* pmd) { |
| - std::for_each( |
| - memory_segments_.begin(), memory_segments_.end(), |
| - [pmd](const ScopedMemorySegment* segment) { |
| - segment->OnMemoryDump(pmd); |
| - }); |
| + std::for_each(memory_segments_.begin(), memory_segments_.end(), |
| + [pmd](const ScopedMemorySegment* segment) { |
| + segment->OnMemoryDump(pmd); |
| + }); |
| return true; |
| } |
| @@ -280,7 +278,7 @@ std::unique_ptr<DiscardableSharedMemoryHeap::Span> |
| DiscardableSharedMemoryHeap::Carve(Span* span, size_t blocks) { |
| std::unique_ptr<Span> serving = RemoveFromFreeList(span); |
| - const int extra = serving->length_ - blocks; |
| + const size_t extra = serving->length_ - blocks; |
|
reveman
2016/10/31 22:46:02
did you need this to fix the build? just curious
Peng
2016/11/01 14:26:18
Yes. It causes a warning on WIN build. Not sure wh
|
| if (extra) { |
| std::unique_ptr<Span> leftover( |
| new Span(serving->shared_memory_, serving->start_ + blocks, extra)); |
| @@ -474,4 +472,4 @@ DiscardableSharedMemoryHeap::CreateMemoryAllocatorDump( |
| return (*it)->CreateMemoryAllocatorDump(span, block_size_, name, pmd); |
| } |
| -} // namespace content |
| +} // namespace discardable_memory |