| 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 655 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 666 v8::Local<v8::Object> PepperPluginInstanceImpl::GetMessageChannelObject() { | 666 v8::Local<v8::Object> PepperPluginInstanceImpl::GetMessageChannelObject() { |
| 667 return v8::Local<v8::Object>::New(isolate_, message_channel_object_); | 667 return v8::Local<v8::Object>::New(isolate_, message_channel_object_); |
| 668 } | 668 } |
| 669 | 669 |
| 670 void PepperPluginInstanceImpl::MessageChannelDestroyed() { | 670 void PepperPluginInstanceImpl::MessageChannelDestroyed() { |
| 671 message_channel_ = NULL; | 671 message_channel_ = NULL; |
| 672 message_channel_object_.Reset(); | 672 message_channel_object_.Reset(); |
| 673 } | 673 } |
| 674 | 674 |
| 675 v8::Local<v8::Context> PepperPluginInstanceImpl::GetContext() { | 675 v8::Local<v8::Context> PepperPluginInstanceImpl::GetContext() { |
| 676 if (!container_) | 676 if (!container_ || |
| 677 container_->element().isNull() || |
| 678 container_->element().document().isNull() || |
| 679 !container_->element().document().frame()) { |
| 677 return v8::Handle<v8::Context>(); | 680 return v8::Handle<v8::Context>(); |
| 678 WebLocalFrame* frame = container_->element().document().frame(); | 681 } |
| 679 if (!frame) | |
| 680 return v8::Handle<v8::Context>(); | |
| 681 | 682 |
| 682 v8::Local<v8::Context> context = frame->mainWorldScriptContext(); | 683 v8::Local<v8::Context> context = |
| 684 container_->element().document().frame()->mainWorldScriptContext(); |
| 683 DCHECK(context->GetIsolate() == isolate_); | 685 DCHECK(context->GetIsolate() == isolate_); |
| 684 return context; | 686 return context; |
| 685 } | 687 } |
| 686 | 688 |
| 687 void PepperPluginInstanceImpl::Delete() { | 689 void PepperPluginInstanceImpl::Delete() { |
| 688 is_deleted_ = true; | 690 is_deleted_ = true; |
| 689 | 691 |
| 690 if (render_frame_ && | 692 if (render_frame_ && |
| 691 render_frame_->render_view()->plugin_find_handler() == this) { | 693 render_frame_->render_view()->plugin_find_handler() == this) { |
| 692 render_frame_->render_view()->set_plugin_find_handler(NULL); | 694 render_frame_->render_view()->set_plugin_find_handler(NULL); |
| (...skipping 2672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3365 // Running out-of-process. Initiate an IPC call to notify the plugin | 3367 // Running out-of-process. Initiate an IPC call to notify the plugin |
| 3366 // process. | 3368 // process. |
| 3367 ppapi::proxy::HostDispatcher* dispatcher = | 3369 ppapi::proxy::HostDispatcher* dispatcher = |
| 3368 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); | 3370 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); |
| 3369 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( | 3371 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( |
| 3370 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); | 3372 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); |
| 3371 } | 3373 } |
| 3372 } | 3374 } |
| 3373 | 3375 |
| 3374 } // namespace content | 3376 } // namespace content |
| OLD | NEW |