| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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_GTK) | 7 #if defined(TOOLKIT_GTK) |
| 8 #include <gtk/gtk.h> | 8 #include <gtk/gtk.h> |
| 9 #elif defined(USE_X11) | 9 #elif defined(USE_X11) |
| 10 #include <cairo/cairo.h> | 10 #include <cairo/cairo.h> |
| (...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 240 if (dummy_activation_window_ && render_view_) { | 240 if (dummy_activation_window_ && render_view_) { |
| 241 render_view_->Send(new ViewHostMsg_WindowlessPluginDummyWindowDestroyed( | 241 render_view_->Send(new ViewHostMsg_WindowlessPluginDummyWindowDestroyed( |
| 242 render_view_->routing_id(), dummy_activation_window_)); | 242 render_view_->routing_id(), dummy_activation_window_)); |
| 243 } | 243 } |
| 244 dummy_activation_window_ = NULL; | 244 dummy_activation_window_ = NULL; |
| 245 #endif | 245 #endif |
| 246 | 246 |
| 247 if (window_) | 247 if (window_) |
| 248 WillDestroyWindow(); | 248 WillDestroyWindow(); |
| 249 | 249 |
| 250 if (render_view_) | 250 if (render_view_.get()) |
| 251 render_view_->UnregisterPluginDelegate(this); | 251 render_view_->UnregisterPluginDelegate(this); |
| 252 | 252 |
| 253 if (channel_host_.get()) { | 253 if (channel_host_.get()) { |
| 254 Send(new PluginMsg_DestroyInstance(instance_id_)); | 254 Send(new PluginMsg_DestroyInstance(instance_id_)); |
| 255 | 255 |
| 256 // Must remove the route after sending the destroy message, since | 256 // Must remove the route after sending the destroy message, since |
| 257 // RemoveRoute can lead to all the outstanding NPObjects being told the | 257 // RemoveRoute can lead to all the outstanding NPObjects being told the |
| 258 // channel went away if this was the last instance. | 258 // channel went away if this was the last instance. |
| 259 channel_host_->RemoveRoute(instance_id_); | 259 channel_host_->RemoveRoute(instance_id_); |
| 260 | 260 |
| 261 // Release the channel host now. If we are is the last reference to the | 261 // Release the channel host now. If we are is the last reference to the |
| 262 // channel, this avoids a race where this renderer asks a new connection to | 262 // channel, this avoids a race where this renderer asks a new connection to |
| 263 // the same plugin between now and the time 'this' is actually deleted. | 263 // the same plugin between now and the time 'this' is actually deleted. |
| 264 // Destroying the channel host is what releases the channel name -> FD | 264 // Destroying the channel host is what releases the channel name -> FD |
| 265 // association on POSIX, and if we ask for a new connection before it is | 265 // association on POSIX, and if we ask for a new connection before it is |
| 266 // released, the plugin will give us a new FD, and we'll assert when trying | 266 // released, the plugin will give us a new FD, and we'll assert when trying |
| 267 // to associate it with the channel name. | 267 // to associate it with the channel name. |
| 268 channel_host_ = NULL; | 268 channel_host_ = NULL; |
| 269 } | 269 } |
| 270 | 270 |
| 271 if (window_script_object_) { | 271 if (window_script_object_.get()) { |
| 272 // Release the window script object, if the plugin didn't already. | 272 // Release the window script object, if the plugin didn't already. |
| 273 // If we don't do this then it will linger until the last plugin instance is | 273 // If we don't do this then it will linger until the last plugin instance is |
| 274 // destroyed. In the meantime, though, the frame that it refers to may have | 274 // destroyed. In the meantime, though, the frame that it refers to may have |
| 275 // been destroyed by WebKit, at which point WebKit will forcibly deallocate | 275 // been destroyed by WebKit, at which point WebKit will forcibly deallocate |
| 276 // the window script object. The window script object stub is unique to the | 276 // the window script object. The window script object stub is unique to the |
| 277 // plugin instance, so this won't affect other instances. | 277 // plugin instance, so this won't affect other instances. |
| 278 window_script_object_->DeleteSoon(); | 278 window_script_object_->DeleteSoon(); |
| 279 } | 279 } |
| 280 | 280 |
| 281 plugin_ = NULL; | 281 plugin_ = NULL; |
| (...skipping 924 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1206 | 1206 |
| 1207 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, | 1207 void WebPluginDelegateProxy::OnURLRedirectResponse(bool allow, |
| 1208 int resource_id) { | 1208 int resource_id) { |
| 1209 if (!plugin_) | 1209 if (!plugin_) |
| 1210 return; | 1210 return; |
| 1211 | 1211 |
| 1212 plugin_->URLRedirectResponse(allow, resource_id); | 1212 plugin_->URLRedirectResponse(allow, resource_id); |
| 1213 } | 1213 } |
| 1214 | 1214 |
| 1215 } // namespace content | 1215 } // namespace content |
| OLD | NEW |