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

Side by Side Diff: webkit/plugins/ppapi/ppapi_plugin_instance.cc

Issue 10837086: Change PluginInstance so it shuts down the NaCl Plugin when it uses the IPC PPAPI proxy. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 | Annotate | Revision Log
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | 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) 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 "webkit/plugins/ppapi/ppapi_plugin_instance.h" 5 #include "webkit/plugins/ppapi/ppapi_plugin_instance.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/debug/trace_event.h" 8 #include "base/debug/trace_event.h"
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "base/memory/linked_ptr.h" 10 #include "base/memory/linked_ptr.h"
(...skipping 385 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 396
397 void PluginInstance::Delete() { 397 void PluginInstance::Delete() {
398 // Keep a reference on the stack. See NOTE above. 398 // Keep a reference on the stack. See NOTE above.
399 scoped_refptr<PluginInstance> ref(this); 399 scoped_refptr<PluginInstance> ref(this);
400 // Force the MessageChannel to release its "passthrough object" which should 400 // Force the MessageChannel to release its "passthrough object" which should
401 // release our last reference to the "InstanceObject" and will probably 401 // release our last reference to the "InstanceObject" and will probably
402 // destroy it. We want to do this prior to calling DidDestroy in case the 402 // destroy it. We want to do this prior to calling DidDestroy in case the
403 // destructor of the instance object tries to use the instance. 403 // destructor of the instance object tries to use the instance.
404 message_channel_->SetPassthroughObject(NULL); 404 message_channel_->SetPassthroughObject(NULL);
405 instance_interface_->DidDestroy(pp_instance()); 405 instance_interface_->DidDestroy(pp_instance());
406 if (nacl_plugin_instance_interface_.get())
407 nacl_plugin_instance_interface_->DidDestroy(pp_instance());
406 408
407 if (fullscreen_container_) { 409 if (fullscreen_container_) {
408 fullscreen_container_->Destroy(); 410 fullscreen_container_->Destroy();
409 fullscreen_container_ = NULL; 411 fullscreen_container_ = NULL;
410 } 412 }
411 container_ = NULL; 413 container_ = NULL;
412 } 414 }
413 415
414 void PluginInstance::Paint(WebCanvas* canvas, 416 void PluginInstance::Paint(WebCanvas* canvas,
415 const gfx::Rect& plugin_rect, 417 const gfx::Rect& plugin_rect,
(...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after
2128 } 2130 }
2129 2131
2130 PP_Var PluginInstance::GetPluginInstanceURL( 2132 PP_Var PluginInstance::GetPluginInstanceURL(
2131 PP_Instance instance, 2133 PP_Instance instance,
2132 PP_URLComponents_Dev* components) { 2134 PP_URLComponents_Dev* components) {
2133 return ::ppapi::PPB_URLUtil_Shared::GenerateURLReturn(plugin_url_, 2135 return ::ppapi::PPB_URLUtil_Shared::GenerateURLReturn(plugin_url_,
2134 components); 2136 components);
2135 } 2137 }
2136 2138
2137 bool PluginInstance::ResetAsProxied() { 2139 bool PluginInstance::ResetAsProxied() {
2140 // Remember the existing instance interface, so we can call DidDestroy in
2141 // our Delete() method. This will delete the NaCl plugin instance, which
2142 // will shut down the NaCl process.
2143 nacl_plugin_instance_interface_.reset(instance_interface_.release());
2144
2138 base::Callback<const void*(const char*)> get_plugin_interface_func = 2145 base::Callback<const void*(const char*)> get_plugin_interface_func =
2139 base::Bind(&PluginModule::GetPluginInterface, module_.get()); 2146 base::Bind(&PluginModule::GetPluginInterface, module_.get());
2140 PPP_Instance_Combined* ppp_instance_combined = 2147 PPP_Instance_Combined* ppp_instance_combined =
2141 PPP_Instance_Combined::Create(get_plugin_interface_func); 2148 PPP_Instance_Combined::Create(get_plugin_interface_func);
2142 if (!ppp_instance_combined) { 2149 if (!ppp_instance_combined) {
2143 // The proxy must support at least one usable PPP_Instance interface. 2150 // The proxy must support at least one usable PPP_Instance interface.
2144 NOTREACHED(); 2151 NOTREACHED();
2145 return false; 2152 return false;
2146 } 2153 }
2147 instance_interface_.reset(ppp_instance_combined); 2154 instance_interface_.reset(ppp_instance_combined);
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
2243 screen_size_for_fullscreen_ = gfx::Size(); 2250 screen_size_for_fullscreen_ = gfx::Size();
2244 WebElement element = container_->element(); 2251 WebElement element = container_->element();
2245 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); 2252 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_);
2246 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); 2253 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_);
2247 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); 2254 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_);
2248 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); 2255 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_);
2249 } 2256 }
2250 2257
2251 } // namespace ppapi 2258 } // namespace ppapi
2252 } // namespace webkit 2259 } // namespace webkit
OLDNEW
« no previous file with comments | « webkit/plugins/ppapi/ppapi_plugin_instance.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698