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...) 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 WebLocalFrame* frame = container_->element().document().frame(); |
| 668 if (!frame) |
| 669 return v8::Handle<v8::Context>(); |
| 670 |
| 671 v8::Local<v8::Context> context = frame->mainWorldScriptContext(); |
| 672 DCHECK(context->GetIsolate() == isolate_); |
| 673 return context; |
| 674 } |
| 675 |
664 void PepperPluginInstanceImpl::Delete() { | 676 void PepperPluginInstanceImpl::Delete() { |
665 is_deleted_ = true; | 677 is_deleted_ = true; |
666 | 678 |
667 if (render_frame_ && | 679 if (render_frame_ && |
668 render_frame_->render_view()->plugin_find_handler() == this) { | 680 render_frame_->render_view()->plugin_find_handler() == this) { |
669 render_frame_->render_view()->set_plugin_find_handler(NULL); | 681 render_frame_->render_view()->set_plugin_find_handler(NULL); |
670 } | 682 } |
671 | 683 |
672 // Keep a reference on the stack. See NOTE above. | 684 // Keep a reference on the stack. See NOTE above. |
673 scoped_refptr<PepperPluginInstanceImpl> ref(this); | 685 scoped_refptr<PepperPluginInstanceImpl> ref(this); |
(...skipping 2632 matching lines...) Loading... |
3306 // Running out-of-process. Initiate an IPC call to notify the plugin | 3318 // Running out-of-process. Initiate an IPC call to notify the plugin |
3307 // process. | 3319 // process. |
3308 ppapi::proxy::HostDispatcher* dispatcher = | 3320 ppapi::proxy::HostDispatcher* dispatcher = |
3309 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); | 3321 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); |
3310 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( | 3322 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( |
3311 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); | 3323 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); |
3312 } | 3324 } |
3313 } | 3325 } |
3314 | 3326 |
3315 } // namespace content | 3327 } // namespace content |
OLD | NEW |