// Copyright 2019 The Chromium Authors // Use of this source code is governed by a BSD-style license that can be // found in the LICENSE file. #ifndef UI_OZONE_PLATFORM_WAYLAND_GPU_WAYLAND_CANVAS_SURFACE_H_ #define UI_OZONE_PLATFORM_WAYLAND_GPU_WAYLAND_CANVAS_SURFACE_H_ #include <memory> #include <vector> #include "base/memory/raw_ptr.h" #include "base/memory/weak_ptr.h" #include "base/time/time.h" #include "third_party/skia/include/core/SkRefCnt.h" #include "third_party/skia/include/core/SkSurface.h" #include "ui/gfx/geometry/size.h" #include "ui/gfx/native_widget_types.h" #include "ui/gfx/vsync_provider.h" #include "ui/ozone/platform/wayland/gpu/wayland_surface_gpu.h" #include "ui/ozone/public/surface_ozone_canvas.h" class SkCanvas; namespace ui { class WaylandBufferManagerGpu; // WaylandCanvasSurface creates an SkCanvas whose contents is backed by a shared // memory region. The shared memory region is registered with the Wayland server // as a wl_buffer. // // Basic control flow: // 1. WaylandCanvasSurface creates an anonymous shared memory region. // 2. WaylandCanvasSurface creates an SkCanvas that rasters directly into // this shared memory region. // 3. WaylandCanvasSurface registers the shared memory region with the // WaylandServer via IPC through WaylandBufferManagerGpu and // WaylandBufferManagerHost. See // WaylandBufferManagerHost::CreateShmBasedBuffer. This creates a wl_buffer // object in the browser process. // 4. WaylandCanvasSurface::CommitBuffer simply routes via IPC through the // browser process to the Wayland server. It is not safe to modify the shared // memory region in (1) until OnSubmission/OnPresentation callbacks are // received. class WaylandCanvasSurface : public SurfaceOzoneCanvas, public WaylandSurfaceGpu { … }; } // namespace ui #endif // UI_OZONE_PLATFORM_WAYLAND_GPU_WAYLAND_CANVAS_SURFACE_H_