| 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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 52 HostDispatcher::GetForInstance(instance)->Send( | 52 HostDispatcher::GetForInstance(instance)->Send( |
| 53 new PpapiMsg_PPPVideoDecoder_PictureReady( | 53 new PpapiMsg_PPPVideoDecoder_PictureReady( |
| 54 API_ID_PPP_VIDEO_DECODER_DEV, decoder_resource, *picture)); | 54 API_ID_PPP_VIDEO_DECODER_DEV, decoder_resource, *picture)); |
| 55 } | 55 } |
| 56 | 56 |
| 57 void NotifyError(PP_Instance instance, PP_Resource decoder, | 57 void NotifyError(PP_Instance instance, PP_Resource decoder, |
| 58 PP_VideoDecodeError_Dev error) { | 58 PP_VideoDecodeError_Dev error) { |
| 59 HostResource decoder_resource; | 59 HostResource decoder_resource; |
| 60 decoder_resource.SetHostResource(instance, decoder); | 60 decoder_resource.SetHostResource(instance, decoder); |
| 61 | 61 |
| 62 HostDispatcher::GetForInstance(instance)->Send( | 62 // It's possible that the error we're being notified about is happening |
| 63 // because the instance is shutting down. In this case, our instance may |
| 64 // already have been removed from the HostDispatcher map. |
| 65 HostDispatcher* dispatcher = HostDispatcher::GetForInstance(instance); |
| 66 if (dispatcher) { |
| 67 dispatcher->Send( |
| 63 new PpapiMsg_PPPVideoDecoder_NotifyError( | 68 new PpapiMsg_PPPVideoDecoder_NotifyError( |
| 64 API_ID_PPP_VIDEO_DECODER_DEV, decoder_resource, error)); | 69 API_ID_PPP_VIDEO_DECODER_DEV, decoder_resource, error)); |
| 70 } |
| 65 } | 71 } |
| 66 | 72 |
| 67 static const PPP_VideoDecoder_Dev video_decoder_interface = { | 73 static const PPP_VideoDecoder_Dev video_decoder_interface = { |
| 68 &ProvidePictureBuffers, | 74 &ProvidePictureBuffers, |
| 69 &DismissPictureBuffer, | 75 &DismissPictureBuffer, |
| 70 &PictureReady, | 76 &PictureReady, |
| 71 &NotifyError | 77 &NotifyError |
| 72 }; | 78 }; |
| 73 | 79 |
| 74 InterfaceProxy* CreateVideoDecoderPPPProxy(Dispatcher* dispatcher) { | 80 InterfaceProxy* CreateVideoDecoderPPPProxy(Dispatcher* dispatcher) { |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 169 if (!plugin_decoder) | 175 if (!plugin_decoder) |
| 170 return; | 176 return; |
| 171 CallWhileUnlocked(ppp_video_decoder_impl_->NotifyError, | 177 CallWhileUnlocked(ppp_video_decoder_impl_->NotifyError, |
| 172 decoder.instance(), | 178 decoder.instance(), |
| 173 plugin_decoder, | 179 plugin_decoder, |
| 174 error); | 180 error); |
| 175 } | 181 } |
| 176 | 182 |
| 177 } // namespace proxy | 183 } // namespace proxy |
| 178 } // namespace ppapi | 184 } // namespace ppapi |
| OLD | NEW |