Flutter Engine
 
Loading...
Searching...
No Matches
flutter::UnrefQueue< T > Class Template Reference

#include <skia_gpu_object.h>

Inheritance diagram for flutter::UnrefQueue< T >:
fml::RefCountedThreadSafe< UnrefQueue< T > > fml::internal::RefCountedThreadSafeBase

Public Types

using ResourceContext = T
 

Public Member Functions

void Unref (SkRefCnt *object)
 
void DeleteTexture (const GrBackendTexture &texture)
 
void Drain ()
 
void UpdateResourceContext (sk_sp< ResourceContext > context)
 
- Public Member Functions inherited from fml::RefCountedThreadSafe< UnrefQueue< T > >
void Release () const
 
- Public Member Functions inherited from fml::internal::RefCountedThreadSafeBase
void AddRef () const
 
bool HasOneRef () const
 
void AssertHasOneRef () const
 

Additional Inherited Members

- Protected Member Functions inherited from fml::RefCountedThreadSafe< UnrefQueue< T > >
 RefCountedThreadSafe ()
 
 ~RefCountedThreadSafe ()
 
- Protected Member Functions inherited from fml::internal::RefCountedThreadSafeBase
 RefCountedThreadSafeBase ()
 
 ~RefCountedThreadSafeBase ()
 
bool Release () const
 
void Adopt ()
 

Detailed Description

template<class T>
class flutter::UnrefQueue< T >

Definition at line 26 of file skia_gpu_object.h.

Member Typedef Documentation

◆ ResourceContext

template<class T >
using flutter::UnrefQueue< T >::ResourceContext = T

Definition at line 28 of file skia_gpu_object.h.

Member Function Documentation

◆ DeleteTexture()

template<class T >
void flutter::UnrefQueue< T >::DeleteTexture ( const GrBackendTexture &  texture)
inline

Definition at line 45 of file skia_gpu_object.h.

45 {
46 // drain_immediate_ should only be used on Impeller.
47 FML_DCHECK(!drain_immediate_);
48 std::scoped_lock lock(mutex_);
49 textures_.push_back(texture);
50 if (!drain_pending_) {
51 drain_pending_ = true;
52 task_runner_->PostDelayedTask(
53 [strong = fml::Ref(this)]() { strong->Drain(); }, drain_delay_);
54 }
55 }
virtual void PostDelayedTask(const fml::closure &task, fml::TimeDelta delay)
#define FML_DCHECK(condition)
Definition logging.h:122
FlTexture * texture
RefPtr< T > Ref(T *ptr)
Definition ref_ptr.h:242

References FML_DCHECK, fml::TaskRunner::PostDelayedTask(), fml::Ref(), and texture.

◆ Drain()

template<class T >
void flutter::UnrefQueue< T >::Drain ( )
inline

Definition at line 63 of file skia_gpu_object.h.

63 {
64 TRACE_EVENT0("flutter", "SkiaUnrefQueue::Drain");
65 std::deque<SkRefCnt*> skia_objects;
66
67 NOT_SLIMPELLER(std::deque<GrBackendTexture> textures);
68
69 {
70 std::scoped_lock lock(mutex_);
71 objects_.swap(skia_objects);
72 NOT_SLIMPELLER(textures_.swap(textures));
73 drain_pending_ = false;
74 }
75 DoDrain(skia_objects,
76#if !SLIMPELLER
77 textures,
78#endif // !SLIMPELLER
79 context_);
80 }
#define NOT_SLIMPELLER(code)
Definition macros.h:16
#define TRACE_EVENT0(category_group, name)

References NOT_SLIMPELLER, and TRACE_EVENT0.

◆ Unref()

template<class T >
void flutter::UnrefQueue< T >::Unref ( SkRefCnt *  object)
inline

Definition at line 30 of file skia_gpu_object.h.

30 {
31 if (drain_immediate_) {
32 object->unref();
33 return;
34 }
35 std::scoped_lock lock(mutex_);
36 objects_.push_back(object);
37 if (!drain_pending_) {
38 drain_pending_ = true;
39 task_runner_->PostDelayedTask(
40 [strong = fml::Ref(this)]() { strong->Drain(); }, drain_delay_);
41 }
42 }

References fml::TaskRunner::PostDelayedTask(), and fml::Ref().

◆ UpdateResourceContext()

template<class T >
void flutter::UnrefQueue< T >::UpdateResourceContext ( sk_sp< ResourceContext context)
inline

Definition at line 82 of file skia_gpu_object.h.

82 {
83 context_ = std::move(context);
84 }

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