Commit 5a9a39b7 authored by penghuang's avatar penghuang Committed by Commit bot

Hold the Pepper proxy lock for all Pepper GL calls.

BUG=418651

Committed: https://crrev.com/057f7a69dd40c93550b375b4287dba70d719316a
Cr-Commit-Position: refs/heads/master@{#302303}

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

Cr-Commit-Position: refs/heads/master@{#303658}
parent dfb61d8d
......@@ -211,6 +211,15 @@ bool PluginDispatcher::Send(IPC::Message* msg) {
return SendMessage(msg);
}
bool PluginDispatcher::SendAndStayLocked(IPC::Message* msg) {
TRACE_EVENT2("ppapi proxy", "PluginDispatcher::SendAndStayLocked",
"Class", IPC_MESSAGE_ID_CLASS(msg->type()),
"Line", IPC_MESSAGE_ID_LINE(msg->type()));
if (!msg->is_reply())
msg->set_unblock(true);
return SendMessage(msg);
}
bool PluginDispatcher::OnMessageReceived(const IPC::Message& msg) {
// We need to grab the proxy lock to ensure that we don't collide with the
// plugin making pepper calls on a different thread.
......
......@@ -140,12 +140,15 @@ class PPAPI_PROXY_EXPORT PluginDispatcher
bool is_client);
// Dispatcher overrides.
virtual bool IsPlugin() const;
virtual bool Send(IPC::Message* msg);
bool IsPlugin() const override;
bool Send(IPC::Message* msg) override;
// Unlike |Send()|, this function continues to hold the Pepper proxy lock
// unconditionally.
bool SendAndStayLocked(IPC::Message* msg) override;
// IPC::Listener implementation.
virtual bool OnMessageReceived(const IPC::Message& msg);
virtual void OnChannelError();
bool OnMessageReceived(const IPC::Message& msg) override;
void OnChannelError() override;
// Keeps track of which dispatcher to use for each instance, active instances
// and tracks associated data like the current size.
......
......@@ -219,7 +219,10 @@ int32 PpapiCommandBufferProxy::CreateGpuMemoryBufferImage(
bool PpapiCommandBufferProxy::Send(IPC::Message* msg) {
DCHECK(last_state_.error == gpu::error::kNoError);
if (channel_->Send(msg))
// We need hold the Pepper proxy lock for sync IPC, because GPU command buffer
// may use a sync IPC with another lock held. It may cause deadlock.
// http://crbug.com/418651
if (channel_->SendAndStayLocked(msg))
return true;
last_state_.error = gpu::error::kLostContext;
......
......@@ -85,5 +85,9 @@ bool ProxyChannel::Send(IPC::Message* msg) {
return false;
}
bool ProxyChannel::SendAndStayLocked(IPC::Message* msg) {
return Send(msg);
}
} // namespace proxy
} // namespace ppapi
......@@ -73,6 +73,8 @@ class PPAPI_PROXY_EXPORT ProxyChannel
// IPC::Sender implementation.
virtual bool Send(IPC::Message* msg) override;
virtual bool SendAndStayLocked(IPC::Message* msg);
// IPC::Listener implementation.
virtual void OnChannelError() override;
......
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