summaryrefslogtreecommitdiffstats
path: root/ppapi/proxy
diff options
context:
space:
mode:
authordmichael <dmichael@chromium.org>2014-09-11 09:57:30 -0700
committerCommit bot <commit-bot@chromium.org>2014-09-11 17:02:08 +0000
commit36e91cd9ac1516a202ab09cc5ea98781c84db0d8 (patch)
treed0526b2dec7c5d9d2d48d26a498fba752ed578b3 /ppapi/proxy
parentc4bd497fb06b718f8829845da165864851767341 (diff)
downloadchromium_src-36e91cd9ac1516a202ab09cc5ea98781c84db0d8.zip
chromium_src-36e91cd9ac1516a202ab09cc5ea98781c84db0d8.tar.gz
chromium_src-36e91cd9ac1516a202ab09cc5ea98781c84db0d8.tar.bz2
PPAPI: Make CallWhileUnlocked more permissive.
Prior to this patch, CallWhileUnlocked required its parameters' types to be perfect matches to the types in the function pointer it's meant to invoke. This is counter to programmers' usual expectations for function calls, since the compiler will usually do safe casts like add const or promoting integral types. This just adds template params to CallWhileUnlocked so that any call with the appropriate number of parameters will be a template match. The compiler will still decide if there is a valid implicit conversion, so this is still safe in the sense that mismatched params still won't compile. BUG=160925 Review URL: https://codereview.chromium.org/552423003 Cr-Commit-Position: refs/heads/master@{#294405}
Diffstat (limited to 'ppapi/proxy')
-rw-r--r--ppapi/proxy/ppp_content_decryptor_private_proxy.cc8
-rw-r--r--ppapi/proxy/ppp_printing_proxy.cc9
-rw-r--r--ppapi/proxy/video_capture_resource.cc4
3 files changed, 9 insertions, 12 deletions
diff --git a/ppapi/proxy/ppp_content_decryptor_private_proxy.cc b/ppapi/proxy/ppp_content_decryptor_private_proxy.cc
index 9d9afcc..e956d12 100644
--- a/ppapi/proxy/ppp_content_decryptor_private_proxy.cc
+++ b/ppapi/proxy/ppp_content_decryptor_private_proxy.cc
@@ -688,7 +688,7 @@ void PPP_ContentDecryptor_Private_Proxy::OnMsgDecrypt(
CallWhileUnlocked(ppp_decryptor_impl_->Decrypt,
instance,
plugin_resource.get(),
- const_cast<const PP_EncryptedBlockInfo*>(&block_info));
+ &block_info);
}
}
@@ -713,7 +713,7 @@ void PPP_ContentDecryptor_Private_Proxy::OnMsgInitializeAudioDecoder(
CallWhileUnlocked(
ppp_decryptor_impl_->InitializeAudioDecoder,
instance,
- const_cast<const PP_AudioDecoderConfig*>(&decoder_config),
+ &decoder_config,
plugin_resource.get());
}
}
@@ -739,7 +739,7 @@ void PPP_ContentDecryptor_Private_Proxy::OnMsgInitializeVideoDecoder(
CallWhileUnlocked(
ppp_decryptor_impl_->InitializeVideoDecoder,
instance,
- const_cast<const PP_VideoDecoderConfig*>(&decoder_config),
+ &decoder_config,
plugin_resource.get());
}
}
@@ -793,7 +793,7 @@ void PPP_ContentDecryptor_Private_Proxy::OnMsgDecryptAndDecode(
instance,
decoder_type,
plugin_resource.get(),
- const_cast<const PP_EncryptedBlockInfo*>(&block_info));
+ &block_info);
}
}
diff --git a/ppapi/proxy/ppp_printing_proxy.cc b/ppapi/proxy/ppp_printing_proxy.cc
index 9d58c78..7b2ae55 100644
--- a/ppapi/proxy/ppp_printing_proxy.cc
+++ b/ppapi/proxy/ppp_printing_proxy.cc
@@ -167,11 +167,8 @@ void PPP_Printing_Proxy::OnPluginMsgBegin(PP_Instance instance,
return;
memcpy(&settings, &settings_string[0], sizeof(settings));
- if (ppp_printing_impl_) {
- *result = CallWhileUnlocked(ppp_printing_impl_->Begin,
- instance,
- const_cast<const PP_PrintSettings_Dev*>(&settings));
- }
+ if (ppp_printing_impl_)
+ *result = CallWhileUnlocked(ppp_printing_impl_->Begin, instance, &settings);
}
void PPP_Printing_Proxy::OnPluginMsgPrintPages(
@@ -183,7 +180,7 @@ void PPP_Printing_Proxy::OnPluginMsgPrintPages(
PP_Resource plugin_resource = CallWhileUnlocked(
ppp_printing_impl_->PrintPages,
- instance, &pages[0], static_cast<uint32_t>(pages.size()));
+ instance, &pages[0], pages.size());
ResourceTracker* resource_tracker = PpapiGlobals::Get()->GetResourceTracker();
Resource* resource_object = resource_tracker->GetResource(plugin_resource);
if (!resource_object)
diff --git a/ppapi/proxy/video_capture_resource.cc b/ppapi/proxy/video_capture_resource.cc
index 8931b8f..5c95ed8 100644
--- a/ppapi/proxy/video_capture_resource.cc
+++ b/ppapi/proxy/video_capture_resource.cc
@@ -166,8 +166,8 @@ void VideoCaptureResource::OnPluginMsgOnDeviceInfo(
pp_instance(),
pp_resource(),
&info,
- static_cast<uint32_t>(buffers.size()),
- const_cast<const PP_Resource*>(resources.get()));
+ buffers.size(),
+ resources.get());
for (size_t i = 0; i < buffers.size(); ++i)
tracker->ReleaseResource(resources[i]);