Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
flutter::EmbedderRenderTargetCache Class Reference

A cache used to reference render targets that are owned by the embedder but needed by th engine to render a frame. More...

#include <embedder_render_target_cache.h>

Public Member Functions

 EmbedderRenderTargetCache ()
 
 ~EmbedderRenderTargetCache ()
 
std::unique_ptr< EmbedderRenderTargetGetRenderTarget (const EmbedderExternalView::RenderTargetDescriptor &descriptor)
 
std::set< std::unique_ptr< EmbedderRenderTarget > > ClearAllRenderTargetsInCache ()
 
void CacheRenderTarget (std::unique_ptr< EmbedderRenderTarget > target)
 
size_t GetCachedTargetsCount () const
 

Detailed Description

A cache used to reference render targets that are owned by the embedder but needed by th engine to render a frame.

A map of class is managed by EmbedderExternalViewEmbedder. Each instance of this class manages the cached render targets for a view.

Definition at line 26 of file embedder_render_target_cache.h.

Constructor & Destructor Documentation

◆ EmbedderRenderTargetCache()

flutter::EmbedderRenderTargetCache::EmbedderRenderTargetCache ( )
default

◆ ~EmbedderRenderTargetCache()

flutter::EmbedderRenderTargetCache::~EmbedderRenderTargetCache ( )
default

Member Function Documentation

◆ CacheRenderTarget()

void flutter::EmbedderRenderTargetCache::CacheRenderTarget ( std::unique_ptr< EmbedderRenderTarget target)

Definition at line 35 of file embedder_render_target_cache.cc.

36 {
37 if (target == nullptr) {
38 return;
39 }
40 auto desc = EmbedderExternalView::RenderTargetDescriptor{
41 target->GetRenderTargetSize()};
42 cached_render_targets_.insert(std::make_pair(desc, std::move(target)));
43}
uint32_t * target

◆ ClearAllRenderTargetsInCache()

std::set< std::unique_ptr< EmbedderRenderTarget > > flutter::EmbedderRenderTargetCache::ClearAllRenderTargetsInCache ( )

Definition at line 26 of file embedder_render_target_cache.cc.

26 {
27 std::set<std::unique_ptr<EmbedderRenderTarget>> cleared_targets;
28 for (auto& targets : cached_render_targets_) {
29 cleared_targets.insert(std::move(targets.second));
30 }
31 cached_render_targets_.clear();
32 return cleared_targets;
33}

◆ GetCachedTargetsCount()

size_t flutter::EmbedderRenderTargetCache::GetCachedTargetsCount ( ) const

Definition at line 45 of file embedder_render_target_cache.cc.

45 {
46 return cached_render_targets_.size();
47}

◆ GetRenderTarget()

std::unique_ptr< EmbedderRenderTarget > flutter::EmbedderRenderTargetCache::GetRenderTarget ( const EmbedderExternalView::RenderTargetDescriptor descriptor)

Definition at line 14 of file embedder_render_target_cache.cc.

15 {
16 auto compatible_target = cached_render_targets_.find(descriptor);
17 if (compatible_target == cached_render_targets_.end()) {
18 return nullptr;
19 }
20 auto target = std::move(compatible_target->second);
21 cached_render_targets_.erase(compatible_target);
22 return target;
23}

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