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

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

Issue 10912060: Allow the NaCl IPC proxy to support multiple instances. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 3 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 466 matching lines...) Expand 10 before | Expand all | Expand 10 after
477 live_plugin_objects_.swap(plugin_object_copy); 477 live_plugin_objects_.swap(plugin_object_copy);
478 for (PluginObjectSet::iterator i = plugin_object_copy.begin(); 478 for (PluginObjectSet::iterator i = plugin_object_copy.begin();
479 i != plugin_object_copy.end(); ++i) 479 i != plugin_object_copy.end(); ++i)
480 delete *i; 480 delete *i;
481 481
482 if (lock_mouse_callback_) 482 if (lock_mouse_callback_)
483 TrackedCallback::ClearAndAbort(&lock_mouse_callback_); 483 TrackedCallback::ClearAndAbort(&lock_mouse_callback_);
484 484
485 delegate_->InstanceDeleted(this); 485 delegate_->InstanceDeleted(this);
486 module_->InstanceDeleted(this); 486 module_->InstanceDeleted(this);
487 // If we switched from the NaCl plugin module, notify it too.
488 if (original_module_.get())
489 original_module_->InstanceDeleted(this);
487 490
488 HostGlobals::Get()->InstanceDeleted(pp_instance_); 491 HostGlobals::Get()->InstanceDeleted(pp_instance_);
489 } 492 }
490 493
491 // NOTE: Any of these methods that calls into the plugin needs to take into 494 // NOTE: Any of these methods that calls into the plugin needs to take into
492 // account that the plugin may use Var to remove the <embed> from the DOM, which 495 // account that the plugin may use Var to remove the <embed> from the DOM, which
493 // will make the WebPluginImpl drop its reference, usually the last one. If a 496 // will make the WebPluginImpl drop its reference, usually the last one. If a
494 // method needs to access a member of the instance after the call has returned, 497 // method needs to access a member of the instance after the call has returned,
495 // then it needs to keep its own reference on the stack. 498 // then it needs to keep its own reference on the stack.
496 499
497 void PluginInstance::Delete() { 500 void PluginInstance::Delete() {
498 // Keep a reference on the stack. See NOTE above. 501 // Keep a reference on the stack. See NOTE above.
499 scoped_refptr<PluginInstance> ref(this); 502 scoped_refptr<PluginInstance> ref(this);
500 // Force the MessageChannel to release its "passthrough object" which should 503 // Force the MessageChannel to release its "passthrough object" which should
501 // release our last reference to the "InstanceObject" and will probably 504 // release our last reference to the "InstanceObject" and will probably
502 // destroy it. We want to do this prior to calling DidDestroy in case the 505 // destroy it. We want to do this prior to calling DidDestroy in case the
503 // destructor of the instance object tries to use the instance. 506 // destructor of the instance object tries to use the instance.
504 message_channel_->SetPassthroughObject(NULL); 507 message_channel_->SetPassthroughObject(NULL);
505 // If this is a NaCl plugin instance, shut down the NaCl plugin by calling 508 // If this is a NaCl plugin instance, shut down the NaCl plugin by calling
506 // its DidDestroy. Don't call DidDestroy on the untrusted plugin instance, 509 // its DidDestroy. Don't call DidDestroy on the untrusted plugin instance,
507 // since there is little that it can do at this point. 510 // since there is little that it can do at this point.
508 if (nacl_plugin_instance_interface_.get()) 511 if (original_instance_interface_.get())
509 nacl_plugin_instance_interface_->DidDestroy(pp_instance()); 512 original_instance_interface_->DidDestroy(pp_instance());
510 else 513 else
511 instance_interface_->DidDestroy(pp_instance()); 514 instance_interface_->DidDestroy(pp_instance());
512 515
513 if (fullscreen_container_) { 516 if (fullscreen_container_) {
514 fullscreen_container_->Destroy(); 517 fullscreen_container_->Destroy();
515 fullscreen_container_ = NULL; 518 fullscreen_container_ = NULL;
516 } 519 }
517 container_ = NULL; 520 container_ = NULL;
518 } 521 }
519 522
(...skipping 1999 matching lines...) Expand 10 before | Expand all | Expand 10 after
2519 components); 2522 components);
2520 } 2523 }
2521 2524
2522 PP_Var PluginInstance::GetPluginInstanceURL( 2525 PP_Var PluginInstance::GetPluginInstanceURL(
2523 PP_Instance instance, 2526 PP_Instance instance,
2524 PP_URLComponents_Dev* components) { 2527 PP_URLComponents_Dev* components) {
2525 return ::ppapi::PPB_URLUtil_Shared::GenerateURLReturn(plugin_url_, 2528 return ::ppapi::PPB_URLUtil_Shared::GenerateURLReturn(plugin_url_,
2526 components); 2529 components);
2527 } 2530 }
2528 2531
2529 bool PluginInstance::ResetAsProxied() { 2532 bool PluginInstance::ResetAsProxied(scoped_refptr<PluginModule> module) {
2533 // Save the original module and switch over to the new one now that this
2534 // plugin is using the IPC-based proxy.
2535 original_module_ = module_;
2536 module_ = module;
2537
2530 // For NaCl instances, remember the NaCl plugin instance interface, so we 2538 // For NaCl instances, remember the NaCl plugin instance interface, so we
2531 // can shut it down by calling its DidDestroy in our Delete() method. 2539 // can shut it down by calling its DidDestroy in our Delete() method.
2532 nacl_plugin_instance_interface_.reset(instance_interface_.release()); 2540 original_instance_interface_.reset(instance_interface_.release());
2533 2541
2534 base::Callback<const void*(const char*)> get_plugin_interface_func = 2542 base::Callback<const void*(const char*)> get_plugin_interface_func =
2535 base::Bind(&PluginModule::GetPluginInterface, module_.get()); 2543 base::Bind(&PluginModule::GetPluginInterface, module_.get());
2536 PPP_Instance_Combined* ppp_instance_combined = 2544 PPP_Instance_Combined* ppp_instance_combined =
2537 PPP_Instance_Combined::Create(get_plugin_interface_func); 2545 PPP_Instance_Combined::Create(get_plugin_interface_func);
2538 if (!ppp_instance_combined) { 2546 if (!ppp_instance_combined) {
2539 // The proxy must support at least one usable PPP_Instance interface. 2547 // The proxy must support at least one usable PPP_Instance interface.
2540 NOTREACHED(); 2548 NOTREACHED();
2541 return false; 2549 return false;
2542 } 2550 }
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
2639 screen_size_for_fullscreen_ = gfx::Size(); 2647 screen_size_for_fullscreen_ = gfx::Size();
2640 WebElement element = container_->element(); 2648 WebElement element = container_->element();
2641 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_); 2649 element.setAttribute(WebString::fromUTF8(kWidth), width_before_fullscreen_);
2642 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_); 2650 element.setAttribute(WebString::fromUTF8(kHeight), height_before_fullscreen_);
2643 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_); 2651 element.setAttribute(WebString::fromUTF8(kBorder), border_before_fullscreen_);
2644 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_); 2652 element.setAttribute(WebString::fromUTF8(kStyle), style_before_fullscreen_);
2645 } 2653 }
2646 2654
2647 } // namespace ppapi 2655 } // namespace ppapi
2648 } // namespace webkit 2656 } // 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