Flutter Engine
The Flutter Engine
surface_producer.h
Go to the documentation of this file.
1// Copyright 2013 The Flutter 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 FLUTTER_SHELL_PLATFORM_FUCHSIA_FLUTTER_SURFACE_PRODUCER_H_
6#define FLUTTER_SHELL_PLATFORM_FUCHSIA_FLUTTER_SURFACE_PRODUCER_H_
7
8#include <fuchsia/ui/composition/cpp/fidl.h>
9#include <lib/zx/event.h>
10
11#include <functional>
12#include <memory>
13#include <vector>
14
18
19namespace flutter_runner {
20
22
23// This represents an abstract notion of a "rendering surface", which is a
24// destination for pixels drawn by some rendering engine. In this case, the
25// rendering engine is Skia combined with one of its rendering backends.
26//
27// In addition to allowing Skia-based drawing via `GetSkiaSurface`, this
28// rendering surface can be shared with Scenic via `SetImageId`,
29// `GetBufferCollectionImportToken`, `GetAcquireFene`, and `GetReleaseFence`.
31 public:
32 virtual ~SurfaceProducerSurface() = default;
33
34 virtual bool IsValid() const = 0;
35
36 virtual SkISize GetSize() const = 0;
37
38 virtual void SetImageId(uint32_t image_id) = 0;
39
40 virtual uint32_t GetImageId() = 0;
41
42 virtual sk_sp<SkSurface> GetSkiaSurface() const = 0;
43
44 virtual fuchsia::ui::composition::BufferCollectionImportToken
46
48
50
52 ReleaseImageCallback release_image_callback) = 0;
53
54 virtual size_t AdvanceAndGetAge() = 0;
55
57
59 const std::function<void(void)>& on_writes_committed) = 0;
60};
61
62// This represents an abstract notion of "surface producer", which serves as a
63// source for `SurfaceProducerSurface`s. Produces surfaces should be returned
64// to this `SurfaceProducer` via `SubmitSurfaces`, at which point they will be
65// shared with Scenic.
67 public:
68 virtual ~SurfaceProducer() = default;
69
70 virtual GrDirectContext* gr_context() const = 0;
71
72 virtual std::unique_ptr<SurfaceProducerSurface> ProduceOffscreenSurface(
73 const SkISize& size) = 0;
74 virtual std::unique_ptr<SurfaceProducerSurface> ProduceSurface(
75 const SkISize& size) = 0;
76
77 virtual void SubmitSurfaces(
78 std::vector<std::unique_ptr<SurfaceProducerSurface>> surfaces) = 0;
79};
80
81} // namespace flutter_runner
82
83#endif // FLUTTER_SHELL_PLATFORM_FUCHSIA_FLUTTER_SURFACE_PRODUCER_H_
virtual fuchsia::ui::composition::BufferCollectionImportToken GetBufferCollectionImportToken()=0
virtual sk_sp< SkSurface > GetSkiaSurface() const =0
virtual zx::event GetReleaseFence()=0
virtual zx::event GetAcquireFence()=0
virtual SkISize GetSize() const =0
virtual void SignalWritesFinished(const std::function< void(void)> &on_writes_committed)=0
virtual void SetImageId(uint32_t image_id)=0
virtual bool FlushSessionAcquireAndReleaseEvents()=0
virtual void SetReleaseImageCallback(ReleaseImageCallback release_image_callback)=0
virtual ~SurfaceProducer()=default
virtual void SubmitSurfaces(std::vector< std::unique_ptr< SurfaceProducerSurface > > surfaces)=0
virtual GrDirectContext * gr_context() const =0
virtual std::unique_ptr< SurfaceProducerSurface > ProduceSurface(const SkISize &size)=0
virtual std::unique_ptr< SurfaceProducerSurface > ProduceOffscreenSurface(const SkISize &size)=0
FlKeyEvent * event
Dart_NativeFunction function
Definition: fuchsia.cc:51
std::function< void()> ReleaseImageCallback
it will be possible to load the file into Perfetto s trace viewer disable asset Prevents usage of any non test fonts unless they were explicitly Loaded via prefetched default font Indicates whether the embedding started a prefetch of the default font manager before creating the engine run In non interactive keep the shell running after the Dart script has completed enable serial On low power devices with low core running concurrent GC tasks on threads can cause them to contend with the UI thread which could potentially lead to jank This option turns off all concurrent GC activities domain network JSON encoded network policy per domain This overrides the DisallowInsecureConnections switch Embedder can specify whether to allow or disallow insecure connections at a domain level old gen heap size
Definition: switches.h:259
Definition: SkSize.h:16