[email protected] | b63f1d6 | 2014-07-18 15:40:59 | [diff] [blame] | 1 | // Copyright 2014 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 UI_GL_GL_IMAGE_SHARED_MEMORY_H_ | ||||
6 | #define UI_GL_GL_IMAGE_SHARED_MEMORY_H_ | ||||
7 | |||||
avi | 739878c | 2015-12-24 18:06:17 | [diff] [blame] | 8 | #include <stddef.h> |
9 | #include <stdint.h> | ||||
10 | |||||
danakj | 25c52c3 | 2016-04-12 21:51:08 | [diff] [blame] | 11 | #include <memory> |
12 | |||||
avi | 739878c | 2015-12-24 18:06:17 | [diff] [blame] | 13 | #include "base/macros.h" |
Alexandr Ilin | 81c4128e | 2018-10-18 08:30:34 | [diff] [blame] | 14 | #include "base/memory/unsafe_shared_memory_region.h" |
reveman | aa9e9d96 | 2015-10-22 16:43:06 | [diff] [blame] | 15 | #include "ui/gfx/generic_shared_memory_id.h" |
kylechar | 5b9dec1 | 2016-05-16 15:40:57 | [diff] [blame] | 16 | #include "ui/gl/gl_export.h" |
[email protected] | b63f1d6 | 2014-07-18 15:40:59 | [diff] [blame] | 17 | #include "ui/gl/gl_image_memory.h" |
18 | |||||
tfarina | df856e02 | 2015-10-29 12:50:45 | [diff] [blame] | 19 | namespace gl { |
[email protected] | b63f1d6 | 2014-07-18 15:40:59 | [diff] [blame] | 20 | |
21 | class GL_EXPORT GLImageSharedMemory : public GLImageMemory { | ||||
22 | public: | ||||
Antoine Labour | 6ffacb3f | 2018-10-31 01:55:28 | [diff] [blame] | 23 | explicit GLImageSharedMemory(const gfx::Size& size); |
[email protected] | b63f1d6 | 2014-07-18 15:40:59 | [diff] [blame] | 24 | |
Alexandr Ilin | 81c4128e | 2018-10-18 08:30:34 | [diff] [blame] | 25 | bool Initialize(const base::UnsafeSharedMemoryRegion& shared_memory_region, |
tfarina | df856e02 | 2015-10-29 12:50:45 | [diff] [blame] | 26 | gfx::GenericSharedMemoryId shared_memory_id, |
27 | gfx::BufferFormat format, | ||||
reveman | 730fd961 | 2015-11-11 01:22:43 | [diff] [blame] | 28 | size_t offset, |
29 | size_t stride); | ||||
[email protected] | b63f1d6 | 2014-07-18 15:40:59 | [diff] [blame] | 30 | |
31 | // Overridden from GLImage: | ||||
ericrk | 28a82a0e | 2015-08-21 13:28:36 | [diff] [blame] | 32 | void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd, |
33 | uint64_t process_tracing_id, | ||||
34 | const std::string& dump_name) override; | ||||
[email protected] | b63f1d6 | 2014-07-18 15:40:59 | [diff] [blame] | 35 | |
36 | protected: | ||||
dcheng | 0803879 | 2014-10-21 10:53:26 | [diff] [blame] | 37 | ~GLImageSharedMemory() override; |
[email protected] | b63f1d6 | 2014-07-18 15:40:59 | [diff] [blame] | 38 | |
39 | private: | ||||
Alexandr Ilin | 81c4128e | 2018-10-18 08:30:34 | [diff] [blame] | 40 | base::WritableSharedMemoryMapping shared_memory_mapping_; |
tfarina | df856e02 | 2015-10-29 12:50:45 | [diff] [blame] | 41 | gfx::GenericSharedMemoryId shared_memory_id_; |
[email protected] | b63f1d6 | 2014-07-18 15:40:59 | [diff] [blame] | 42 | |
43 | DISALLOW_COPY_AND_ASSIGN(GLImageSharedMemory); | ||||
44 | }; | ||||
45 | |||||
tfarina | df856e02 | 2015-10-29 12:50:45 | [diff] [blame] | 46 | } // namespace gl |
[email protected] | b63f1d6 | 2014-07-18 15:40:59 | [diff] [blame] | 47 | |
48 | #endif // UI_GL_GL_IMAGE_SHARED_MEMORY_H_ |