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

Side by Side Diff: components/mus/gles2/ozone_gpu_memory_buffer.h

Issue 2119963002: Move mus to //services/ui (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 4 years, 5 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 | « components/mus/gles2/gpu_state.cc ('k') | components/mus/gles2/ozone_gpu_memory_buffer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2016 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 COMPONENTS_MUS_GLES2_OZONE_GPU_MEMORY_BUFFER_
6 #define COMPONENTS_MUS_GLES2_OZONE_GPU_MEMORY_BUFFER_
7
8 #include <memory>
9
10 #include "components/mus/common/gpu_memory_buffer_impl.h"
11 #include "ui/gfx/geometry/size.h"
12 #include "ui/gfx/gpu_memory_buffer.h"
13 #include "ui/gfx/native_widget_types.h"
14
15 namespace ui {
16 class ClientNativePixmap;
17 class NativePixmap;
18 } // namespace ui
19
20 namespace mus {
21
22 // A not-mojo GpuMemoryBuffer implementation solely for use internally to mus
23 // for scanout buffers. Note that OzoneGpuMemoryBuffer is for use on the client
24 // (aka CC thread).
25 class OzoneGpuMemoryBuffer : public mus::GpuMemoryBufferImpl {
26 public:
27 ~OzoneGpuMemoryBuffer() override;
28
29 // gfx::GpuMemoryBuffer implementation
30 bool Map() override;
31 void Unmap() override;
32 void* memory(size_t plane) override;
33 int stride(size_t plane) const override;
34 gfx::GpuMemoryBufferHandle GetHandle() const override;
35
36 // Returns the type of this GpuMemoryBufferImpl.
37 gfx::GpuMemoryBufferType GetBufferType() const override;
38 scoped_refptr<ui::NativePixmap> GetNativePixmap() override;
39
40 // Create a NativeBuffer. The implementation (mus-specific) will call directly
41 // into ozone to allocate the buffer. See the version in the .cc file.
42 static std::unique_ptr<gfx::GpuMemoryBuffer> CreateOzoneGpuMemoryBuffer(
43 const gfx::Size& size,
44 gfx::BufferFormat format,
45 gfx::BufferUsage usage,
46 gfx::AcceleratedWidget widget);
47
48 // Cribbed from content/common/gpu/client/gpu_memory_buffer_impl.h
49 static OzoneGpuMemoryBuffer* FromClientBuffer(ClientBuffer buffer);
50
51 private:
52 // TODO(rjkroege): It is conceivable that we do not need an |id| here. It
53 // would seem to be a legacy of content leaking into gfx. In a mojo context,
54 // perhaps it should be a mojo handle instead.
55 OzoneGpuMemoryBuffer(gfx::GpuMemoryBufferId id,
56 const gfx::Size& size,
57 gfx::BufferFormat format,
58 std::unique_ptr<ui::ClientNativePixmap> client_pixmap,
59 scoped_refptr<ui::NativePixmap> native_pixmap);
60
61 // The real backing buffer.
62 // From content/common/gpu/client/gpu_memory_buffer_impl_ozone_native_pixmap.h
63 std::unique_ptr<ui::ClientNativePixmap> client_pixmap_;
64 scoped_refptr<ui::NativePixmap> native_pixmap_;
65
66 DISALLOW_COPY_AND_ASSIGN(OzoneGpuMemoryBuffer);
67 };
68
69 } // namespace mus
70
71 #endif // COMPONENTS_MUS_GLES2_OZONE_GPU_MEMORY_BUFFER_
OLDNEW
« no previous file with comments | « components/mus/gles2/gpu_state.cc ('k') | components/mus/gles2/ozone_gpu_memory_buffer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698