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

Side by Side Diff: content/browser/renderer_host/media/video_capture_buffer_pool.cc

Issue 1269503007: Unify graphics buffer format & usage enums for GpuMemoryBuffer & SurfaceFactoryOzone (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add header to BUILD.gn Created 5 years, 4 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
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/video_capture_buffer_pool.h" 5 #include "content/browser/renderer_host/media/video_capture_buffer_pool.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h" 10 #include "content/browser/gpu/browser_gpu_memory_buffer_manager.h"
(...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after
174 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO)); 174 DCHECK(!BrowserThread::CurrentlyOn(BrowserThread::IO));
175 DCHECK(BrowserGpuMemoryBufferManager::current()); 175 DCHECK(BrowserGpuMemoryBufferManager::current());
176 set_pixel_format(format); 176 set_pixel_format(format);
177 set_storage_type(storage_type); 177 set_storage_type(storage_type);
178 set_pixel_count(dimensions.GetArea()); 178 set_pixel_count(dimensions.GetArea());
179 // |dimensions| can be 0x0 for trackers that do not require memory backing. 179 // |dimensions| can be 0x0 for trackers that do not require memory backing.
180 if (dimensions.GetArea() == 0u) 180 if (dimensions.GetArea() == 0u)
181 return true; 181 return true;
182 gpu_memory_buffer_ = 182 gpu_memory_buffer_ =
183 BrowserGpuMemoryBufferManager::current()->AllocateGpuMemoryBuffer( 183 BrowserGpuMemoryBufferManager::current()->AllocateGpuMemoryBuffer(
184 dimensions, 184 dimensions, gfx::BufferFormat::BGRA_8888, gfx::BufferUsage::MAP);
185 gfx::GpuMemoryBuffer::BGRA_8888,
186 gfx::GpuMemoryBuffer::MAP);
187 DLOG_IF(ERROR, !gpu_memory_buffer_.get()) << "Allocating GpuMemoryBuffer"; 185 DLOG_IF(ERROR, !gpu_memory_buffer_.get()) << "Allocating GpuMemoryBuffer";
188 if (!gpu_memory_buffer_.get()) 186 if (!gpu_memory_buffer_.get())
189 return false; 187 return false;
190 int plane_sizes; 188 int plane_sizes;
191 gpu_memory_buffer_->GetStride(&plane_sizes); 189 gpu_memory_buffer_->GetStride(&plane_sizes);
192 packed_size_ = plane_sizes * dimensions.height(); 190 packed_size_ = plane_sizes * dimensions.height();
193 return true; 191 return true;
194 } 192 }
195 193
196 // static 194 // static
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
371 return buffer_id; 369 return buffer_id;
372 } 370 }
373 371
374 VideoCaptureBufferPool::Tracker* VideoCaptureBufferPool::GetTracker( 372 VideoCaptureBufferPool::Tracker* VideoCaptureBufferPool::GetTracker(
375 int buffer_id) { 373 int buffer_id) {
376 TrackerMap::const_iterator it = trackers_.find(buffer_id); 374 TrackerMap::const_iterator it = trackers_.find(buffer_id);
377 return (it == trackers_.end()) ? NULL : it->second; 375 return (it == trackers_.end()) ? NULL : it->second;
378 } 376 }
379 377
380 } // namespace content 378 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/gpu/gpu_process_host.cc ('k') | content/browser/renderer_host/media/video_capture_buffer_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698