OLD | NEW |
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 "content/renderer/webplugin_delegate_proxy.h" | 5 #include "content/renderer/webplugin_delegate_proxy.h" |
6 | 6 |
7 #if defined(TOOLKIT_USES_GTK) | 7 #if defined(TOOLKIT_USES_GTK) |
8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
9 #endif | 9 #endif |
10 | 10 |
(...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
212 // channel, this avoids a race where this renderer asks a new connection to | 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. | 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 | 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 | 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 | 216 // released, the plugin will give us a new FD, and we'll assert when trying |
217 // to associate it with the channel name. | 217 // to associate it with the channel name. |
218 channel_host_ = NULL; | 218 channel_host_ = NULL; |
219 } | 219 } |
220 | 220 |
221 if (window_script_object_) { | 221 if (window_script_object_) { |
222 // The ScriptController deallocates this object independent of its ref count | 222 // Release the window script object, if the plugin didn't already. |
223 // to avoid leaks if the plugin forgets to release it. So mark the object | 223 // If we don't do this then it will linger until the last plugin instance is |
224 // invalid to avoid accessing it past this point. Note: only do this after | 224 // destroyed. In the meantime, though, the frame that it refers to may have |
225 // the DestroyInstance message in case the window object is scripted by the | 225 // been destroyed by WebKit, at which point WebKit will forcibly deallocate |
226 // plugin in NPP_Destroy. | 226 // the window script object. The window script object stub is unique to the |
227 window_script_object_->DeleteSoon(false); | 227 // plugin instance, so this won't affect other instances. |
| 228 window_script_object_->DeleteSoon(); |
228 } | 229 } |
229 | 230 |
230 plugin_ = NULL; | 231 plugin_ = NULL; |
231 | 232 |
232 MessageLoop::current()->DeleteSoon(FROM_HERE, this); | 233 MessageLoop::current()->DeleteSoon(FROM_HERE, this); |
233 } | 234 } |
234 | 235 |
235 // Returns true if the given Silverlight 'background' value corresponds to | 236 // Returns true if the given Silverlight 'background' value corresponds to |
236 // one that should make the plugin transparent. See: | 237 // one that should make the plugin transparent. See: |
237 // http://msdn.microsoft.com/en-us/library/cc838148(VS.95).aspx | 238 // http://msdn.microsoft.com/en-us/library/cc838148(VS.95).aspx |
(...skipping 1150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1388 } | 1389 } |
1389 #endif | 1390 #endif |
1390 | 1391 |
1391 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, | 1392 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, |
1392 int resource_id) { | 1393 int resource_id) { |
1393 if (!plugin_) | 1394 if (!plugin_) |
1394 return; | 1395 return; |
1395 | 1396 |
1396 plugin_->URLRedirectResponse(allow, resource_id); | 1397 plugin_->URLRedirectResponse(allow, resource_id); |
1397 } | 1398 } |
OLD | NEW |