blob: bc64241853434245af0c9729805d8b6bce6ee73e [file] [log] [blame]
[email protected]b63f1d62014-07-18 15:40:591// 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
avi739878c2015-12-24 18:06:178#include <stddef.h>
9#include <stdint.h>
10
danakj25c52c32016-04-12 21:51:0811#include <memory>
12
avi739878c2015-12-24 18:06:1713#include "base/macros.h"
Alexandr Ilin81c4128e2018-10-18 08:30:3414#include "base/memory/unsafe_shared_memory_region.h"
revemanaa9e9d962015-10-22 16:43:0615#include "ui/gfx/generic_shared_memory_id.h"
kylechar5b9dec12016-05-16 15:40:5716#include "ui/gl/gl_export.h"
[email protected]b63f1d62014-07-18 15:40:5917#include "ui/gl/gl_image_memory.h"
18
tfarinadf856e022015-10-29 12:50:4519namespace gl {
[email protected]b63f1d62014-07-18 15:40:5920
21class GL_EXPORT GLImageSharedMemory : public GLImageMemory {
22 public:
Antoine Labour6ffacb3f2018-10-31 01:55:2823 explicit GLImageSharedMemory(const gfx::Size& size);
[email protected]b63f1d62014-07-18 15:40:5924
Alexandr Ilin81c4128e2018-10-18 08:30:3425 bool Initialize(const base::UnsafeSharedMemoryRegion& shared_memory_region,
tfarinadf856e022015-10-29 12:50:4526 gfx::GenericSharedMemoryId shared_memory_id,
27 gfx::BufferFormat format,
reveman730fd9612015-11-11 01:22:4328 size_t offset,
29 size_t stride);
[email protected]b63f1d62014-07-18 15:40:5930
31 // Overridden from GLImage:
ericrk28a82a0e2015-08-21 13:28:3632 void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
33 uint64_t process_tracing_id,
34 const std::string& dump_name) override;
[email protected]b63f1d62014-07-18 15:40:5935
36 protected:
dcheng08038792014-10-21 10:53:2637 ~GLImageSharedMemory() override;
[email protected]b63f1d62014-07-18 15:40:5938
39 private:
Alexandr Ilin81c4128e2018-10-18 08:30:3440 base::WritableSharedMemoryMapping shared_memory_mapping_;
tfarinadf856e022015-10-29 12:50:4541 gfx::GenericSharedMemoryId shared_memory_id_;
[email protected]b63f1d62014-07-18 15:40:5942
43 DISALLOW_COPY_AND_ASSIGN(GLImageSharedMemory);
44};
45
tfarinadf856e022015-10-29 12:50:4546} // namespace gl
[email protected]b63f1d62014-07-18 15:40:5947
48#endif // UI_GL_GL_IMAGE_SHARED_MEMORY_H_