Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(437)

Side by Side Diff: ppapi/proxy/ppb_flash_proxy.cc

Issue 6334016: Refactor PPAPI proxy resource handling to maintain which host they came from,... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ppapi/proxy/ppb_cursor_control_proxy.cc ('k') | ppapi/proxy/ppb_font_proxy.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/ppb_flash_proxy.h" 5 #include "ppapi/proxy/ppb_flash_proxy.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #include "ppapi/c/dev/pp_file_info_dev.h" 9 #include "ppapi/c/dev/pp_file_info_dev.h"
10 #include "ppapi/c/dev/ppb_font_dev.h" 10 #include "ppapi/c/dev/ppb_font_dev.h"
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after
60 PP_Bool DrawGlyphs(PP_Instance instance, 60 PP_Bool DrawGlyphs(PP_Instance instance,
61 PP_Resource pp_image_data, 61 PP_Resource pp_image_data,
62 const PP_FontDescription_Dev* font_desc, 62 const PP_FontDescription_Dev* font_desc,
63 uint32_t color, 63 uint32_t color,
64 PP_Point position, 64 PP_Point position,
65 PP_Rect clip, 65 PP_Rect clip,
66 const float transformation[3][3], 66 const float transformation[3][3],
67 uint32_t glyph_count, 67 uint32_t glyph_count,
68 const uint16_t glyph_indices[], 68 const uint16_t glyph_indices[],
69 const PP_Point glyph_advances[]) { 69 const PP_Point glyph_advances[]) {
70 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(instance); 70 PluginResource* image_data = PluginResourceTracker::GetInstance()->
71 GetResourceObject(pp_image_data);
72 if (!image_data)
73 return PP_FALSE;
74 // The instance parameter isn't strictly necessary but we check that it
75 // matches anyway.
76 if (image_data->instance() != instance)
77 return PP_FALSE;
78
79 PluginDispatcher* dispatcher = PluginDispatcher::GetForInstance(
80 image_data->instance());
71 if (!dispatcher) 81 if (!dispatcher)
72 return PP_FALSE; 82 return PP_FALSE;
73 83
74 PPBFlash_DrawGlyphs_Params params; 84 PPBFlash_DrawGlyphs_Params params;
75 params.instance = instance, 85 params.image_data = image_data->host_resource();
76 params.pp_image_data = pp_image_data;
77 params.font_desc.SetFromPPFontDescription(dispatcher, *font_desc, true); 86 params.font_desc.SetFromPPFontDescription(dispatcher, *font_desc, true);
78 params.color = color; 87 params.color = color;
79 params.position = position; 88 params.position = position;
80 params.clip = clip; 89 params.clip = clip;
81 for (int i = 0; i < 3; i++) { 90 for (int i = 0; i < 3; i++) {
82 for (int j = 0; j < 3; j++) 91 for (int j = 0; j < 3; j++)
83 params.transformation[i][j] = transformation[i][j]; 92 params.transformation[i][j] = transformation[i][j];
84 } 93 }
85 94
86 params.glyph_indices.insert(params.glyph_indices.begin(), 95 params.glyph_indices.insert(params.glyph_indices.begin(),
(...skipping 211 matching lines...) Expand 10 before | Expand all | Expand 10 after
298 *result = PP_FALSE; 307 *result = PP_FALSE;
299 308
300 PP_FontDescription_Dev font_desc; 309 PP_FontDescription_Dev font_desc;
301 params.font_desc.SetToPPFontDescription(dispatcher(), &font_desc, false); 310 params.font_desc.SetToPPFontDescription(dispatcher(), &font_desc, false);
302 311
303 if (params.glyph_indices.size() != params.glyph_advances.size() || 312 if (params.glyph_indices.size() != params.glyph_advances.size() ||
304 params.glyph_indices.empty()) 313 params.glyph_indices.empty())
305 return; 314 return;
306 315
307 *result = ppb_flash_target()->DrawGlyphs( 316 *result = ppb_flash_target()->DrawGlyphs(
308 params.instance, params.pp_image_data, &font_desc, params.color, 317 0, // Unused instance param.
309 params.position, params.clip, 318 params.image_data.host_resource(), &font_desc,
319 params.color, params.position, params.clip,
310 const_cast<float(*)[3]>(params.transformation), 320 const_cast<float(*)[3]>(params.transformation),
311 static_cast<uint32_t>(params.glyph_indices.size()), 321 static_cast<uint32_t>(params.glyph_indices.size()),
312 const_cast<uint16_t*>(&params.glyph_indices[0]), 322 const_cast<uint16_t*>(&params.glyph_indices[0]),
313 const_cast<PP_Point*>(&params.glyph_advances[0])); 323 const_cast<PP_Point*>(&params.glyph_advances[0]));
314 } 324 }
315 325
316 void PPB_Flash_Proxy::OnMsgGetProxyForURL(PP_Instance instance, 326 void PPB_Flash_Proxy::OnMsgGetProxyForURL(PP_Instance instance,
317 const std::string& url, 327 const std::string& url,
318 SerializedVarReturnValue result) { 328 SerializedVarReturnValue result) {
319 result.Return(dispatcher(), ppb_flash_target()->GetProxyForURL( 329 result.Return(dispatcher(), ppb_flash_target()->GetProxyForURL(
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
390 void PPB_Flash_Proxy::OnMsgNavigateToURL(PP_Instance instance, 400 void PPB_Flash_Proxy::OnMsgNavigateToURL(PP_Instance instance,
391 const std::string& url, 401 const std::string& url,
392 const std::string& target, 402 const std::string& target,
393 PP_Bool* result) { 403 PP_Bool* result) {
394 *result = ppb_flash_target()->NavigateToURL(instance, url.c_str(), 404 *result = ppb_flash_target()->NavigateToURL(instance, url.c_str(),
395 target.c_str()); 405 target.c_str());
396 } 406 }
397 407
398 } // namespace proxy 408 } // namespace proxy
399 } // namespace pp 409 } // namespace pp
OLDNEW
« no previous file with comments | « ppapi/proxy/ppb_cursor_control_proxy.cc ('k') | ppapi/proxy/ppb_font_proxy.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698