Commit 153e1323 authored by jbauman's avatar jbauman Committed by Commit bot

Do AllocateSharedMemory on FILE_USER_BLOCKING thread.

This operation requires accessing the filesystem on OS X and linux and could be slow.

BUG=466437

Review URL: https://codereview.chromium.org/1018953005

Cr-Commit-Position: refs/heads/master@{#321267}
parent d411ef29
......@@ -405,8 +405,8 @@ bool RenderMessageFilter::OnMessageReceived(const IPC::Message& message) {
RenderWidgetResizeHelper::Get()->PostRendererProcessMsg(
render_process_id_, message))
#endif
IPC_MESSAGE_HANDLER(ChildProcessHostMsg_SyncAllocateSharedMemory,
OnAllocateSharedMemory)
IPC_MESSAGE_HANDLER_DELAY_REPLY(
ChildProcessHostMsg_SyncAllocateSharedMemory, OnAllocateSharedMemory)
IPC_MESSAGE_HANDLER_DELAY_REPLY(
ChildProcessHostMsg_SyncAllocateSharedBitmap, OnAllocateSharedBitmap)
IPC_MESSAGE_HANDLER_DELAY_REPLY(
......@@ -909,11 +909,23 @@ void RenderMessageFilter::OnSaveImageFromDataURL(int render_view_id,
DownloadUrl(render_view_id, data_url, Referrer(), base::string16(), true);
}
void RenderMessageFilter::OnAllocateSharedMemory(
void RenderMessageFilter::AllocateSharedMemoryOnFileThread(
uint32 buffer_size,
base::SharedMemoryHandle* handle) {
ChildProcessHostImpl::AllocateSharedMemory(
buffer_size, PeerHandle(), handle);
IPC::Message* reply_msg) {
base::SharedMemoryHandle handle;
ChildProcessHostImpl::AllocateSharedMemory(buffer_size, PeerHandle(),
&handle);
ChildProcessHostMsg_SyncAllocateSharedMemory::WriteReplyParams(reply_msg,
handle);
Send(reply_msg);
}
void RenderMessageFilter::OnAllocateSharedMemory(uint32 buffer_size,
IPC::Message* reply_msg) {
BrowserThread::PostTask(
BrowserThread::FILE_USER_BLOCKING, FROM_HERE,
base::Bind(&RenderMessageFilter::AllocateSharedMemoryOnFileThread, this,
buffer_size, reply_msg));
}
void RenderMessageFilter::AllocateSharedBitmapOnFileThread(
......
......@@ -229,8 +229,9 @@ class CONTENT_EXPORT RenderMessageFilter : public BrowserMessageFilter {
// Used to ask the browser to allocate a block of shared memory for the
// renderer to send back data in, since shared memory can't be created
// in the renderer on POSIX due to the sandbox.
void OnAllocateSharedMemory(uint32 buffer_size,
base::SharedMemoryHandle* handle);
void AllocateSharedMemoryOnFileThread(uint32 buffer_size,
IPC::Message* reply_msg);
void OnAllocateSharedMemory(uint32 buffer_size, IPC::Message* reply_msg);
void AllocateSharedBitmapOnFileThread(uint32 buffer_size,
const cc::SharedBitmapId& id,
IPC::Message* reply_msg);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment