diff options
author | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-21 00:26:43 +0000 |
---|---|---|
committer | brettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-01-21 00:26:43 +0000 |
commit | 4614f1974881ecfd0a0118683bac628c6128c2a9 (patch) | |
tree | c69836459560dd8003f7e18ca554f2e1d7f79b4d /ppapi/proxy/ppb_char_set_proxy.cc | |
parent | b8e6654fb91108033580f510e2d411093936fc2f (diff) | |
download | chromium_src-4614f1974881ecfd0a0118683bac628c6128c2a9.zip chromium_src-4614f1974881ecfd0a0118683bac628c6128c2a9.tar.gz chromium_src-4614f1974881ecfd0a0118683bac628c6128c2a9.tar.bz2 |
First pass at making the proxy handle multiple renderers. This associates the
instance with resources and has most callers retrieve the dispatcher
according to the appropriate instance. This isn't hooked up to anything yet.
This changes some PPB_Flash interface methods to use PP_Bool.
The most challenging part of the change is in the plugin_var_tracker which
now needs to track which dispatcher each var object came from, and remap var
IDs since each renderer will be generating var IDs in its own space, which
will likely overlap. A similar system will need to be done for resources
which is not implemented yet.
I added some null checks in audio_impl because audio_ can be NULL in some
cases when using the trusted API. I discovered this when testing NaCl for
this patch.
Review URL: http://codereview.chromium.org/6282007
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@72053 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/proxy/ppb_char_set_proxy.cc')
-rw-r--r-- | ppapi/proxy/ppb_char_set_proxy.cc | 22 |
1 files changed, 18 insertions, 4 deletions
diff --git a/ppapi/proxy/ppb_char_set_proxy.cc b/ppapi/proxy/ppb_char_set_proxy.cc index e0be4aa..73ca61b 100644 --- a/ppapi/proxy/ppb_char_set_proxy.cc +++ b/ppapi/proxy/ppb_char_set_proxy.cc @@ -20,9 +20,14 @@ char* UTF16ToCharSet(PP_Instance instance, const char* output_char_set, PP_CharSet_ConversionError on_error, uint32_t* output_length) { + *output_length = 0; + PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); + if (!dispatcher) + return NULL; + bool output_is_success = false; std::string result; - PluginDispatcher::Get()->Send(new PpapiHostMsg_PPBCharSet_UTF16ToCharSet( + dispatcher->Send(new PpapiHostMsg_PPBCharSet_UTF16ToCharSet( INTERFACE_ID_PPB_CHAR_SET, instance, string16(reinterpret_cast<const char16*>(utf16), utf16_len), std::string(output_char_set), static_cast<int32_t>(on_error), @@ -41,9 +46,14 @@ uint16_t* CharSetToUTF16(PP_Instance instance, const char* input_char_set, PP_CharSet_ConversionError on_error, uint32_t* output_length) { + *output_length = 0; + PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); + if (!dispatcher) + return NULL; + bool output_is_success = false; string16 result; - PluginDispatcher::Get()->Send(new PpapiHostMsg_PPBCharSet_CharSetToUTF16( + dispatcher->Send(new PpapiHostMsg_PPBCharSet_CharSetToUTF16( INTERFACE_ID_PPB_CHAR_SET, instance, std::string(input, input_len), std::string(input_char_set), static_cast<int32_t>(on_error), @@ -59,10 +69,14 @@ uint16_t* CharSetToUTF16(PP_Instance instance, } PP_Var GetDefaultCharSet(PP_Instance instance) { + PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); + if (!dispatcher) + return PP_MakeUndefined(); + ReceiveSerializedVarReturnValue result; - PluginDispatcher::Get()->Send(new PpapiHostMsg_PPBCharSet_GetDefaultCharSet( + dispatcher->Send(new PpapiHostMsg_PPBCharSet_GetDefaultCharSet( INTERFACE_ID_PPB_CHAR_SET, instance, &result)); - return result.Return(PluginDispatcher::Get()); + return result.Return(dispatcher); } const PPB_CharSet_Dev ppb_charset_interface = { |