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

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 297 matching lines...) Expand 10 before | Expand all | Expand 10 after
308 return new PluginInstance(delegate, module, ppp_instance_combined); 308 return new PluginInstance(delegate, module, ppp_instance_combined);
309 } 309 }
310 310
311 PluginInstance::PluginInstance( 311 PluginInstance::PluginInstance(
312 PluginDelegate* delegate, 312 PluginDelegate* delegate,
313 PluginModule* module, 313 PluginModule* module,
314 ::ppapi::PPP_Instance_Combined* instance_interface) 314 ::ppapi::PPP_Instance_Combined* instance_interface)
315 : delegate_(delegate), 315 : delegate_(delegate),
316 module_(module), 316 module_(module),
317 instance_interface_(instance_interface), 317 instance_interface_(instance_interface),
318 nacl_plugin_instance_interface_(NULL),
dmichael (off chromium) 2012/08/03 02:42:05 nit: I don't usually explicitly initialize scoped_
bbudge 2012/08/03 17:51:20 Done.
318 pp_instance_(0), 319 pp_instance_(0),
319 container_(NULL), 320 container_(NULL),
320 full_frame_(false), 321 full_frame_(false),
321 sent_initial_did_change_view_(false), 322 sent_initial_did_change_view_(false),
322 view_change_weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)), 323 view_change_weak_ptr_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)),
323 has_webkit_focus_(false), 324 has_webkit_focus_(false),
324 has_content_area_focus_(false), 325 has_content_area_focus_(false),
325 find_identifier_(-1), 326 find_identifier_(-1),
326 plugin_find_interface_(NULL), 327 plugin_find_interface_(NULL),
327 plugin_input_event_interface_(NULL), 328 plugin_input_event_interface_(NULL),
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
396 397
397 void PluginInstance::Delete() { 398 void PluginInstance::Delete() {
398 // Keep a reference on the stack. See NOTE above. 399 // Keep a reference on the stack. See NOTE above.
399 scoped_refptr<PluginInstance> ref(this); 400 scoped_refptr<PluginInstance> ref(this);
400 // Force the MessageChannel to release its "passthrough object" which should 401 // Force the MessageChannel to release its "passthrough object" which should
401 // release our last reference to the "InstanceObject" and will probably 402 // 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 403 // 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. 404 // destructor of the instance object tries to use the instance.
404 message_channel_->SetPassthroughObject(NULL); 405 message_channel_->SetPassthroughObject(NULL);
405 instance_interface_->DidDestroy(pp_instance()); 406 instance_interface_->DidDestroy(pp_instance());
407 if (nacl_plugin_instance_interface_.get())
408 nacl_plugin_instance_interface_->DidDestroy(pp_instance());
406 409
407 if (fullscreen_container_) { 410 if (fullscreen_container_) {
408 fullscreen_container_->Destroy(); 411 fullscreen_container_->Destroy();
409 fullscreen_container_ = NULL; 412 fullscreen_container_ = NULL;
410 } 413 }
411 container_ = NULL; 414 container_ = NULL;
412 } 415 }
413 416
414 void PluginInstance::Paint(WebCanvas* canvas, 417 void PluginInstance::Paint(WebCanvas* canvas,
415 const gfx::Rect& plugin_rect, 418 const gfx::Rect& plugin_rect,
(...skipping 1712 matching lines...) Expand 10 before | Expand all | Expand 10 after
2128 } 2131 }
2129 2132
2130 PP_Var PluginInstance::GetPluginInstanceURL( 2133 PP_Var PluginInstance::GetPluginInstanceURL(
2131 PP_Instance instance, 2134 PP_Instance instance,
2132 PP_URLComponents_Dev* components) { 2135 PP_URLComponents_Dev* components) {
2133 return ::ppapi::PPB_URLUtil_Shared::GenerateURLReturn(plugin_url_, 2136 return ::ppapi::PPB_URLUtil_Shared::GenerateURLReturn(plugin_url_,
2134 components); 2137 components);
2135 } 2138 }
2136 2139
2137 bool PluginInstance::ResetAsProxied() { 2140 bool PluginInstance::ResetAsProxied() {
2141 // Remember the existing instance interface, so we can call DidDestroy in
2142 // our Delete() method. This will delete the NaCl plugin instance, which
2143 // will shut down the NaCl process.
2144 nacl_plugin_instance_interface_.reset(instance_interface_.release());
2145
2138 base::Callback<const void*(const char*)> get_plugin_interface_func = 2146 base::Callback<const void*(const char*)> get_plugin_interface_func =
2139 base::Bind(&PluginModule::GetPluginInterface, module_.get()); 2147 base::Bind(&PluginModule::GetPluginInterface, module_.get());
2140 PPP_Instance_Combined* ppp_instance_combined = 2148 PPP_Instance_Combined* ppp_instance_combined =
2141 PPP_Instance_Combined::Create(get_plugin_interface_func); 2149 PPP_Instance_Combined::Create(get_plugin_interface_func);
2142 if (!ppp_instance_combined) { 2150 if (!ppp_instance_combined) {
2143 // The proxy must support at least one usable PPP_Instance interface. 2151 // The proxy must support at least one usable PPP_Instance interface.
2144 NOTREACHED(); 2152 NOTREACHED();
2145 return false; 2153 return false;
2146 } 2154 }
2147 instance_interface_.reset(ppp_instance_combined); 2155 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(); 2251 screen_size_for_fullscreen_ = gfx::Size();
2244 WebElement element = container_->element(); 2252 WebElement element = container_->element();
2245 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); 2253 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_);
2246 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); 2254 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_);
2247 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); 2255 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_);
2248 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); 2256 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_);
2249 } 2257 }
2250 2258
2251 } // namespace ppapi 2259 } // namespace ppapi
2252 } // namespace webkit 2260 } // 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