summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--content/renderer/pepper/ppb_video_decoder_impl.cc42
-rw-r--r--content/renderer/pepper/ppb_video_decoder_impl.h9
-rw-r--r--ppapi/proxy/host_dispatcher.cc3
-rw-r--r--ppapi/proxy/ppapi_messages.h6
4 files changed, 34 insertions, 26 deletions
diff --git a/content/renderer/pepper/ppb_video_decoder_impl.cc b/content/renderer/pepper/ppb_video_decoder_impl.cc
index 53b2ef9..ca052ea 100644
--- a/content/renderer/pepper/ppb_video_decoder_impl.cc
+++ b/content/renderer/pepper/ppb_video_decoder_impl.cc
@@ -95,12 +95,6 @@ namespace content {
PPB_VideoDecoder_Impl::PPB_VideoDecoder_Impl(PP_Instance instance)
: PPB_VideoDecoder_Shared(instance), ppp_videodecoder_(NULL) {
- PluginModule* plugin_module =
- HostGlobals::Get()->GetInstance(pp_instance())->module();
- if (plugin_module) {
- ppp_videodecoder_ = static_cast<const PPP_VideoDecoder_Dev*>(
- plugin_module->GetPluginInterface(PPP_VIDEODECODER_DEV_INTERFACE));
- }
}
PPB_VideoDecoder_Impl::~PPB_VideoDecoder_Impl() { Destroy(); }
@@ -140,6 +134,18 @@ bool PPB_VideoDecoder_Impl::Init(PP_Resource graphics_context,
return (decoder_ && decoder_->Initialize(PPToMediaProfile(profile), this));
}
+const PPP_VideoDecoder_Dev* PPB_VideoDecoder_Impl::GetPPP() {
+ if (!ppp_videodecoder_) {
+ PluginModule* plugin_module =
+ HostGlobals::Get()->GetInstance(pp_instance())->module();
+ if (plugin_module) {
+ ppp_videodecoder_ = static_cast<const PPP_VideoDecoder_Dev*>(
+ plugin_module->GetPluginInterface(PPP_VIDEODECODER_DEV_INTERFACE));
+ }
+ }
+ return ppp_videodecoder_;
+}
+
int32_t PPB_VideoDecoder_Impl::Decode(
const PP_VideoBitstreamBuffer_Dev* bitstream_buffer,
scoped_refptr<TrackedCallback> callback) {
@@ -234,46 +240,44 @@ void PPB_VideoDecoder_Impl::ProvidePictureBuffers(
const gfx::Size& dimensions,
uint32 texture_target) {
DCHECK(RenderThreadImpl::current());
- if (!ppp_videodecoder_)
+ if (!GetPPP())
return;
PP_Size out_dim = PP_MakeSize(dimensions.width(), dimensions.height());
- ppp_videodecoder_->ProvidePictureBuffers(pp_instance(),
- pp_resource(),
- requested_num_of_buffers,
- &out_dim,
- texture_target);
+ GetPPP()->ProvidePictureBuffers(pp_instance(), pp_resource(),
+ requested_num_of_buffers, &out_dim,
+ texture_target);
}
void PPB_VideoDecoder_Impl::PictureReady(const media::Picture& picture) {
// So far picture.visible_rect is not used. If used, visible_rect should
// be validated since it comes from GPU process and may not be trustworthy.
DCHECK(RenderThreadImpl::current());
- if (!ppp_videodecoder_)
+ if (!GetPPP())
return;
PP_Picture_Dev output;
output.picture_buffer_id = picture.picture_buffer_id();
output.bitstream_buffer_id = picture.bitstream_buffer_id();
- ppp_videodecoder_->PictureReady(pp_instance(), pp_resource(), &output);
+ GetPPP()->PictureReady(pp_instance(), pp_resource(), &output);
}
void PPB_VideoDecoder_Impl::DismissPictureBuffer(int32 picture_buffer_id) {
DCHECK(RenderThreadImpl::current());
- if (!ppp_videodecoder_)
+ if (!GetPPP())
return;
- ppp_videodecoder_->DismissPictureBuffer(
- pp_instance(), pp_resource(), picture_buffer_id);
+ GetPPP()->DismissPictureBuffer(pp_instance(), pp_resource(),
+ picture_buffer_id);
}
void PPB_VideoDecoder_Impl::NotifyError(
media::VideoDecodeAccelerator::Error error) {
DCHECK(RenderThreadImpl::current());
- if (!ppp_videodecoder_)
+ if (!GetPPP())
return;
PP_VideoDecodeError_Dev pp_error = MediaToPPError(error);
- ppp_videodecoder_->NotifyError(pp_instance(), pp_resource(), pp_error);
+ GetPPP()->NotifyError(pp_instance(), pp_resource(), pp_error);
UMA_HISTOGRAM_ENUMERATION("Media.PepperVideoDecoderError",
error,
media::VideoDecodeAccelerator::LARGEST_ERROR_ENUM);
diff --git a/content/renderer/pepper/ppb_video_decoder_impl.h b/content/renderer/pepper/ppb_video_decoder_impl.h
index e3037b9..094bcff 100644
--- a/content/renderer/pepper/ppb_video_decoder_impl.h
+++ b/content/renderer/pepper/ppb_video_decoder_impl.h
@@ -58,12 +58,19 @@ class PPB_VideoDecoder_Impl : public ppapi::PPB_VideoDecoder_Shared,
explicit PPB_VideoDecoder_Impl(PP_Instance instance);
bool Init(PP_Resource graphics_context,
PP_VideoDecoder_Profile profile);
+ // Returns the associated PPP_VideoDecoder_Dev interface to use when
+ // making calls on the plugin. This fetches the interface lazily. For
+ // out-of-process plugins, this means a synchronous message to the plugin,
+ // so it's important to never call this in response to a synchronous
+ // plugin->renderer message (such as the Create message).
+ const PPP_VideoDecoder_Dev* GetPPP();
// This is NULL before initialization, and after destruction.
// Holds a GpuVideoDecodeAcceleratorHost.
scoped_ptr<media::VideoDecodeAccelerator> decoder_;
- // Reference to the plugin requesting this interface.
+ // The interface to use when making calls on the plugin. For the most part,
+ // methods should not use this directly but should call GetPPP() instead.
const PPP_VideoDecoder_Dev* ppp_videodecoder_;
DISALLOW_COPY_AND_ASSIGN(PPB_VideoDecoder_Impl);
diff --git a/ppapi/proxy/host_dispatcher.cc b/ppapi/proxy/host_dispatcher.cc
index ee7e919..fb4c909 100644
--- a/ppapi/proxy/host_dispatcher.cc
+++ b/ppapi/proxy/host_dispatcher.cc
@@ -224,10 +224,7 @@ const void* HostDispatcher::GetProxiedInterface(const std::string& iface_name) {
// Need to query. Cache the result so we only do this once.
bool supported = false;
- bool previous_reentrancy_value = allow_plugin_reentrancy_;
- allow_plugin_reentrancy_ = true;
Send(new PpapiMsg_SupportsInterface(iface_name, &supported));
- allow_plugin_reentrancy_ = previous_reentrancy_value;
std::pair<PluginSupportedMap::iterator, bool> iter_success_pair;
iter_success_pair = plugin_supported_.insert(
diff --git a/ppapi/proxy/ppapi_messages.h b/ppapi/proxy/ppapi_messages.h
index 484e6c7..766180b 100644
--- a/ppapi/proxy/ppapi_messages.h
+++ b/ppapi/proxy/ppapi_messages.h
@@ -1180,9 +1180,9 @@ IPC_SYNC_MESSAGE_ROUTED3_1(
IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBTesting_GetLiveObjectsForInstance,
PP_Instance /* instance */,
uint32 /* result */)
-IPC_SYNC_MESSAGE_ROUTED2_0(PpapiHostMsg_PPBTesting_SimulateInputEvent,
- PP_Instance /* instance */,
- ppapi::InputEventData /* input_event */)
+IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBTesting_SimulateInputEvent,
+ PP_Instance /* instance */,
+ ppapi::InputEventData /* input_event */)
IPC_SYNC_MESSAGE_ROUTED1_0(
PpapiHostMsg_PPBTesting_SetMinimumArrayBufferSizeForShmem,
uint32_t /* threshold */)