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

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

Issue 383543004: Pepper: Initialize PP_ImageDataDesc when creating ImageData. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Spelling. Created 6 years, 5 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 | « no previous file | no next file » | 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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_image_data_proxy.h" 5 #include "ppapi/proxy/ppb_image_data_proxy.h"
6 6
7 #include <string.h> // For memcpy 7 #include <string.h> // For memcpy
8 8
9 #include <map> 9 #include <map>
10 #include <vector> 10 #include <vector>
(...skipping 477 matching lines...) Expand 10 before | Expand all | Expand 10 after
488 ImageDataCache::GetInstance()->Get(instance, type, 488 ImageDataCache::GetInstance()->Get(instance, type,
489 size.width, size.height, format); 489 size.width, size.height, format);
490 if (cached_image_data.get()) { 490 if (cached_image_data.get()) {
491 // We have one we can re-use rather than allocating a new one. 491 // We have one we can re-use rather than allocating a new one.
492 cached_image_data->RecycleToPlugin(PP_ToBool(init_to_zero)); 492 cached_image_data->RecycleToPlugin(PP_ToBool(init_to_zero));
493 return cached_image_data->GetReference(); 493 return cached_image_data->GetReference();
494 } 494 }
495 495
496 HostResource result; 496 HostResource result;
497 PP_ImageDataDesc desc; 497 PP_ImageDataDesc desc;
498 // Don't send an uninitialized |desc| to the renderer.
499 // https://crbug.com/391023.
500 memset(&desc, 0, sizeof(desc));
dmichael (off chromium) 2014/07/09 23:11:16 I think it would be enough to say PP_ImageDataDesc
bbudge 2014/07/09 23:34:53 Better. I'll use the latter which is clearer (and
498 switch (type) { 501 switch (type) {
499 case PPB_ImageData_Shared::SIMPLE: { 502 case PPB_ImageData_Shared::SIMPLE: {
500 ppapi::proxy::SerializedHandle image_handle_wrapper; 503 ppapi::proxy::SerializedHandle image_handle_wrapper;
501 dispatcher->Send(new PpapiHostMsg_PPBImageData_CreateSimple( 504 dispatcher->Send(new PpapiHostMsg_PPBImageData_CreateSimple(
502 kApiID, instance, format, size, init_to_zero, 505 kApiID, instance, format, size, init_to_zero,
503 &result, &desc, &image_handle_wrapper)); 506 &result, &desc, &image_handle_wrapper));
504 if (image_handle_wrapper.is_shmem()) { 507 if (image_handle_wrapper.is_shmem()) {
505 base::SharedMemoryHandle image_handle = image_handle_wrapper.shmem(); 508 base::SharedMemoryHandle image_handle = image_handle_wrapper.shmem();
506 if (!result.is_null()) 509 if (!result.is_null())
507 return 510 return
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 // still cached in our process, the proxy still holds a reference so we can 684 // still cached in our process, the proxy still holds a reference so we can
682 // remove the one the renderer just sent is. If the proxy no longer holds a 685 // remove the one the renderer just sent is. If the proxy no longer holds a
683 // reference, we released everything and we should also release the one the 686 // reference, we released everything and we should also release the one the
684 // renderer just sent us. 687 // renderer just sent us.
685 dispatcher()->Send(new PpapiHostMsg_PPBCore_ReleaseResource( 688 dispatcher()->Send(new PpapiHostMsg_PPBCore_ReleaseResource(
686 API_ID_PPB_CORE, old_image_data)); 689 API_ID_PPB_CORE, old_image_data));
687 } 690 }
688 691
689 } // namespace proxy 692 } // namespace proxy
690 } // namespace ppapi 693 } // namespace ppapi
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698