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

Unified Diff: ppapi/proxy/ppb_video_decoder_proxy.cc

Issue 7844018: Revert 100748 - This patch tries to remove most of the manual registration for Pepper interfaces,... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/proxy/ppb_video_decoder_proxy.h ('k') | ppapi/proxy/ppp_class_proxy.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppb_video_decoder_proxy.cc
===================================================================
--- ppapi/proxy/ppb_video_decoder_proxy.cc (revision 100753)
+++ ppapi/proxy/ppb_video_decoder_proxy.cc (working copy)
@@ -154,14 +154,36 @@
RunBitstreamBufferCallback(bitstream_buffer_id, result);
}
-PPB_VideoDecoder_Proxy::PPB_VideoDecoder_Proxy(Dispatcher* dispatcher)
- : InterfaceProxy(dispatcher),
+namespace {
+
+InterfaceProxy* CreateVideoDecoderProxy(Dispatcher* dispatcher,
+ const void* target_interface) {
+ return new PPB_VideoDecoder_Proxy(dispatcher, target_interface);
+}
+
+} // namespace
+
+PPB_VideoDecoder_Proxy::PPB_VideoDecoder_Proxy(Dispatcher* dispatcher,
+ const void* target_interface)
+ : InterfaceProxy(dispatcher, target_interface),
callback_factory_(ALLOW_THIS_IN_INITIALIZER_LIST(this)) {
}
PPB_VideoDecoder_Proxy::~PPB_VideoDecoder_Proxy() {
}
+// static
+const InterfaceProxy::Info* PPB_VideoDecoder_Proxy::GetInfo() {
+ static const Info info = {
+ thunk::GetPPB_VideoDecoder_Thunk(),
+ PPB_VIDEODECODER_DEV_INTERFACE,
+ INTERFACE_ID_PPB_VIDEO_DECODER_DEV,
+ false,
+ &CreateVideoDecoderProxy,
+ };
+ return &info;
+}
+
bool PPB_VideoDecoder_Proxy::OnMessageReceived(const IPC::Message& msg) {
bool handled = true;
IPC_BEGIN_MESSAGE_MAP(PPB_VideoDecoder_Proxy, msg)
@@ -230,7 +252,8 @@
PP_Instance instance, const HostResource& graphics_context,
PP_VideoDecoder_Profile profile,
HostResource* result) {
- thunk::EnterResourceCreation resource_creation(instance);
+ thunk::EnterFunction<thunk::ResourceCreationAPI> resource_creation(instance,
+ true);
if (resource_creation.failed())
return;
@@ -243,52 +266,46 @@
void PPB_VideoDecoder_Proxy::OnMsgDecode(
const HostResource& decoder,
const HostResource& buffer, int32 id, int32 size) {
- EnterHostFromHostResourceForceCallback<PPB_VideoDecoder_API> enter(
- decoder, callback_factory_,
+ pp::CompletionCallback callback = callback_factory_.NewRequiredCallback(
&PPB_VideoDecoder_Proxy::SendMsgEndOfBitstreamACKToPlugin, decoder, id);
- if (enter.failed())
- return;
+
PP_VideoBitstreamBuffer_Dev bitstream = { id, buffer.host_resource(), size };
- enter.SetResult(enter.object()->Decode(&bitstream, enter.callback()));
+ ppb_video_decoder_target()->Decode(
+ decoder.host_resource(), &bitstream, callback.pp_completion_callback());
}
void PPB_VideoDecoder_Proxy::OnMsgAssignPictureBuffers(
const HostResource& decoder,
const std::vector<PP_PictureBuffer_Dev>& buffers) {
- EnterHostFromHostResource<PPB_VideoDecoder_API> enter(decoder);
- if (enter.succeeded() && !buffers.empty()) {
- const PP_PictureBuffer_Dev* buffer_array = &buffers.front();
- enter.object()->AssignPictureBuffers(buffers.size(), buffer_array);
- }
+ DCHECK(!buffers.empty());
+ const PP_PictureBuffer_Dev* buffer_array = &buffers.front();
+
+ ppb_video_decoder_target()->AssignPictureBuffers(
+ decoder.host_resource(), buffers.size(), buffer_array);
}
void PPB_VideoDecoder_Proxy::OnMsgReusePictureBuffer(
const HostResource& decoder, int32 picture_buffer_id) {
- EnterHostFromHostResource<PPB_VideoDecoder_API> enter(decoder);
- if (enter.succeeded())
- enter.object()->ReusePictureBuffer(picture_buffer_id);
+ ppb_video_decoder_target()->ReusePictureBuffer(
+ decoder.host_resource(), picture_buffer_id);
}
void PPB_VideoDecoder_Proxy::OnMsgFlush(const HostResource& decoder) {
- EnterHostFromHostResourceForceCallback<PPB_VideoDecoder_API> enter(
- decoder, callback_factory_,
+ pp::CompletionCallback callback = callback_factory_.NewRequiredCallback(
&PPB_VideoDecoder_Proxy::SendMsgFlushACKToPlugin, decoder);
- if (enter.succeeded())
- enter.SetResult(enter.object()->Flush(enter.callback()));
+ ppb_video_decoder_target()->Flush(
+ decoder.host_resource(), callback.pp_completion_callback());
}
void PPB_VideoDecoder_Proxy::OnMsgReset(const HostResource& decoder) {
- EnterHostFromHostResourceForceCallback<PPB_VideoDecoder_API> enter(
- decoder, callback_factory_,
+ pp::CompletionCallback callback = callback_factory_.NewRequiredCallback(
&PPB_VideoDecoder_Proxy::SendMsgResetACKToPlugin, decoder);
- if (enter.succeeded())
- enter.SetResult(enter.object()->Reset(enter.callback()));
+ ppb_video_decoder_target()->Reset(
+ decoder.host_resource(), callback.pp_completion_callback());
}
void PPB_VideoDecoder_Proxy::OnMsgDestroy(const HostResource& decoder) {
- EnterHostFromHostResource<PPB_VideoDecoder_API> enter(decoder);
- if (enter.succeeded())
- enter.object()->Destroy();
+ ppb_video_decoder_target()->Destroy(decoder.host_resource());
}
void PPB_VideoDecoder_Proxy::SendMsgEndOfBitstreamACKToPlugin(
« no previous file with comments | « ppapi/proxy/ppb_video_decoder_proxy.h ('k') | ppapi/proxy/ppp_class_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698