summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-02 23:59:53 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-12-02 23:59:53 +0000
commit99627bcf2331de091b2c71b5a84f602a7da95275 (patch)
tree79d9e9bf9f15d26065676db701af8ab9cc054ddb
parent2076272a9f10374f45a122ef7a0e7da9a62f7d81 (diff)
downloadchromium_src-99627bcf2331de091b2c71b5a84f602a7da95275.zip
chromium_src-99627bcf2331de091b2c71b5a84f602a7da95275.tar.gz
chromium_src-99627bcf2331de091b2c71b5a84f602a7da95275.tar.bz2
Make the DrawGlyphs call have the proper const arguments, and make the proxied
version of this API synchronous. Otherwise, the caller may end up trying to draw over the text that isn't there yet. TEST=none BUG=none Review URL: http://codereview.chromium.org/5555004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@68108 0039d316-1c4b-4281-b951-d872f2087c98
-rw-r--r--ppapi/proxy/ppapi_messages_internal.h7
-rw-r--r--ppapi/proxy/ppb_flash_proxy.cc18
-rw-r--r--ppapi/proxy/ppb_flash_proxy.h3
-rw-r--r--webkit/glue/plugins/pepper_private2.h6
-rw-r--r--webkit/glue/plugins/pepper_private2_linux.cc6
-rw-r--r--webkit/glue/plugins/ppb_private2.h6
6 files changed, 27 insertions, 19 deletions
diff --git a/ppapi/proxy/ppapi_messages_internal.h b/ppapi/proxy/ppapi_messages_internal.h
index 00534f4..1f854af 100644
--- a/ppapi/proxy/ppapi_messages_internal.h
+++ b/ppapi/proxy/ppapi_messages_internal.h
@@ -231,8 +231,11 @@ IPC_BEGIN_MESSAGES(PpapiHost)
IPC_MESSAGE_ROUTED2(PpapiHostMsg_PPBFlash_SetInstanceAlwaysOnTop,
PP_Instance /* instance */,
bool /* on_top */)
- IPC_MESSAGE_ROUTED1(PpapiHostMsg_PPBFlash_DrawGlyphs,
- pp::proxy::PPBFlash_DrawGlyphs_Params /* params */)
+ // This has to be synchronous becuase the caller may want to composite on
+ // top of the resulting text after the call is complete.
+ IPC_SYNC_MESSAGE_ROUTED1_1(PpapiHostMsg_PPBFlash_DrawGlyphs,
+ pp::proxy::PPBFlash_DrawGlyphs_Params /* params */,
+ bool /* result */)
IPC_SYNC_MESSAGE_ROUTED2_1(PpapiHostMsg_PPBFlash_GetProxyForURL,
PP_Module /* module */,
std::string /* url */,
diff --git a/ppapi/proxy/ppb_flash_proxy.cc b/ppapi/proxy/ppb_flash_proxy.cc
index 1f9b297..fb72eb3b 100644
--- a/ppapi/proxy/ppb_flash_proxy.cc
+++ b/ppapi/proxy/ppb_flash_proxy.cc
@@ -59,10 +59,10 @@ bool DrawGlyphs(PP_Resource pp_image_data,
uint32_t color,
PP_Point position,
PP_Rect clip,
- float transformation[3][3],
+ const float transformation[3][3],
uint32_t glyph_count,
- uint16_t glyph_indices[],
- PP_Point glyph_advances[]) {
+ const uint16_t glyph_indices[],
+ const PP_Point glyph_advances[]) {
Dispatcher* dispatcher = PluginDispatcher::Get();
PPBFlash_DrawGlyphs_Params params;
@@ -83,9 +83,10 @@ bool DrawGlyphs(PP_Resource pp_image_data,
&glyph_advances[0],
&glyph_advances[glyph_count]);
+ bool result = false;
dispatcher->Send(new PpapiHostMsg_PPBFlash_DrawGlyphs(
- INTERFACE_ID_PPB_FLASH, params));
- return true;
+ INTERFACE_ID_PPB_FLASH, params, &result));
+ return result;
}
PP_Var GetProxyForURL(PP_Module pp_module, const char* url) {
@@ -236,7 +237,10 @@ void PPB_Flash_Proxy::OnMsgSetInstanceAlwaysOnTop(
}
void PPB_Flash_Proxy::OnMsgDrawGlyphs(
- const pp::proxy::PPBFlash_DrawGlyphs_Params& params) {
+ const pp::proxy::PPBFlash_DrawGlyphs_Params& params,
+ bool* result) {
+ *result = false;
+
PP_FontDescription_Dev font_desc;
params.font_desc.SetToPPFontDescription(dispatcher(), &font_desc, false);
@@ -244,7 +248,7 @@ void PPB_Flash_Proxy::OnMsgDrawGlyphs(
params.glyph_indices.empty())
return;
- ppb_flash_target()->DrawGlyphs(
+ *result = ppb_flash_target()->DrawGlyphs(
params.pp_image_data, &font_desc, params.color,
params.position, params.clip,
const_cast<float(*)[3]>(params.transformation),
diff --git a/ppapi/proxy/ppb_flash_proxy.h b/ppapi/proxy/ppb_flash_proxy.h
index 0c7f1ab..11eb0fc 100644
--- a/ppapi/proxy/ppb_flash_proxy.h
+++ b/ppapi/proxy/ppb_flash_proxy.h
@@ -41,7 +41,8 @@ class PPB_Flash_Proxy : public InterfaceProxy {
// Message handlers.
void OnMsgSetInstanceAlwaysOnTop(PP_Instance instance,
bool on_top);
- void OnMsgDrawGlyphs(const pp::proxy::PPBFlash_DrawGlyphs_Params& params);
+ void OnMsgDrawGlyphs(const pp::proxy::PPBFlash_DrawGlyphs_Params& params,
+ bool* result);
void OnMsgGetProxyForURL(PP_Module module,
const std::string& url,
SerializedVarReturnValue result);
diff --git a/webkit/glue/plugins/pepper_private2.h b/webkit/glue/plugins/pepper_private2.h
index 64a766f..fd767a2 100644
--- a/webkit/glue/plugins/pepper_private2.h
+++ b/webkit/glue/plugins/pepper_private2.h
@@ -26,10 +26,10 @@ class Private2 {
uint32_t color,
PP_Point position,
PP_Rect clip,
- float transformation[3][3],
+ const float transformation[3][3],
uint32_t glyph_count,
- uint16_t glyph_indices[],
- PP_Point glyph_advances[])
+ const uint16_t glyph_indices[],
+ const PP_Point glyph_advances[])
#if defined(OS_LINUX)
;
#else
diff --git a/webkit/glue/plugins/pepper_private2_linux.cc b/webkit/glue/plugins/pepper_private2_linux.cc
index ed2c04a..12ecb9a 100644
--- a/webkit/glue/plugins/pepper_private2_linux.cc
+++ b/webkit/glue/plugins/pepper_private2_linux.cc
@@ -24,10 +24,10 @@ bool Private2::DrawGlyphs(PP_Resource pp_image_data,
uint32_t color,
PP_Point position,
PP_Rect clip,
- float transformation[3][3],
+ const float transformation[3][3],
uint32_t glyph_count,
- uint16_t glyph_indices[],
- PP_Point glyph_advances[]) {
+ const uint16_t glyph_indices[],
+ const PP_Point glyph_advances[]) {
scoped_refptr<ImageData> image_resource(
Resource::GetAs<ImageData>(pp_image_data));
if (!image_resource.get())
diff --git a/webkit/glue/plugins/ppb_private2.h b/webkit/glue/plugins/ppb_private2.h
index acf7831..9eea66d 100644
--- a/webkit/glue/plugins/ppb_private2.h
+++ b/webkit/glue/plugins/ppb_private2.h
@@ -51,10 +51,10 @@ struct PPB_Private2 {
uint32_t color,
PP_Point position,
PP_Rect clip,
- float transformation[3][3],
+ const float transformation[3][3],
uint32_t glyph_count,
- uint16_t glyph_indices[],
- PP_Point glyph_advances[]);
+ const uint16_t glyph_indices[],
+ const PP_Point glyph_advances[]);
// Retrieves the proxy that will be used for the given URL. The result will
// be a string in PAC format, or an undefined var on error.