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) { ...@@ -405,8 +405,8 @@ bool RenderMessageFilter::OnMessageReceived(const IPC::Message& message) {
RenderWidgetResizeHelper::Get()->PostRendererProcessMsg( RenderWidgetResizeHelper::Get()->PostRendererProcessMsg(
render_process_id_, message)) render_process_id_, message))
#endif #endif
IPC_MESSAGE_HANDLER(ChildProcessHostMsg_SyncAllocateSharedMemory, IPC_MESSAGE_HANDLER_DELAY_REPLY(
OnAllocateSharedMemory) ChildProcessHostMsg_SyncAllocateSharedMemory, OnAllocateSharedMemory)
IPC_MESSAGE_HANDLER_DELAY_REPLY( IPC_MESSAGE_HANDLER_DELAY_REPLY(
ChildProcessHostMsg_SyncAllocateSharedBitmap, OnAllocateSharedBitmap) ChildProcessHostMsg_SyncAllocateSharedBitmap, OnAllocateSharedBitmap)
IPC_MESSAGE_HANDLER_DELAY_REPLY( IPC_MESSAGE_HANDLER_DELAY_REPLY(
...@@ -909,11 +909,23 @@ void RenderMessageFilter::OnSaveImageFromDataURL(int render_view_id, ...@@ -909,11 +909,23 @@ void RenderMessageFilter::OnSaveImageFromDataURL(int render_view_id,
DownloadUrl(render_view_id, data_url, Referrer(), base::string16(), true); DownloadUrl(render_view_id, data_url, Referrer(), base::string16(), true);
} }
void RenderMessageFilter::OnAllocateSharedMemory( void RenderMessageFilter::AllocateSharedMemoryOnFileThread(
uint32 buffer_size, uint32 buffer_size,
base::SharedMemoryHandle* handle) { IPC::Message* reply_msg) {
ChildProcessHostImpl::AllocateSharedMemory( base::SharedMemoryHandle handle;
buffer_size, PeerHandle(), 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( void RenderMessageFilter::AllocateSharedBitmapOnFileThread(
......
...@@ -229,8 +229,9 @@ class CONTENT_EXPORT RenderMessageFilter : public BrowserMessageFilter { ...@@ -229,8 +229,9 @@ class CONTENT_EXPORT RenderMessageFilter : public BrowserMessageFilter {
// Used to ask the browser to allocate a block of shared memory for the // 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 // renderer to send back data in, since shared memory can't be created
// in the renderer on POSIX due to the sandbox. // in the renderer on POSIX due to the sandbox.
void OnAllocateSharedMemory(uint32 buffer_size, void AllocateSharedMemoryOnFileThread(uint32 buffer_size,
base::SharedMemoryHandle* handle); IPC::Message* reply_msg);
void OnAllocateSharedMemory(uint32 buffer_size, IPC::Message* reply_msg);
void AllocateSharedBitmapOnFileThread(uint32 buffer_size, void AllocateSharedBitmapOnFileThread(uint32 buffer_size,
const cc::SharedBitmapId& id, const cc::SharedBitmapId& id,
IPC::Message* reply_msg); 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