blob: b1f5f99482cce9dcabd79eeb294b3dfd5572f9ba [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"
reveman8aa0fb12015-10-13 13:47:3514#include "base/memory/shared_memory_handle.h"
revemanaa9e9d962015-10-22 16:43:0615#include "ui/gfx/generic_shared_memory_id.h"
[email protected]b63f1d62014-07-18 15:40:5916#include "ui/gl/gl_image_memory.h"
17
revemanaa9e9d962015-10-22 16:43:0618namespace base {
19class SharedMemory;
20}
21
tfarinadf856e022015-10-29 12:50:4522namespace gl {
[email protected]b63f1d62014-07-18 15:40:5923
24class GL_EXPORT GLImageSharedMemory : public GLImageMemory {
25 public:
tfarinadf856e022015-10-29 12:50:4526 GLImageSharedMemory(const gfx::Size& size, unsigned internalformat);
[email protected]b63f1d62014-07-18 15:40:5927
reveman8aa0fb12015-10-13 13:47:3528 bool Initialize(const base::SharedMemoryHandle& handle,
tfarinadf856e022015-10-29 12:50:4529 gfx::GenericSharedMemoryId shared_memory_id,
30 gfx::BufferFormat format,
reveman730fd9612015-11-11 01:22:4331 size_t offset,
32 size_t stride);
[email protected]b63f1d62014-07-18 15:40:5933
34 // Overridden from GLImage:
dcheng08038792014-10-21 10:53:2635 void Destroy(bool have_context) override;
ericrk28a82a0e2015-08-21 13:28:3636 void OnMemoryDump(base::trace_event::ProcessMemoryDump* pmd,
37 uint64_t process_tracing_id,
38 const std::string& dump_name) override;
[email protected]b63f1d62014-07-18 15:40:5939
40 protected:
dcheng08038792014-10-21 10:53:2641 ~GLImageSharedMemory() override;
[email protected]b63f1d62014-07-18 15:40:5942
43 private:
danakj25c52c32016-04-12 21:51:0844 std::unique_ptr<base::SharedMemory> shared_memory_;
tfarinadf856e022015-10-29 12:50:4545 gfx::GenericSharedMemoryId shared_memory_id_;
[email protected]b63f1d62014-07-18 15:40:5946
47 DISALLOW_COPY_AND_ASSIGN(GLImageSharedMemory);
48};
49
tfarinadf856e022015-10-29 12:50:4550} // namespace gl
[email protected]b63f1d62014-07-18 15:40:5951
52#endif // UI_GL_GL_IMAGE_SHARED_MEMORY_H_