Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(9457)

Unified Diff: content/child/child_thread_impl.cc

Issue 2459733002: Move discardable memory to //components from //content (Closed)
Patch Set: Fix build error Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « content/child/child_thread_impl.h ('k') | content/child/child_thread_impl_browsertest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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..927427d2d59ebb1036ed206723f3800312d0f9f4 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/client_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,33 @@ bool ChildThreadImpl::ChildThreadMessageRouter::RouteMessage(
return handled;
}
+class ChildThreadImpl::ClientDiscardableSharedMemoryManagerDelegate
+ : public discardable_memory::ClientDiscardableSharedMemoryManager::
+ Delegate {
+ public:
+ explicit ClientDiscardableSharedMemoryManagerDelegate(
+ scoped_refptr<ThreadSafeSender> sender)
+ : sender_(sender) {}
+ ~ClientDiscardableSharedMemoryManagerDelegate() 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 +591,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()));
+ client_discardable_shared_memory_manager_delegate_ =
+ base::MakeUnique<ClientDiscardableSharedMemoryManagerDelegate>(
+ thread_safe_sender());
+ discardable_shared_memory_manager_ = base::MakeUnique<
+ discardable_memory::ClientDiscardableSharedMemoryManager>(
+ client_discardable_shared_memory_manager_delegate_.get());
}
ChildThreadImpl::~ChildThreadImpl() {
« no previous file with comments | « content/child/child_thread_impl.h ('k') | content/child/child_thread_impl_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698