| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 "content/browser/renderer_host/media/gpu_memory_buffer_tracker.h" | 5 #include "content/browser/renderer_host/media/gpu_memory_buffer_tracker.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" | 8 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" |
| 9 #include "content/browser/renderer_host/media/gpu_memory_buffer_handle.h" | 9 #include "content/browser/renderer_host/media/gpu_memory_buffer_handle.h" |
| 10 #include "content/public/browser/browser_thread.h" | 10 #include "content/public/browser/browser_thread.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE, | 51 gfx::BufferUsage::GPU_READ_CPU_READ_WRITE, |
| 52 gpu::kNullSurfaceHandle)); | 52 gpu::kNullSurfaceHandle)); |
| 53 | 53 |
| 54 DLOG_IF(ERROR, !gpu_memory_buffers_[i]) << "Allocating GpuMemoryBuffer"; | 54 DLOG_IF(ERROR, !gpu_memory_buffers_[i]) << "Allocating GpuMemoryBuffer"; |
| 55 if (!gpu_memory_buffers_[i] || !gpu_memory_buffers_[i]->Map()) | 55 if (!gpu_memory_buffers_[i] || !gpu_memory_buffers_[i]->Map()) |
| 56 return false; | 56 return false; |
| 57 } | 57 } |
| 58 return true; | 58 return true; |
| 59 } | 59 } |
| 60 | 60 |
| 61 std::unique_ptr<VideoCaptureBufferHandle> | 61 std::unique_ptr<media::VideoCaptureBufferHandle> |
| 62 GpuMemoryBufferTracker::GetBufferHandle() { | 62 GpuMemoryBufferTracker::GetBufferHandle() { |
| 63 DCHECK_EQ(gpu_memory_buffers_.size(), | 63 DCHECK_EQ(gpu_memory_buffers_.size(), |
| 64 media::VideoFrame::NumPlanes(pixel_format())); | 64 media::VideoFrame::NumPlanes(pixel_format())); |
| 65 return base::MakeUnique<GpuMemoryBufferBufferHandle>(this); | 65 return base::MakeUnique<GpuMemoryBufferBufferHandle>(this); |
| 66 } | 66 } |
| 67 | 67 |
| 68 bool GpuMemoryBufferTracker::ShareToProcess( | 68 bool GpuMemoryBufferTracker::ShareToProcess( |
| 69 base::ProcessHandle process_handle, | 69 base::ProcessHandle process_handle, |
| 70 base::SharedMemoryHandle* new_handle) { | 70 base::SharedMemoryHandle* new_handle) { |
| 71 NOTREACHED(); | 71 NOTREACHED(); |
| (...skipping 24 matching lines...) Expand all Loading... |
| 96 case gfx::IO_SURFACE_BUFFER: | 96 case gfx::IO_SURFACE_BUFFER: |
| 97 case gfx::OZONE_NATIVE_PIXMAP: | 97 case gfx::OZONE_NATIVE_PIXMAP: |
| 98 *new_handle = current_gmb_handle; | 98 *new_handle = current_gmb_handle; |
| 99 return true; | 99 return true; |
| 100 } | 100 } |
| 101 NOTREACHED(); | 101 NOTREACHED(); |
| 102 return true; | 102 return true; |
| 103 } | 103 } |
| 104 | 104 |
| 105 } // namespace content | 105 } // namespace content |
| OLD | NEW |