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

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

Issue 2549213005: Reland of placing 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 518575d28d883e0774493f7345669dba1a0f89e0..77b365da36b1da23a14444e5e3310da93a7cebdc 100644
--- a/content/browser/renderer_host/render_message_filter.cc
+++ b/content/browser/renderer_host/render_message_filter.cc
@@ -44,7 +44,6 @@
#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"
@@ -61,6 +60,7 @@
#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,8 +184,6 @@
// 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,
@@ -194,11 +192,6 @@
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)
@@ -327,39 +320,18 @@
#endif // defined(OS_MACOSX)
-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,
+void RenderMessageFilter::AllocatedSharedBitmap(
+ mojo::ScopedSharedBufferHandle buffer,
const cc::SharedBitmapId& id) {
- bitmap_manager_client_.ChildAllocatedSharedBitmap(buffer_size, handle, id);
-}
-
-void RenderMessageFilter::OnDeletedSharedBitmap(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_.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