| Index: content/common/gpu/media/vaapi_video_encode_accelerator.cc | 
| diff --git a/content/common/gpu/media/vaapi_video_encode_accelerator.cc b/content/common/gpu/media/vaapi_video_encode_accelerator.cc | 
| index 049cd7a5547ef7c062bed0eb898b3f6187dee502..4e2a06e75f1eb3607886703ed4b0ffcaf2037de0 100644 | 
| --- a/content/common/gpu/media/vaapi_video_encode_accelerator.cc | 
| +++ b/content/common/gpu/media/vaapi_video_encode_accelerator.cc | 
| @@ -13,6 +13,7 @@ | 
| #include "base/metrics/histogram.h" | 
| #include "base/numerics/safe_conversions.h" | 
| #include "content/common/gpu/media/h264_dpb.h" | 
| +#include "content/common/gpu/media/shared_memory_region.h" | 
| #include "media/base/bind_to_current_loop.h" | 
| #include "third_party/libva/va/va_enc_h264.h" | 
|  | 
| @@ -100,13 +101,10 @@ struct VaapiVideoEncodeAccelerator::InputFrameRef { | 
| }; | 
|  | 
| struct VaapiVideoEncodeAccelerator::BitstreamBufferRef { | 
| -  BitstreamBufferRef(int32_t id, | 
| -                     scoped_ptr<base::SharedMemory> shm, | 
| -                     size_t size) | 
| -      : id(id), shm(std::move(shm)), size(size) {} | 
| +  BitstreamBufferRef(int32_t id, scoped_ptr<SharedMemoryRegion> shm) | 
| +      : id(id), shm(std::move(shm)) {} | 
| const int32_t id; | 
| -  const scoped_ptr<base::SharedMemory> shm; | 
| -  const size_t size; | 
| +  const scoped_ptr<SharedMemoryRegion> shm; | 
| }; | 
|  | 
| media::VideoEncodeAccelerator::SupportedProfiles | 
| @@ -546,11 +544,8 @@ void VaapiVideoEncodeAccelerator::TryToReturnBitstreamBuffer() { | 
|  | 
| size_t data_size = 0; | 
| if (!vaapi_wrapper_->DownloadAndDestroyCodedBuffer( | 
| -          encode_job->coded_buffer, | 
| -          encode_job->input_surface->id(), | 
| -          target_data, | 
| -          buffer->size, | 
| -          &data_size)) { | 
| +          encode_job->coded_buffer, encode_job->input_surface->id(), | 
| +          target_data, buffer->shm->size(), &data_size)) { | 
| NOTIFY_ERROR(kPlatformFailureError, "Failed downloading coded buffer"); | 
| return; | 
| } | 
| @@ -669,15 +664,14 @@ void VaapiVideoEncodeAccelerator::UseOutputBitstreamBuffer( | 
| return; | 
| } | 
|  | 
| -  scoped_ptr<base::SharedMemory> shm( | 
| -      new base::SharedMemory(buffer.handle(), false)); | 
| -  if (!shm->Map(buffer.size())) { | 
| +  scoped_ptr<SharedMemoryRegion> shm(new SharedMemoryRegion(buffer, false)); | 
| +  if (!shm->Map()) { | 
| NOTIFY_ERROR(kPlatformFailureError, "Failed mapping shared memory."); | 
| return; | 
| } | 
|  | 
| scoped_ptr<BitstreamBufferRef> buffer_ref( | 
| -      new BitstreamBufferRef(buffer.id(), std::move(shm), buffer.size())); | 
| +      new BitstreamBufferRef(buffer.id(), std::move(shm))); | 
|  | 
| encoder_thread_task_runner_->PostTask( | 
| FROM_HERE, | 
|  |