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

Side by Side Diff: content/common/gpu/media/shared_memory_region.h

Issue 1541353002: Add offset support to BitstreamBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Handle the offset with a helper class Created 4 years, 11 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 (c) 2015 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 #ifndef CONTENT_COMMON_GPU_MEDIA_SHARED_MEMORY_REGION_H_
6 #define CONTENT_COMMON_GPU_MEDIA_SHARED_MEMORY_REGION_H_
7
8 #include "base/memory/shared_memory.h"
9 #include "media/base/bitstream_buffer.h"
10
11 namespace content {
12
13 // Helper class to access a region of a SharedMemory.
14 class SharedMemoryRegion {
15 public:
16 SharedMemoryRegion(const base::SharedMemoryHandle& handle,
Pawel Osciak 2015/12/31 02:05:54 We should document arguments, especially offset an
Owen Lin 2016/01/04 08:54:17 Done.
17 off_t offset,
18 size_t size,
19 bool read_only);
20
21 SharedMemoryRegion(const media::BitstreamBuffer& bitstream_buffer,
22 bool read_only);
23
24 // Maps the shared memory into the caller's address space.
25 // Return true on success, false otherwise.
26 bool Map();
27
28 // Gets a pointer to the mapped region if it has been mapped via Map().
29 // Returns |nullptr| if it is not mapped.
30 void* memory();
Pawel Osciak 2015/12/31 02:05:54 We should document how this relates to offset and
Owen Lin 2016/01/04 08:54:17 Done.
31
32 size_t size() const { return size_; }
33
34 off_t offset() const { return offset_; }
Pawel Osciak 2015/12/31 02:05:53 Is this used anywhere?
Owen Lin 2016/01/04 08:54:17 No, let me remove it.
35
36 private:
37 base::SharedMemory shm_;
38 off_t offset_;
39 size_t size_;
40
41 DISALLOW_COPY_AND_ASSIGN(SharedMemoryRegion);
42 };
43
44 } // namespace content
45
46 #endif // CONTENT_COMMON_GPU_MEDIA_SHARED_MEMORY_REGION_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698