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

Unified Diff: content/browser/renderer_host/render_message_filter.cc

Issue 2552913003: Revert of Replacing allocate bitmap IPC messages with a new Mojo interface. (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/browser/renderer_host/render_message_filter.h ('k') | content/child/child_shared_bitmap_manager.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/renderer_host/render_message_filter.cc
diff --git a/content/browser/renderer_host/render_message_filter.cc b/content/browser/renderer_host/render_message_filter.cc
index 77b365da36b1da23a14444e5e3310da93a7cebdc..518575d28d883e0774493f7345669dba1a0f89e0 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -44,6 +44,7 @@
#include "content/common/child_process_host_impl.h"
#include "content/common/child_process_messages.h"
#include "content/common/content_constants_internal.h"
+#include "content/common/host_shared_bitmap_manager.h"
#include "content/common/render_message_filter.mojom.h"
#include "content/common/render_process_messages.h"
#include "content/common/view_messages.h"
@@ -60,7 +61,6 @@
#include "ipc/ipc_channel_handle.h"
#include "ipc/ipc_platform_file.h"
#include "media/base/media_log_event.h"
-#include "mojo/public/cpp/system/platform_handle.h"
#include "net/base/io_buffer.h"
#include "net/base/keygen_handler.h"
#include "net/base/mime_util.h"
@@ -184,6 +184,8 @@
// handled here for renderer processes. For non-renderer child processes,
// they are handled in ChildProcessHostImpl.
IPC_MESSAGE_HANDLER_DELAY_REPLY(
+ ChildProcessHostMsg_SyncAllocateSharedBitmap, OnAllocateSharedBitmap)
+ IPC_MESSAGE_HANDLER_DELAY_REPLY(
ChildProcessHostMsg_SyncAllocateGpuMemoryBuffer,
OnAllocateGpuMemoryBuffer)
IPC_MESSAGE_HANDLER_DELAY_REPLY(ChildProcessHostMsg_EstablishGpuChannel,
@@ -192,6 +194,11 @@
OnHasGpuProcess)
IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DeletedGpuMemoryBuffer,
OnDeletedGpuMemoryBuffer)
+ IPC_MESSAGE_HANDLER(ChildProcessHostMsg_AllocatedSharedBitmap,
+ OnAllocatedSharedBitmap)
+ IPC_MESSAGE_HANDLER(ChildProcessHostMsg_DeletedSharedBitmap,
+ OnDeletedSharedBitmap)
+
#if defined(OS_LINUX)
IPC_MESSAGE_HANDLER(ChildProcessHostMsg_SetThreadPriority,
OnSetThreadPriority)
@@ -320,18 +327,39 @@
#endif // defined(OS_MACOSX)
-void RenderMessageFilter::AllocatedSharedBitmap(
- mojo::ScopedSharedBufferHandle buffer,
+void RenderMessageFilter::AllocateSharedBitmapOnFileThread(
+ uint32_t buffer_size,
+ const cc::SharedBitmapId& id,
+ IPC::Message* reply_msg) {
+ base::SharedMemoryHandle handle;
+ bitmap_manager_client_.AllocateSharedBitmapForChild(PeerHandle(), buffer_size,
+ id, &handle);
+ ChildProcessHostMsg_SyncAllocateSharedBitmap::WriteReplyParams(reply_msg,
+ handle);
+ Send(reply_msg);
+}
+
+void RenderMessageFilter::OnAllocateSharedBitmap(uint32_t buffer_size,
+ const cc::SharedBitmapId& id,
+ IPC::Message* reply_msg) {
+ BrowserThread::PostTask(
+ BrowserThread::FILE_USER_BLOCKING,
+ FROM_HERE,
+ base::Bind(&RenderMessageFilter::AllocateSharedBitmapOnFileThread,
+ this,
+ buffer_size,
+ id,
+ reply_msg));
+}
+
+void RenderMessageFilter::OnAllocatedSharedBitmap(
+ size_t buffer_size,
+ const base::SharedMemoryHandle& handle,
const cc::SharedBitmapId& id) {
- base::SharedMemoryHandle memory_handle;
- size_t size;
- MojoResult result = mojo::UnwrapSharedMemoryHandle(
- std::move(buffer), &memory_handle, &size, NULL);
- DCHECK_EQ(result, MOJO_RESULT_OK);
- bitmap_manager_client_.ChildAllocatedSharedBitmap(size, memory_handle, id);
-}
-
-void RenderMessageFilter::DeletedSharedBitmap(const cc::SharedBitmapId& id) {
+ bitmap_manager_client_.ChildAllocatedSharedBitmap(buffer_size, handle, id);
+}
+
+void RenderMessageFilter::OnDeletedSharedBitmap(const cc::SharedBitmapId& id) {
bitmap_manager_client_.ChildDeletedSharedBitmap(id);
}
« no previous file with comments | « content/browser/renderer_host/render_message_filter.h ('k') | content/child/child_shared_bitmap_manager.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698