Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Static Public Attributes | List of all members
flutter_runner::SoftwareSurfaceProducer Class Referencefinal

#include <software_surface_producer.h>

Inheritance diagram for flutter_runner::SoftwareSurfaceProducer:
flutter_runner::SurfaceProducer

Public Member Functions

 SoftwareSurfaceProducer ()
 
 ~SoftwareSurfaceProducer () override
 
bool IsValid () const
 
GrDirectContextgr_context () const override
 
std::unique_ptr< SurfaceProducerSurfaceProduceOffscreenSurface (const SkISize &size) override
 
std::unique_ptr< SurfaceProducerSurfaceProduceSurface (const SkISize &size) override
 
void SubmitSurfaces (std::vector< std::unique_ptr< SurfaceProducerSurface > > surfaces) override
 
- Public Member Functions inherited from flutter_runner::SurfaceProducer
virtual ~SurfaceProducer ()=default
 

Static Public Attributes

static constexpr int kMaxSurfaces = 12
 
static constexpr int kMaxSurfaceAge = 3
 

Detailed Description

Definition at line 19 of file software_surface_producer.h.

Constructor & Destructor Documentation

◆ SoftwareSurfaceProducer()

flutter_runner::SoftwareSurfaceProducer::SoftwareSurfaceProducer ( )
explicit

Definition at line 50 of file software_surface_producer.cc.

50 {
51 zx_status_t status = fdio_service_connect(
52 "/svc/fuchsia.sysmem.Allocator",
53 sysmem_allocator_.NewRequest().TakeChannel().release());
54 sysmem_allocator_->SetDebugClientInfo(GetCurrentProcessName(),
56 FML_DCHECK(status == ZX_OK);
57
58 status = fdio_service_connect(
59 "/svc/fuchsia.ui.composition.Allocator",
60 flatland_allocator_.NewRequest().TakeChannel().release());
61 FML_DCHECK(status == ZX_OK);
62
63 valid_ = true;
64}
#define FML_DCHECK(condition)
Definition logging.h:103
static zx_koid_t GetCurrentProcessId()
static std::string GetCurrentProcessName()

◆ ~SoftwareSurfaceProducer()

flutter_runner::SoftwareSurfaceProducer::~SoftwareSurfaceProducer ( )
overridedefault

Member Function Documentation

◆ gr_context()

GrDirectContext * flutter_runner::SoftwareSurfaceProducer::gr_context ( ) const
inlineoverridevirtual

Implements flutter_runner::SurfaceProducer.

Definition at line 32 of file software_surface_producer.h.

32{ return nullptr; }

◆ IsValid()

bool flutter_runner::SoftwareSurfaceProducer::IsValid ( ) const
inline

Definition at line 29 of file software_surface_producer.h.

29{ return valid_; }

◆ ProduceOffscreenSurface()

std::unique_ptr< SurfaceProducerSurface > flutter_runner::SoftwareSurfaceProducer::ProduceOffscreenSurface ( const SkISize size)
overridevirtual

Implements flutter_runner::SurfaceProducer.

Definition at line 69 of file software_surface_producer.cc.

69 {
70 FML_CHECK(valid_);
71
72 return CreateSurface(size);
73}
#define FML_CHECK(condition)
Definition logging.h:85

◆ ProduceSurface()

std::unique_ptr< SurfaceProducerSurface > flutter_runner::SoftwareSurfaceProducer::ProduceSurface ( const SkISize size)
overridevirtual

Implements flutter_runner::SurfaceProducer.

Definition at line 75 of file software_surface_producer.cc.

76 {
77 TRACE_EVENT2("flutter", "SoftwareSurfacePool::ProduceSurface", "width",
78 size.width(), "height", size.height());
79 FML_CHECK(valid_);
80
81 std::unique_ptr<SurfaceProducerSurface> surface;
82 auto exact_match_it =
83 std::find_if(available_surfaces_.begin(), available_surfaces_.end(),
84 [&size](const auto& surface) {
85 return surface->IsValid() && surface->GetSize() == size;
86 });
87 if (exact_match_it != available_surfaces_.end()) {
88 TRACE_EVENT_INSTANT0("flutter", "Exact match found");
89 surface = std::move(*exact_match_it);
90 available_surfaces_.erase(exact_match_it);
91 } else {
92 surface = CreateSurface(size);
93 }
94
95 if (surface == nullptr) {
96 FML_LOG(ERROR) << "Could not acquire surface.";
97 return nullptr;
98 }
99
100 if (!surface->FlushSessionAcquireAndReleaseEvents()) {
101 FML_LOG(ERROR) << "Could not flush acquire/release events for buffer.";
102 return nullptr;
103 }
104
105 return surface;
106}
VkSurfaceKHR surface
Definition main.cc:49
#define FML_LOG(severity)
Definition logging.h:82
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
#define ERROR(message)
#define TRACE_EVENT2(category_group, name, arg1_name, arg1_val, arg2_name, arg2_val)
#define TRACE_EVENT_INSTANT0(category_group, name)

◆ SubmitSurfaces()

void flutter_runner::SoftwareSurfaceProducer::SubmitSurfaces ( std::vector< std::unique_ptr< SurfaceProducerSurface > >  surfaces)
overridevirtual

Implements flutter_runner::SurfaceProducer.

Definition at line 108 of file software_surface_producer.cc.

109 {
110 TRACE_EVENT0("flutter", "SoftwareSurfaceProducer::SubmitSurfaces");
111
112 // Submit surface
113 for (auto& surface : surfaces) {
114 SubmitSurface(std::move(surface));
115 }
116
117 // Buffer management.
118 AgeAndCollectOldBuffers();
119}
#define TRACE_EVENT0(category_group, name)

Member Data Documentation

◆ kMaxSurfaceAge

constexpr int flutter_runner::SoftwareSurfaceProducer::kMaxSurfaceAge = 3
staticconstexpr

Definition at line 24 of file software_surface_producer.h.

◆ kMaxSurfaces

constexpr int flutter_runner::SoftwareSurfaceProducer::kMaxSurfaces = 12
staticconstexpr

Definition at line 22 of file software_surface_producer.h.


The documentation for this class was generated from the following files: