diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-28 20:01:16 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-28 20:01:16 +0000 |
commit | 2031aeb7449a3cdf6a344fd3338d6d675e275592 (patch) | |
tree | 4d2a4318bb239bb5f3479f8a1345e9fe0d033bea /ppapi | |
parent | 42815290666fbe4b6cc7e26bacd38df95dbdd7e0 (diff) | |
download | chromium_src-2031aeb7449a3cdf6a344fd3338d6d675e275592.zip chromium_src-2031aeb7449a3cdf6a344fd3338d6d675e275592.tar.gz chromium_src-2031aeb7449a3cdf6a344fd3338d6d675e275592.tar.bz2 |
Fix some bugs with incorrect ! (both missing and extra) in the proxy error handling.
Go back to using the old code for the audio created notification. There was a
bug deserializing one of the handles, and the new code I wrote didn't turn out
to be necessary anyway.
TEST=audio plays in out-of-process proxy (manual)
BUG=none
Review URL: http://codereview.chromium.org/6341015
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@73003 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi')
-rw-r--r-- | ppapi/proxy/ppapi_messages_internal.h | 8 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_param_traits.cc | 30 | ||||
-rw-r--r-- | ppapi/proxy/ppapi_param_traits.h | 9 | ||||
-rw-r--r-- | ppapi/proxy/ppb_audio_config_proxy.cc | 2 | ||||
-rw-r--r-- | ppapi/proxy/ppb_audio_proxy.cc | 26 | ||||
-rw-r--r-- | ppapi/proxy/ppb_audio_proxy.h | 8 | ||||
-rw-r--r-- | ppapi/proxy/ppb_font_proxy.cc | 2 |
7 files changed, 25 insertions, 60 deletions
diff --git a/ppapi/proxy/ppapi_messages_internal.h b/ppapi/proxy/ppapi_messages_internal.h index e949ad1..07cf77b 100644 --- a/ppapi/proxy/ppapi_messages_internal.h +++ b/ppapi/proxy/ppapi_messages_internal.h @@ -45,8 +45,12 @@ IPC_MESSAGE_CONTROL2(PpapiMsg_ExecuteCallback, // // The handler of this message should always close all of the handles passed // in, since some could be valid even in the error case. -IPC_MESSAGE_ROUTED1(PpapiMsg_PPBAudio_NotifyAudioStreamCreated, - pp::proxy::PPBAudio_NotifyAudioStreamCreated_Params); +IPC_MESSAGE_ROUTED5(PpapiMsg_PPBAudio_NotifyAudioStreamCreated, + pp::proxy::HostResource /* audio_id */, + int32_t /* result_code (will be != PP_OK on failure) */, + IPC::PlatformFileForTransit /* socket_handle */, + base::SharedMemoryHandle /* handle */, + int32_t /* length */) // PPB_Graphics2D. IPC_MESSAGE_ROUTED2(PpapiMsg_PPBGraphics2D_FlushACK, diff --git a/ppapi/proxy/ppapi_param_traits.cc b/ppapi/proxy/ppapi_param_traits.cc index e38e9bf1..c4f9aae 100644 --- a/ppapi/proxy/ppapi_param_traits.cc +++ b/ppapi/proxy/ppapi_param_traits.cc @@ -181,36 +181,6 @@ bool ParamTraits<PP_Size>::Read(const Message* m, void** iter, param_type* r) { void ParamTraits<PP_Size>::Log(const param_type& p, std::string* l) { } -// PPBAudio_NotifyAudioStreamCreated_Params ------------------------------------ - -// static -void ParamTraits<pp::proxy::PPBAudio_NotifyAudioStreamCreated_Params>::Write( - Message* m, - const param_type& p) { - ParamTraits<pp::proxy::HostResource>::Write(m, p.audio_id); - ParamTraits<int32_t>::Write(m, p.result_code); - ParamTraits<PlatformFileForTransit>::Write(m, p.socket_handle); - ParamTraits<int32_t>::Write(m, p.length); -} - -// static -bool ParamTraits<pp::proxy::PPBAudio_NotifyAudioStreamCreated_Params>::Read( - const Message* m, - void** iter, - param_type* r) { - return - ParamTraits<pp::proxy::HostResource>::Read(m, iter, &r->audio_id) && - ParamTraits<int32_t>::Read(m, iter, &r->result_code) && - ParamTraits<PlatformFileForTransit>::Read(m, iter, &r->socket_handle) && - ParamTraits<int32_t>::Read(m, iter, &r->length); -} - -// static -void ParamTraits<pp::proxy::PPBAudio_NotifyAudioStreamCreated_Params>::Log( - const param_type& p, - std::string* l) { -} - // PPBFlash_DrawGlyphs_Params -------------------------------------------------- // static diff --git a/ppapi/proxy/ppapi_param_traits.h b/ppapi/proxy/ppapi_param_traits.h index 3a7358d..017cd39 100644 --- a/ppapi/proxy/ppapi_param_traits.h +++ b/ppapi/proxy/ppapi_param_traits.h @@ -18,7 +18,6 @@ struct PP_ObjectProperty; namespace pp { namespace proxy { -struct PPBAudio_NotifyAudioStreamCreated_Params; struct PPBFlash_DrawGlyphs_Params; struct PPBFont_DrawTextAt_Params; struct PPBURLLoader_UpdateProgress_Params; @@ -88,14 +87,6 @@ struct ParamTraits<PP_Size> { static void Log(const param_type& p, std::string* l); }; -template<> struct ParamTraits< - pp::proxy::PPBAudio_NotifyAudioStreamCreated_Params> { - typedef pp::proxy::PPBAudio_NotifyAudioStreamCreated_Params param_type; - static void Write(Message* m, const param_type& p); - static bool Read(const Message* m, void** iter, param_type* r); - static void Log(const param_type& p, std::string* l); -}; - template<> struct ParamTraits<pp::proxy::PPBFlash_DrawGlyphs_Params> { typedef pp::proxy::PPBFlash_DrawGlyphs_Params param_type; diff --git a/ppapi/proxy/ppb_audio_config_proxy.cc b/ppapi/proxy/ppb_audio_config_proxy.cc index d437694..15b0987 100644 --- a/ppapi/proxy/ppb_audio_config_proxy.cc +++ b/ppapi/proxy/ppb_audio_config_proxy.cc @@ -47,7 +47,7 @@ PP_Resource CreateStereo16bit(PP_Instance instance, INTERFACE_ID_PPB_AUDIO_CONFIG, instance, static_cast<int32_t>(sample_rate), sample_frame_count, &resource)); - if (!resource.is_null()) + if (resource.is_null()) return 0; linked_ptr<AudioConfig> object( diff --git a/ppapi/proxy/ppb_audio_proxy.cc b/ppapi/proxy/ppb_audio_proxy.cc index c1095cf..a01e785 100644 --- a/ppapi/proxy/ppb_audio_proxy.cc +++ b/ppapi/proxy/ppb_audio_proxy.cc @@ -185,24 +185,27 @@ void PPB_Audio_Proxy::OnMsgStartOrStop(const HostResource& audio_id, // Processed in the plugin (message from host). void PPB_Audio_Proxy::OnMsgNotifyAudioStreamCreated( - const PPBAudio_NotifyAudioStreamCreated_Params& params) { + const HostResource& audio_id, + int32_t result_code, + IPC::PlatformFileForTransit socket_handle, + base::SharedMemoryHandle handle, + uint32_t length) { PP_Resource plugin_resource = PluginResourceTracker::GetInstance()->PluginResourceForHostResource( - params.audio_id); + audio_id); Audio* object = plugin_resource ? PluginResource::GetAs<Audio>(plugin_resource) : NULL; - if (!object || params.result_code != PP_OK) { + if (!object || result_code != PP_OK) { // The caller may still have given us these handles in the failure case. // The easiest way to clean these up is to just put them in the objects // and then close them. This failure case is not performance critical. base::SyncSocket temp_socket( - IPC::PlatformFileForTransitToPlatformFile(params.socket_handle)); - base::SharedMemory temp_mem(params.handle, false); + IPC::PlatformFileForTransitToPlatformFile(socket_handle)); + base::SharedMemory temp_mem(handle, false); return; } object->SetStreamInfo( - params.handle, params.length, - IPC::PlatformFileForTransitToPlatformFile(params.socket_handle)); + handle, length, IPC::PlatformFileForTransitToPlatformFile(socket_handle)); } void PPB_Audio_Proxy::AudioChannelConnected( @@ -231,14 +234,9 @@ void PPB_Audio_Proxy::AudioChannelConnected( // inconvenient to clean up. Our IPC code will automatically handle this for // us, as long as the remote side always closes the handles it receives // (in OnMsgNotifyAudioStreamCreated), even in the failure case. - PPBAudio_NotifyAudioStreamCreated_Params params; - params.audio_id = resource; - params.result_code = result; - params.socket_handle = socket_handle; - params.handle = shared_memory; - params.length = shared_memory_length; dispatcher()->Send(new PpapiMsg_PPBAudio_NotifyAudioStreamCreated( - INTERFACE_ID_PPB_AUDIO, params)); + INTERFACE_ID_PPB_AUDIO, resource, result_code, socket_handle, + shared_memory, shared_memory_length)); } int32_t PPB_Audio_Proxy::GetAudioConnectedHandles( diff --git a/ppapi/proxy/ppb_audio_proxy.h b/ppapi/proxy/ppb_audio_proxy.h index 7ac27f5..02ecb5c 100644 --- a/ppapi/proxy/ppb_audio_proxy.h +++ b/ppapi/proxy/ppb_audio_proxy.h @@ -21,7 +21,6 @@ struct PPB_Audio; namespace pp { namespace proxy { -struct PPBAudio_NotifyAudioStreamCreated_Params; class HostResource; class PPB_Audio_Proxy : public InterfaceProxy { @@ -46,8 +45,11 @@ class PPB_Audio_Proxy : public InterfaceProxy { void OnMsgStartOrStop(const HostResource& audio_id, bool play); // Renderer->plugin message handlers. - void OnMsgNotifyAudioStreamCreated( - const PPBAudio_NotifyAudioStreamCreated_Params& params); + void OnMsgNotifyAudioStreamCreated(const HostResource& audio_id, + int32_t result_code, + IPC::PlatformFileForTransit socket_handle, + base::SharedMemoryHandle handle, + uint32_t length); void AudioChannelConnected(int32_t result, const HostResource& resource); diff --git a/ppapi/proxy/ppb_font_proxy.cc b/ppapi/proxy/ppb_font_proxy.cc index 1bbfcf0..26ca738 100644 --- a/ppapi/proxy/ppb_font_proxy.cc +++ b/ppapi/proxy/ppb_font_proxy.cc @@ -249,7 +249,7 @@ void PPB_Font_Proxy::OnMsgCreate( result->SetHostResource(instance, ppb_font_target()->Create(instance, &in_pp_desc)); - if (result->is_null()) { + if (!result->is_null()) { // Get the metrics and resulting description to return to the browser. PP_FontMetrics_Dev metrics; if (ppb_font_target()->Describe(result->host_resource(), &out_pp_desc, |