OLD | NEW |
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 <memory> | 7 #include <memory> |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 232 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 VideoCaptureBufferPool::Tracker::~Tracker() {} | 243 VideoCaptureBufferPool::Tracker::~Tracker() {} |
244 | 244 |
245 VideoCaptureBufferPool::VideoCaptureBufferPool(int count) | 245 VideoCaptureBufferPool::VideoCaptureBufferPool(int count) |
246 : count_(count), | 246 : count_(count), |
247 next_buffer_id_(0), | 247 next_buffer_id_(0), |
248 last_relinquished_buffer_id_(kInvalidId) { | 248 last_relinquished_buffer_id_(kInvalidId) { |
249 DCHECK_GT(count, 0); | 249 DCHECK_GT(count, 0); |
250 } | 250 } |
251 | 251 |
252 VideoCaptureBufferPool::~VideoCaptureBufferPool() { | 252 VideoCaptureBufferPool::~VideoCaptureBufferPool() { |
253 STLDeleteValues(&trackers_); | 253 base::STLDeleteValues(&trackers_); |
254 } | 254 } |
255 | 255 |
256 bool VideoCaptureBufferPool::ShareToProcess( | 256 bool VideoCaptureBufferPool::ShareToProcess( |
257 int buffer_id, | 257 int buffer_id, |
258 base::ProcessHandle process_handle, | 258 base::ProcessHandle process_handle, |
259 base::SharedMemoryHandle* new_handle) { | 259 base::SharedMemoryHandle* new_handle) { |
260 base::AutoLock lock(lock_); | 260 base::AutoLock lock(lock_); |
261 | 261 |
262 Tracker* tracker = GetTracker(buffer_id); | 262 Tracker* tracker = GetTracker(buffer_id); |
263 if (!tracker) { | 263 if (!tracker) { |
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
474 return buffer_id; | 474 return buffer_id; |
475 } | 475 } |
476 | 476 |
477 VideoCaptureBufferPool::Tracker* VideoCaptureBufferPool::GetTracker( | 477 VideoCaptureBufferPool::Tracker* VideoCaptureBufferPool::GetTracker( |
478 int buffer_id) { | 478 int buffer_id) { |
479 TrackerMap::const_iterator it = trackers_.find(buffer_id); | 479 TrackerMap::const_iterator it = trackers_.find(buffer_id); |
480 return (it == trackers_.end()) ? NULL : it->second; | 480 return (it == trackers_.end()) ? NULL : it->second; |
481 } | 481 } |
482 | 482 |
483 } // namespace content | 483 } // namespace content |
OLD | NEW |