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

Unified Diff: content/renderer/pepper/pepper_in_process_router.cc

Issue 23536043: Merge 222614 "Change the PepperInProcessRouter to defer resource..." (Closed) Base URL: svn://svn.chromium.org/chrome/branches/1599/src/
Patch Set: Created 7 years, 3 months 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/renderer/pepper/pepper_in_process_router.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/renderer/pepper/pepper_in_process_router.cc
===================================================================
--- content/renderer/pepper/pepper_in_process_router.cc (revision 222785)
+++ content/renderer/pepper/pepper_in_process_router.cc (working copy)
@@ -110,9 +110,24 @@
scoped_ptr<IPC::Message> message(msg);
if (!message->is_sync()) {
- bool result = host_impl_->GetPpapiHost()->OnMessageReceived(*message);
- DCHECK(result) << "The message was not handled by the host.";
- return true;
+ // If this is a resource destroyed message, post a task to dispatch it.
+ // Dispatching it synchronously can cause the host to re-enter the proxy
+ // code while we're still in the resource destructor, leading to a crash.
+ // http://crbug.com/276368.
+ // This won't cause message reordering problems because the resource
+ // destroyed message is always the last one sent for a resource.
+ if (message->type() == PpapiHostMsg_ResourceDestroyed::ID) {
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&PepperInProcessRouter::DispatchHostMsg,
+ weak_factory_.GetWeakPtr(),
+ base::Owned(message.release())));
+ return true;
+ } else {
+ bool result = host_impl_->GetPpapiHost()->OnMessageReceived(*message);
+ DCHECK(result) << "The message was not handled by the host.";
+ return true;
+ }
}
pending_message_id_ = IPC::SyncMessage::GetMessageId(*message);
@@ -146,6 +161,11 @@
return true;
}
+void PepperInProcessRouter::DispatchHostMsg(IPC::Message* msg) {
+ bool handled = host_impl_->GetPpapiHost()->OnMessageReceived(*msg);
+ DCHECK(handled);
+}
+
void PepperInProcessRouter::DispatchPluginMsg(IPC::Message* msg) {
bool handled = OnPluginMsgReceived(*msg);
DCHECK(handled);
« no previous file with comments | « content/renderer/pepper/pepper_in_process_router.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698