Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Types | Public Member Functions | List of all members
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 25 of file skia_gpu_object.h.

Member Typedef Documentation

◆ ResourceContext

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

Definition at line 27 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 43 of file skia_gpu_object.h.

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

◆ Drain()

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

Definition at line 60 of file skia_gpu_object.h.

60 {
61 TRACE_EVENT0("flutter", "SkiaUnrefQueue::Drain");
62 std::deque<SkRefCnt*> skia_objects;
63 std::deque<GrBackendTexture> textures;
64 {
65 std::scoped_lock lock(mutex_);
66 objects_.swap(skia_objects);
67 textures_.swap(textures);
68 drain_pending_ = false;
69 }
70 DoDrain(skia_objects, textures, context_);
71 }
std::vector< std::shared_ptr< FakeTexture > > textures
#define TRACE_EVENT0(category_group, name)

◆ Unref()

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

Definition at line 29 of file skia_gpu_object.h.

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

◆ UpdateResourceContext()

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

Definition at line 73 of file skia_gpu_object.h.

73 {
74 context_ = context;
75 }

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