| 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 "ppapi/proxy/ppp_video_decoder_proxy.h" | 5 #include "ppapi/proxy/ppp_video_decoder_proxy.h" |
| 6 | 6 |
| 7 #include "ppapi/proxy/host_dispatcher.h" | 7 #include "ppapi/proxy/host_dispatcher.h" |
| 8 #include "ppapi/proxy/plugin_globals.h" | 8 #include "ppapi/proxy/plugin_globals.h" |
| 9 #include "ppapi/proxy/plugin_resource_tracker.h" | 9 #include "ppapi/proxy/plugin_resource_tracker.h" |
| 10 #include "ppapi/proxy/ppapi_messages.h" | 10 #include "ppapi/proxy/ppapi_messages.h" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 70 } | 70 } |
| 71 } | 71 } |
| 72 | 72 |
| 73 static const PPP_VideoDecoder_Dev video_decoder_interface = { | 73 static const PPP_VideoDecoder_Dev video_decoder_interface = { |
| 74 &ProvidePictureBuffers, | 74 &ProvidePictureBuffers, |
| 75 &DismissPictureBuffer, | 75 &DismissPictureBuffer, |
| 76 &PictureReady, | 76 &PictureReady, |
| 77 &NotifyError | 77 &NotifyError |
| 78 }; | 78 }; |
| 79 | 79 |
| 80 InterfaceProxy* CreateVideoDecoderPPPProxy(Dispatcher* dispatcher) { | |
| 81 return new PPP_VideoDecoder_Proxy(dispatcher); | |
| 82 } | |
| 83 | |
| 84 } // namespace | 80 } // namespace |
| 85 | 81 |
| 86 PPP_VideoDecoder_Proxy::PPP_VideoDecoder_Proxy(Dispatcher* dispatcher) | 82 PPP_VideoDecoder_Proxy::PPP_VideoDecoder_Proxy(Dispatcher* dispatcher) |
| 87 : InterfaceProxy(dispatcher), | 83 : InterfaceProxy(dispatcher), |
| 88 ppp_video_decoder_impl_(NULL) { | 84 ppp_video_decoder_impl_(NULL) { |
| 89 if (dispatcher->IsPlugin()) { | 85 if (dispatcher->IsPlugin()) { |
| 90 ppp_video_decoder_impl_ = static_cast<const PPP_VideoDecoder_Dev*>( | 86 ppp_video_decoder_impl_ = static_cast<const PPP_VideoDecoder_Dev*>( |
| 91 dispatcher->local_get_interface()(PPP_VIDEODECODER_DEV_INTERFACE)); | 87 dispatcher->local_get_interface()(PPP_VIDEODECODER_DEV_INTERFACE)); |
| 92 } | 88 } |
| 93 } | 89 } |
| 94 | 90 |
| 95 PPP_VideoDecoder_Proxy::~PPP_VideoDecoder_Proxy() { | 91 PPP_VideoDecoder_Proxy::~PPP_VideoDecoder_Proxy() { |
| 96 } | 92 } |
| 97 | 93 |
| 98 // static | 94 // static |
| 99 const InterfaceProxy::Info* PPP_VideoDecoder_Proxy::GetInfo() { | 95 const PPP_VideoDecoder_Dev* PPP_VideoDecoder_Proxy::GetProxyInterface() { |
| 100 static const Info info = { | 96 return &video_decoder_interface; |
| 101 &video_decoder_interface, | |
| 102 PPP_VIDEODECODER_DEV_INTERFACE, | |
| 103 API_ID_PPP_VIDEO_DECODER_DEV, | |
| 104 false, | |
| 105 &CreateVideoDecoderPPPProxy, | |
| 106 }; | |
| 107 return &info; | |
| 108 } | 97 } |
| 109 | 98 |
| 110 bool PPP_VideoDecoder_Proxy::OnMessageReceived(const IPC::Message& msg) { | 99 bool PPP_VideoDecoder_Proxy::OnMessageReceived(const IPC::Message& msg) { |
| 111 if (!dispatcher()->IsPlugin()) | 100 if (!dispatcher()->IsPlugin()) |
| 112 return false; | 101 return false; |
| 113 | 102 |
| 114 bool handled = true; | 103 bool handled = true; |
| 115 IPC_BEGIN_MESSAGE_MAP(PPP_VideoDecoder_Proxy, msg) | 104 IPC_BEGIN_MESSAGE_MAP(PPP_VideoDecoder_Proxy, msg) |
| 116 IPC_MESSAGE_HANDLER(PpapiMsg_PPPVideoDecoder_ProvidePictureBuffers, | 105 IPC_MESSAGE_HANDLER(PpapiMsg_PPPVideoDecoder_ProvidePictureBuffers, |
| 117 OnMsgProvidePictureBuffers) | 106 OnMsgProvidePictureBuffers) |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 if (!plugin_decoder) | 164 if (!plugin_decoder) |
| 176 return; | 165 return; |
| 177 CallWhileUnlocked(ppp_video_decoder_impl_->NotifyError, | 166 CallWhileUnlocked(ppp_video_decoder_impl_->NotifyError, |
| 178 decoder.instance(), | 167 decoder.instance(), |
| 179 plugin_decoder, | 168 plugin_decoder, |
| 180 error); | 169 error); |
| 181 } | 170 } |
| 182 | 171 |
| 183 } // namespace proxy | 172 } // namespace proxy |
| 184 } // namespace ppapi | 173 } // namespace ppapi |
| OLD | NEW |