diff options
author | epenner@chromium.org <epenner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-26 04:53:58 +0000 |
---|---|---|
committer | epenner@chromium.org <epenner@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2014-03-26 04:53:58 +0000 |
commit | 4409660ad725b24a71a831bb41eaa5d04a663ab8 (patch) | |
tree | 4e45a5eb55f8ef0cd2b4852e0985c0bcd88d1de4 /content/renderer/pepper | |
parent | 1ab297a6ed94629078106d7ba4f34f8a35efdc29 (diff) | |
download | chromium_src-4409660ad725b24a71a831bb41eaa5d04a663ab8.zip chromium_src-4409660ad725b24a71a831bb41eaa5d04a663ab8.tar.gz chromium_src-4409660ad725b24a71a831bb41eaa5d04a663ab8.tar.bz2 |
GPU: Reference count gpu::Buffer.
We tend to duplicate shared memory within the same process
when we don't need to, causing extra page faults etc when
accessing the memory.
With reference counting we can more easily re-use blocks of
shared memory in the same process, and make security easier
(objects in shared memory can hold a reference to their
memory and prevent use-after-free).
BUG=177063, 353822
Review URL: https://codereview.chromium.org/209353002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@259491 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'content/renderer/pepper')
-rw-r--r-- | content/renderer/pepper/ppb_graphics_3d_impl.cc | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/content/renderer/pepper/ppb_graphics_3d_impl.cc b/content/renderer/pepper/ppb_graphics_3d_impl.cc index c0c02d0..18a8e90 100644 --- a/content/renderer/pepper/ppb_graphics_3d_impl.cc +++ b/content/renderer/pepper/ppb_graphics_3d_impl.cc @@ -127,8 +127,9 @@ PP_Bool PPB_Graphics3D_Impl::DestroyTransferBuffer(int32_t id) { PP_Bool PPB_Graphics3D_Impl::GetTransferBuffer(int32_t id, int* shm_handle, uint32_t* shm_size) { - gpu::Buffer buffer = GetCommandBuffer()->GetTransferBuffer(id); - return ShmToHandle(buffer.shared_memory, buffer.size, shm_handle, shm_size); + scoped_refptr<gpu::Buffer> buffer = GetCommandBuffer()->GetTransferBuffer(id); + return ShmToHandle( + buffer->shared_memory(), buffer->size(), shm_handle, shm_size); } PP_Bool PPB_Graphics3D_Impl::Flush(int32_t put_offset) { |