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

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

Issue 2343423003: Extract nested and private classes from VideoCaptureBufferPool (Closed)
Patch Set: Merge branch 'master' into BufferPoolRefactor Created 4 years, 2 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "content/browser/renderer_host/media/shared_memory_buffer_tracker.h"
6
7 #include "base/memory/ptr_util.h"
8 #include "content/browser/renderer_host/media/shared_memory_buffer_handle.h"
9
10 namespace content {
11
12 SharedMemoryBufferTracker::SharedMemoryBufferTracker()
13 : VideoCaptureBufferTracker() {}
14
15 bool SharedMemoryBufferTracker::Init(const gfx::Size& dimensions,
16 media::VideoPixelFormat format,
17 media::VideoPixelStorage storage_type,
18 base::Lock* lock) {
19 DVLOG(2) << "allocating ShMem of " << dimensions.ToString();
20 set_dimensions(dimensions);
21 // |dimensions| can be 0x0 for trackers that do not require memory backing.
22 set_max_pixel_count(dimensions.GetArea());
23 set_pixel_format(format);
24 set_storage_type(storage_type);
25 mapped_size_ =
26 media::VideoCaptureFormat(dimensions, 0.0f, format, storage_type)
27 .ImageAllocationSize();
28 if (!mapped_size_)
29 return true;
30 return shared_memory_.CreateAndMapAnonymous(mapped_size_);
31 }
32
33 std::unique_ptr<VideoCaptureBufferHandle>
34 SharedMemoryBufferTracker::GetBufferHandle() {
35 return base::MakeUnique<SharedMemoryBufferHandle>(this);
36 }
37
38 bool SharedMemoryBufferTracker::ShareToProcess(
39 base::ProcessHandle process_handle,
40 base::SharedMemoryHandle* new_handle) {
41 return shared_memory_.ShareToProcess(process_handle, new_handle);
42 }
43
44 bool SharedMemoryBufferTracker::ShareToProcess2(
45 int plane,
46 base::ProcessHandle process_handle,
47 gfx::GpuMemoryBufferHandle* new_handle) {
48 NOTREACHED();
49 return false;
50 }
51
52 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698