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

Side by Side Diff: media/gpu/shared_memory_region.cc

Issue 2061823003: media: Drop "media::" in media/gpu (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: work around clang format by adding an empty line Created 4 years, 6 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
« no previous file with comments | « media/gpu/shared_memory_region.h ('k') | media/gpu/v4l2_device.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 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 "base/sys_info.h" 5 #include "base/sys_info.h"
6 #include "media/gpu/shared_memory_region.h" 6 #include "media/gpu/shared_memory_region.h"
7 7
8 namespace media { 8 namespace media {
9 9
10 SharedMemoryRegion::SharedMemoryRegion(const base::SharedMemoryHandle& handle, 10 SharedMemoryRegion::SharedMemoryRegion(const base::SharedMemoryHandle& handle,
11 off_t offset, 11 off_t offset,
12 size_t size, 12 size_t size,
13 bool read_only) 13 bool read_only)
14 : shm_(handle, read_only), 14 : shm_(handle, read_only),
15 offset_(offset), 15 offset_(offset),
16 size_(size), 16 size_(size),
17 alignment_size_(offset % base::SysInfo::VMAllocationGranularity()) { 17 alignment_size_(offset % base::SysInfo::VMAllocationGranularity()) {
18 DCHECK_GE(offset_, 0) << "Invalid offset: " << offset_; 18 DCHECK_GE(offset_, 0) << "Invalid offset: " << offset_;
19 } 19 }
20 20
21 SharedMemoryRegion::SharedMemoryRegion( 21 SharedMemoryRegion::SharedMemoryRegion(const BitstreamBuffer& bitstream_buffer,
22 const media::BitstreamBuffer& bitstream_buffer, 22 bool read_only)
23 bool read_only)
24 : SharedMemoryRegion(bitstream_buffer.handle(), 23 : SharedMemoryRegion(bitstream_buffer.handle(),
25 bitstream_buffer.offset(), 24 bitstream_buffer.offset(),
26 bitstream_buffer.size(), 25 bitstream_buffer.size(),
27 read_only) {} 26 read_only) {}
28 27
29 bool SharedMemoryRegion::Map() { 28 bool SharedMemoryRegion::Map() {
30 if (offset_ < 0) { 29 if (offset_ < 0) {
31 DVLOG(1) << "Invalid offset: " << offset_; 30 DVLOG(1) << "Invalid offset: " << offset_;
32 return false; 31 return false;
33 } 32 }
34 return shm_.MapAt(offset_ - alignment_size_, size_ + alignment_size_); 33 return shm_.MapAt(offset_ - alignment_size_, size_ + alignment_size_);
35 } 34 }
36 35
37 void* SharedMemoryRegion::memory() { 36 void* SharedMemoryRegion::memory() {
38 int8_t* addr = reinterpret_cast<int8_t*>(shm_.memory()); 37 int8_t* addr = reinterpret_cast<int8_t*>(shm_.memory());
39 return addr ? addr + alignment_size_ : nullptr; 38 return addr ? addr + alignment_size_ : nullptr;
40 } 39 }
41 40
42 } // namespace media 41 } // namespace media
OLDNEW
« no previous file with comments | « media/gpu/shared_memory_region.h ('k') | media/gpu/v4l2_device.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698