Index: content/child/child_thread_impl.cc |
diff --git a/content/child/child_thread_impl.cc b/content/child/child_thread_impl.cc |
index 308da5ede883910780b84b0e30aa878a1970cc5e..509348d988a8640c18f881ec98318c05916cccba 100644 |
--- a/content/child/child_thread_impl.cc |
+++ b/content/child/child_thread_impl.cc |
@@ -32,8 +32,8 @@ |
#include "base/timer/elapsed_timer.h" |
#include "base/tracked_objects.h" |
#include "build/build_config.h" |
+#include "components/discardable_memory/client/child_discardable_shared_memory_manager.h" |
#include "components/tracing/child/child_trace_message_filter.h" |
-#include "content/child/child_discardable_shared_memory_manager.h" |
#include "content/child/child_histogram_message_filter.h" |
#include "content/child/child_process.h" |
#include "content/child/child_resource_message_filter.h" |
@@ -354,6 +354,32 @@ bool ChildThreadImpl::ChildThreadMessageRouter::RouteMessage( |
return handled; |
} |
+class ChildThreadImpl::ChildDiscardableSharedMemoryManagerDelegate |
+ : public discardable_memory::ChildDiscardableSharedMemoryManager::Delegate { |
+ public: |
+ explicit ChildDiscardableSharedMemoryManagerDelegate( |
+ scoped_refptr<ThreadSafeSender> sender) |
+ : sender_(sender) {} |
+ ~ChildDiscardableSharedMemoryManagerDelegate() override {} |
+ |
+ void AllocateLockedDiscardableSharedMemory( |
+ size_t size, |
+ discardable_memory::DiscardableSharedMemoryId id, |
+ base::SharedMemoryHandle* handle) override { |
+ sender_->Send( |
+ new ChildProcessHostMsg_SyncAllocateLockedDiscardableSharedMemory( |
+ size, id, handle)); |
+ } |
+ |
+ void DeletedDiscardableSharedMemory( |
+ discardable_memory::DiscardableSharedMemoryId id) override { |
+ sender_->Send(new ChildProcessHostMsg_DeletedDiscardableSharedMemory(id)); |
+ } |
+ |
+ private: |
+ scoped_refptr<ThreadSafeSender> sender_; |
+}; |
+ |
ChildThreadImpl::ChildThreadImpl() |
: route_provider_binding_(this), |
associated_interface_provider_bindings_( |
@@ -564,8 +590,12 @@ void ChildThreadImpl::Init(const Options& options) { |
shared_bitmap_manager_.reset( |
new ChildSharedBitmapManager(thread_safe_sender())); |
- discardable_shared_memory_manager_.reset( |
- new ChildDiscardableSharedMemoryManager(thread_safe_sender())); |
+ child_discardable_shared_memory_manager_delegate_ = |
+ base::MakeUnique<ChildDiscardableSharedMemoryManagerDelegate>( |
+ thread_safe_sender()); |
+ discardable_shared_memory_manager_ = |
+ base::MakeUnique<discardable_memory::ChildDiscardableSharedMemoryManager>( |
+ child_discardable_shared_memory_manager_delegate_.get()); |
} |
ChildThreadImpl::~ChildThreadImpl() { |