Chromium Code Reviews| 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/pepper/pepper_plugin_instance_impl.h" | 5 #include "content/renderer/pepper/pepper_plugin_instance_impl.h" |
| 6 | 6 |
| 7 #include "base/bind.h" | 7 #include "base/bind.h" |
| 8 #include "base/callback_helpers.h" | 8 #include "base/callback_helpers.h" |
| 9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
| 10 #include "base/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 643 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 654 // want to look up in the global map to get info off of our object. | 654 // want to look up in the global map to get info off of our object. |
| 655 HostGlobals::Get()->InstanceDeleted(pp_instance_); | 655 HostGlobals::Get()->InstanceDeleted(pp_instance_); |
| 656 } | 656 } |
| 657 | 657 |
| 658 // NOTE: Any of these methods that calls into the plugin needs to take into | 658 // NOTE: Any of these methods that calls into the plugin needs to take into |
| 659 // account that the plugin may use Var to remove the <embed> from the DOM, which | 659 // account that the plugin may use Var to remove the <embed> from the DOM, which |
| 660 // will make the PepperWebPluginImpl drop its reference, usually the last one. | 660 // will make the PepperWebPluginImpl drop its reference, usually the last one. |
| 661 // If a method needs to access a member of the instance after the call has | 661 // If a method needs to access a member of the instance after the call has |
| 662 // returned, then it needs to keep its own reference on the stack. | 662 // returned, then it needs to keep its own reference on the stack. |
| 663 | 663 |
| 664 v8::Local<v8::Context> PepperPluginInstanceImpl::GetContext() { | |
| 665 if (!container_) | |
| 666 return v8::Handle<v8::Context>(); | |
| 667 v8::Handle<v8::Context> context = | |
| 668 container_->element().document().frame()->mainWorldScriptContext(); | |
|
dmichael (off chromium)
2014/07/30 19:34:13
The frame can be NULL in rare cases, so please che
raymes
2014/08/06 03:22:52
Done.
| |
| 669 DCHECK(context->GetIsolate() == isolate_); | |
| 670 return context; | |
| 671 } | |
| 672 | |
| 664 void PepperPluginInstanceImpl::Delete() { | 673 void PepperPluginInstanceImpl::Delete() { |
| 665 is_deleted_ = true; | 674 is_deleted_ = true; |
| 666 | 675 |
| 667 if (render_frame_ && | 676 if (render_frame_ && |
| 668 render_frame_->render_view()->plugin_find_handler() == this) { | 677 render_frame_->render_view()->plugin_find_handler() == this) { |
| 669 render_frame_->render_view()->set_plugin_find_handler(NULL); | 678 render_frame_->render_view()->set_plugin_find_handler(NULL); |
| 670 } | 679 } |
| 671 | 680 |
| 672 // Keep a reference on the stack. See NOTE above. | 681 // Keep a reference on the stack. See NOTE above. |
| 673 scoped_refptr<PepperPluginInstanceImpl> ref(this); | 682 scoped_refptr<PepperPluginInstanceImpl> ref(this); |
| (...skipping 2632 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 3306 // Running out-of-process. Initiate an IPC call to notify the plugin | 3315 // Running out-of-process. Initiate an IPC call to notify the plugin |
| 3307 // process. | 3316 // process. |
| 3308 ppapi::proxy::HostDispatcher* dispatcher = | 3317 ppapi::proxy::HostDispatcher* dispatcher = |
| 3309 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); | 3318 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); |
| 3310 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( | 3319 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( |
| 3311 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); | 3320 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); |
| 3312 } | 3321 } |
| 3313 } | 3322 } |
| 3314 | 3323 |
| 3315 } // namespace content | 3324 } // namespace content |
| OLD | NEW |