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

Unified Diff: content/child/child_thread_impl.cc

Issue 2545523007: Revert of discardable_memory: Using mojo IPC to replace Chrome IPC (Closed)
Patch Set: Created 4 years 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 2fba1bee8a04cd46510cc2a77c281ca2774dee5b..7f2755b3e00f3859bfe499adb57561c2686db6ca 100644
--- a/content/child/child_thread_impl.cc
+++ b/content/child/child_thread_impl.cc
@@ -32,6 +32,7 @@
#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_histogram_message_filter.h"
#include "content/child/child_process.h"
@@ -317,7 +318,8 @@
}
ChildThreadImpl::Options::Builder&
-ChildThreadImpl::Options::Builder::ConnectToBrowser(bool connect_to_browser) {
+ChildThreadImpl::Options::Builder::ConnectToBrowser(
+ bool connect_to_browser) {
options_.connect_to_browser = connect_to_browser;
return *this;
}
@@ -353,6 +355,33 @@
#endif
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),
@@ -377,7 +406,7 @@
Init(options);
}
-scoped_refptr<base::SingleThreadTaskRunner> ChildThreadImpl::GetIOTaskRunner() {
+scoped_refptr<base::SequencedTaskRunner> ChildThreadImpl::GetIOTaskRunner() {
if (IsInBrowserProcess())
return browser_process_io_runner_;
return ChildProcess::current()->io_task_runner();
@@ -564,6 +593,13 @@
shared_bitmap_manager_.reset(
new ChildSharedBitmapManager(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() {
@@ -592,6 +628,10 @@
file_system_dispatcher_.reset();
quota_dispatcher_.reset();
WebFileSystemImpl::DeleteThreadSpecificInstance();
+}
+
+void ChildThreadImpl::ShutdownDiscardableSharedMemoryManager() {
+ discardable_shared_memory_manager_.reset();
}
void ChildThreadImpl::OnChannelConnected(int32_t peer_pid) {
« 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