Add browser-wide discardable memory implementation.
[chromium-blink-merge.git] / content / child / child_discardable_shared_memory_manager.h
blobe35c57b4a269bad65805a281596e45eb024feb5e
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
3 // found in the LICENSE file.
5 #ifndef CONTENT_CHILD_CHILD_DISCARDABLE_SHARED_MEMORY_MANAGER_H_
6 #define CONTENT_CHILD_CHILD_DISCARDABLE_SHARED_MEMORY_MANAGER_H_
8 #include "base/memory/discardable_memory_shmem_allocator.h"
9 #include "base/memory/ref_counted.h"
10 #include "content/child/thread_safe_sender.h"
12 namespace content {
14 // Implementation of DiscardableMemoryShmemAllocator that allocates
15 // discardable memory segments through the browser process.
16 class ChildDiscardableSharedMemoryManager
17 : public base::DiscardableMemoryShmemAllocator {
18 public:
19 explicit ChildDiscardableSharedMemoryManager(ThreadSafeSender* sender);
20 ~ChildDiscardableSharedMemoryManager() override;
22 // Overridden from base::DiscardableMemoryShmemAllocator:
23 scoped_ptr<base::DiscardableSharedMemory>
24 AllocateLockedDiscardableSharedMemory(size_t size) override;
26 private:
27 scoped_refptr<ThreadSafeSender> sender_;
29 DISALLOW_COPY_AND_ASSIGN(ChildDiscardableSharedMemoryManager);
32 } // namespace content
34 #endif // CONTENT_CHILD_CHILD_DISCARDABLE_SHARED_MEMORY_MANAGER_H_