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

Side by Side Diff: chrome/renderer/webplugin_delegate_proxy.cc

Issue 165280: linux/mac: Fix race condition when destroying the renderer<->plugin channel (Closed)
Patch Set: merge Created 11 years, 4 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
« no previous file with comments | « no previous file | no next file » | 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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 "chrome/renderer/webplugin_delegate_proxy.h" 5 #include "chrome/renderer/webplugin_delegate_proxy.h"
6 6
7 #include "build/build_config.h" 7 #include "build/build_config.h"
8 8
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <atlbase.h> 10 #include <atlbase.h>
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 // The ScriptController deallocates this object independent of its ref count 201 // The ScriptController deallocates this object independent of its ref count
202 // to avoid leaks if the plugin forgets to release it. So mark the object 202 // to avoid leaks if the plugin forgets to release it. So mark the object
203 // invalid to avoid accessing it past this point. 203 // invalid to avoid accessing it past this point.
204 window_script_object_->set_proxy(NULL); 204 window_script_object_->set_proxy(NULL);
205 window_script_object_->set_invalid(); 205 window_script_object_->set_invalid();
206 } 206 }
207 207
208 if (channel_host_) { 208 if (channel_host_) {
209 channel_host_->RemoveRoute(instance_id_); 209 channel_host_->RemoveRoute(instance_id_);
210 Send(new PluginMsg_DestroyInstance(instance_id_)); 210 Send(new PluginMsg_DestroyInstance(instance_id_));
211 // Release the channel host now. If we are is the last reference to the
212 // channel, this avoids a race where this renderer asks a new connection to
213 // the same plugin between now and the time 'this' is actually deleted.
214 // Destroying the channel host is what releases the channel name -> FD
215 // association on POSIX, and if we ask for a new connection before it is
216 // released, the plugin will give us a new FD, and we'll assert when trying
217 // to associate it with the channel name.
218 channel_host_ = NULL;
jam 2009/08/11 01:37:47 What about other WebPluginDelegateProxy methods th
211 } 219 }
212 220
213 render_view_->PluginDestroyed(this); 221 render_view_->PluginDestroyed(this);
214 MessageLoop::current()->DeleteSoon(FROM_HERE, this); 222 MessageLoop::current()->DeleteSoon(FROM_HERE, this);
215 } 223 }
216 224
217 bool WebPluginDelegateProxy::Initialize(const GURL& url, char** argn, 225 bool WebPluginDelegateProxy::Initialize(const GURL& url, char** argn,
218 char** argv, int argc, 226 char** argv, int argc,
219 WebPlugin* plugin, 227 WebPlugin* plugin,
220 bool load_manually) { 228 bool load_manually) {
(...skipping 770 matching lines...) Expand 10 before | Expand all | Expand 10 after
991 intptr_t existing_stream, bool notify_needed, intptr_t notify_data) { 999 intptr_t existing_stream, bool notify_needed, intptr_t notify_data) {
992 plugin_->InitiateHTTPRangeRequest(url.c_str(), range_info.c_str(), 1000 plugin_->InitiateHTTPRangeRequest(url.c_str(), range_info.c_str(),
993 existing_stream, notify_needed, 1001 existing_stream, notify_needed,
994 notify_data); 1002 notify_data);
995 } 1003 }
996 1004
997 void WebPluginDelegateProxy::OnDeferResourceLoading(int resource_id, 1005 void WebPluginDelegateProxy::OnDeferResourceLoading(int resource_id,
998 bool defer) { 1006 bool defer) {
999 plugin_->SetDeferResourceLoading(resource_id, defer); 1007 plugin_->SetDeferResourceLoading(resource_id, defer);
1000 } 1008 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698