OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "content/child/child_discardable_shared_memory_manager.h" | 5 #include "content/child/child_discardable_shared_memory_manager.h" |
6 | 6 |
7 #include "base/memory/discardable_shared_memory.h" | 7 #include "base/memory/discardable_shared_memory.h" |
8 #include "base/process/process_metrics.h" | 8 #include "base/process/process_metrics.h" |
9 #include "content/child/child_thread.h" | |
10 #include "content/common/child_process_messages.h" | 9 #include "content/common/child_process_messages.h" |
11 | 10 |
12 namespace content { | 11 namespace content { |
13 namespace { | 12 namespace { |
14 | 13 |
15 // Default allocation size. | 14 // Default allocation size. |
16 const size_t kAllocationSize = 4 * 1024 * 1024; | 15 const size_t kAllocationSize = 4 * 1024 * 1024; |
17 | 16 |
18 class DiscardableMemoryShmemChunkImpl | 17 class DiscardableMemoryShmemChunkImpl |
19 : public base::DiscardableMemoryShmemChunk { | 18 : public base::DiscardableMemoryShmemChunk { |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 sender_->Send( | 176 sender_->Send( |
178 new ChildProcessHostMsg_SyncAllocateLockedDiscardableSharedMemory( | 177 new ChildProcessHostMsg_SyncAllocateLockedDiscardableSharedMemory( |
179 size, &handle)); | 178 size, &handle)); |
180 scoped_ptr<base::DiscardableSharedMemory> memory( | 179 scoped_ptr<base::DiscardableSharedMemory> memory( |
181 new base::DiscardableSharedMemory(handle)); | 180 new base::DiscardableSharedMemory(handle)); |
182 CHECK(memory->Map(size)); | 181 CHECK(memory->Map(size)); |
183 return memory.Pass(); | 182 return memory.Pass(); |
184 } | 183 } |
185 | 184 |
186 } // namespace content | 185 } // namespace content |
OLD | NEW |