Flutter Engine
 
Loading...
Searching...
No Matches
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
 
GrDirectContext * gr_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.sysmem2.Allocator",
53 sysmem_allocator_.NewRequest().TakeChannel().release());
54 sysmem_allocator_->SetDebugClientInfo(
55 std::move(fuchsia::sysmem2::AllocatorSetDebugClientInfoRequest{}
56 .set_name(GetCurrentProcessName())
57 .set_id(GetCurrentProcessId())));
58 FML_DCHECK(status == ZX_OK);
59
60 status = fdio_service_connect(
61 "/svc/fuchsia.ui.composition.Allocator",
62 flatland_allocator_.NewRequest().TakeChannel().release());
63 FML_DCHECK(status == ZX_OK);
64
65 valid_ = true;
66}
#define FML_DCHECK(condition)
Definition logging.h:122
static zx_koid_t GetCurrentProcessId()
static std::string GetCurrentProcessName()

References FML_DCHECK, flutter_runner::GetCurrentProcessId(), and flutter_runner::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 71 of file software_surface_producer.cc.

71 {
72 FML_CHECK(valid_);
73
74 return CreateSurface(size);
75}
#define FML_CHECK(condition)
Definition logging.h:104

References FML_CHECK.

◆ ProduceSurface()

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

Implements flutter_runner::SurfaceProducer.

Definition at line 77 of file software_surface_producer.cc.

78 {
79 TRACE_EVENT2("flutter", "SoftwareSurfacePool::ProduceSurface", "width",
80 size.width(), "height", size.height());
81 FML_CHECK(valid_);
82
83 std::unique_ptr<SurfaceProducerSurface> surface;
84 auto exact_match_it =
85 std::find_if(available_surfaces_.begin(), available_surfaces_.end(),
86 [&size](const auto& surface) {
87 return surface->IsValid() && surface->GetSize() == size;
88 });
89 if (exact_match_it != available_surfaces_.end()) {
90 TRACE_EVENT_INSTANT0("flutter", "Exact match found");
91 surface = std::move(*exact_match_it);
92 available_surfaces_.erase(exact_match_it);
93 } else {
94 surface = CreateSurface(size);
95 }
96
97 if (surface == nullptr) {
98 FML_LOG(ERROR) << "Could not acquire surface.";
99 return nullptr;
100 }
101
102 if (!surface->FlushSessionAcquireAndReleaseEvents()) {
103 FML_LOG(ERROR) << "Could not flush acquire/release events for buffer.";
104 return nullptr;
105 }
106
107 return surface;
108}
VkSurfaceKHR surface
Definition main.cc:65
#define FML_LOG(severity)
Definition logging.h:101
it will be possible to load the file into Perfetto s trace viewer use test Running tests that layout and measure text will not yield consistent results across various platforms Enabling this option will make font resolution default to the Ahem test font on all 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
#define TRACE_EVENT2(category_group, name, arg1_name, arg1_val, arg2_name, arg2_val)
#define TRACE_EVENT_INSTANT0(category_group, name)

References FML_CHECK, FML_LOG, surface, TRACE_EVENT2, and TRACE_EVENT_INSTANT0.

◆ SubmitSurfaces()

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

Implements flutter_runner::SurfaceProducer.

Definition at line 110 of file software_surface_producer.cc.

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

References surface, and TRACE_EVENT0.

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: