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

Side by Side Diff: ppapi/proxy/host_dispatcher.cc

Issue 8098001: Fix a crash in the renderer process which occurs in the PPAPI host code due to the underlying plugin (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | webkit/plugins/ppapi/plugin_object.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ppapi/proxy/host_dispatcher.h" 5 #include "ppapi/proxy/host_dispatcher.h"
6 6
7 #include <map> 7 #include <map>
8 8
9 #include "base/debug/trace_event.h" 9 #include "base/debug/trace_event.h"
10 #include "base/logging.h" 10 #include "base/logging.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 } 127 }
128 128
129 bool HostDispatcher::IsPlugin() const { 129 bool HostDispatcher::IsPlugin() const {
130 return false; 130 return false;
131 } 131 }
132 132
133 bool HostDispatcher::Send(IPC::Message* msg) { 133 bool HostDispatcher::Send(IPC::Message* msg) {
134 TRACE_EVENT2("ppapi proxy", "HostDispatcher::Send", 134 TRACE_EVENT2("ppapi proxy", "HostDispatcher::Send",
135 "Class", IPC_MESSAGE_ID_CLASS(msg->type()), 135 "Class", IPC_MESSAGE_ID_CLASS(msg->type()),
136 "Line", IPC_MESSAGE_ID_LINE(msg->type())); 136 "Line", IPC_MESSAGE_ID_LINE(msg->type()));
137 // Normal sync messages are set to unblock, which would normally cause the 137 // Prevent the dispatcher from going away during the call. Scenarios
138 // plugin to be reentered to process them. We only want to do this when we 138 // where this could happen include a Send for a sync message which while
139 // know the plugin is in a state to accept reentrancy. Since the plugin side 139 // waiting for the reply, dispatches an incoming ExecuteScript call which
140 // never clears this flag on messages it sends, we can't get deadlock, but we 140 // destroys the plugin module and in turn the dispatcher,
141 // may still get reentrancy in the host as a result. 141 ScopedModuleReference ref(this);
142
142 if (!allow_plugin_reentrancy_) 143 if (!allow_plugin_reentrancy_)
143 msg->set_unblock(false); 144 msg->set_unblock(false);
144 return Dispatcher::Send(msg); 145 return Dispatcher::Send(msg);
145 } 146 }
146 147
147 bool HostDispatcher::OnMessageReceived(const IPC::Message& msg) { 148 bool HostDispatcher::OnMessageReceived(const IPC::Message& msg) {
148 TRACE_EVENT2("ppapi proxy", "HostDispatcher::OnMessageReceived", 149 TRACE_EVENT2("ppapi proxy", "HostDispatcher::OnMessageReceived",
149 "Class", IPC_MESSAGE_ID_CLASS(msg.type()), 150 "Class", IPC_MESSAGE_ID_CLASS(msg.type()),
150 "Line", IPC_MESSAGE_ID_LINE(msg.type())); 151 "Line", IPC_MESSAGE_ID_LINE(msg.type()));
151 // We only want to allow reentrancy when the most recent message from the 152 // We only want to allow reentrancy when the most recent message from the
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 dispatcher_ = static_cast<HostDispatcher*>(dispatcher); 206 dispatcher_ = static_cast<HostDispatcher*>(dispatcher);
206 dispatcher_->ppb_proxy()->AddRefModule(dispatcher_->pp_module()); 207 dispatcher_->ppb_proxy()->AddRefModule(dispatcher_->pp_module());
207 } 208 }
208 209
209 ScopedModuleReference::~ScopedModuleReference() { 210 ScopedModuleReference::~ScopedModuleReference() {
210 dispatcher_->ppb_proxy()->ReleaseModule(dispatcher_->pp_module()); 211 dispatcher_->ppb_proxy()->ReleaseModule(dispatcher_->pp_module());
211 } 212 }
212 213
213 } // namespace proxy 214 } // namespace proxy
214 } // namespace ppapi 215 } // namespace ppapi
OLDNEW
« no previous file with comments | « no previous file | webkit/plugins/ppapi/plugin_object.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698