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

Side by Side Diff: content/renderer/pepper/pepper_plugin_instance_impl.cc

Issue 588083002: Use the correct v8 context for conversions when calling into the plugin from JS (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 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
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 "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 654 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 665
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::GetMainWorldContext() {
676 if (!container_ || 676 if (!container_)
677 container_->element().isNull() ||
678 container_->element().document().isNull() ||
679 !container_->element().document().frame()) {
680 return v8::Handle<v8::Context>(); 677 return v8::Handle<v8::Context>();
681 } 678
679 if (container_->element().isNull())
680 return v8::Handle<v8::Context>();
681
682 if (container_->element().document().isNull())
683 return v8::Handle<v8::Context>();
684
685 if (!container_->element().document().frame())
686 return v8::Handle<v8::Context>();
682 687
683 v8::Local<v8::Context> context = 688 v8::Local<v8::Context> context =
684 container_->element().document().frame()->mainWorldScriptContext(); 689 container_->element().document().frame()->mainWorldScriptContext();
685 DCHECK(context->GetIsolate() == isolate_); 690 DCHECK(context->GetIsolate() == isolate_);
686 return context; 691 return context;
687 } 692 }
688 693
689 void PepperPluginInstanceImpl::Delete() { 694 void PepperPluginInstanceImpl::Delete() {
690 is_deleted_ = true; 695 is_deleted_ = true;
691 696
(...skipping 2685 matching lines...) Expand 10 before | Expand all | Expand 10 after
3377 // Running out-of-process. Initiate an IPC call to notify the plugin 3382 // Running out-of-process. Initiate an IPC call to notify the plugin
3378 // process. 3383 // process.
3379 ppapi::proxy::HostDispatcher* dispatcher = 3384 ppapi::proxy::HostDispatcher* dispatcher =
3380 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance()); 3385 ppapi::proxy::HostDispatcher::GetForInstance(pp_instance());
3381 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad( 3386 dispatcher->Send(new PpapiMsg_PPPInstance_HandleDocumentLoad(
3382 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data)); 3387 ppapi::API_ID_PPP_INSTANCE, pp_instance(), pending_host_id, data));
3383 } 3388 }
3384 } 3389 }
3385 3390
3386 } // namespace content 3391 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/pepper/pepper_plugin_instance_impl.h ('k') | content/renderer/pepper/pepper_try_catch.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698