Flutter Engine
flutter::SkiaUnrefQueue Class Reference

#include <skia_gpu_object.h>

Inheritance diagram for flutter::SkiaUnrefQueue:
fml::RefCountedThreadSafe< SkiaUnrefQueue > fml::internal::RefCountedThreadSafeBase

Public Member Functions

void Unref (SkRefCnt *object)
 
void Drain ()
 
- Public Member Functions inherited from fml::RefCountedThreadSafe< SkiaUnrefQueue >
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< SkiaUnrefQueue >
 RefCountedThreadSafe ()
 
 ~RefCountedThreadSafe ()
 
- Protected Member Functions inherited from fml::internal::RefCountedThreadSafeBase
 RefCountedThreadSafeBase ()
 
 ~RefCountedThreadSafeBase ()
 
bool Release () const
 
void Adopt ()
 

Detailed Description

Definition at line 21 of file skia_gpu_object.h.

Member Function Documentation

◆ Drain()

void flutter::SkiaUnrefQueue::Drain ( )

Definition at line 34 of file skia_gpu_object.cc.

References TRACE_EVENT0.

Referenced by flutter::ShellIOManager::~ShellIOManager().

34  {
35  TRACE_EVENT0("flutter", "SkiaUnrefQueue::Drain");
36  std::deque<SkRefCnt*> skia_objects;
37  {
38  std::scoped_lock lock(mutex_);
39  objects_.swap(skia_objects);
40  drain_pending_ = false;
41  }
42 
43  for (SkRefCnt* skia_object : skia_objects) {
44  skia_object->unref();
45  }
46 
47  if (context_ && skia_objects.size() > 0) {
48  context_->performDeferredCleanup(std::chrono::milliseconds(0));
49  }
50 }
#define TRACE_EVENT0(category_group, name)
Definition: trace_event.h:75

◆ Unref()

void flutter::SkiaUnrefQueue::Unref ( SkRefCnt *  object)

Definition at line 24 of file skia_gpu_object.cc.

References fml::Ref().

24  {
25  std::scoped_lock lock(mutex_);
26  objects_.push_back(object);
27  if (!drain_pending_) {
28  drain_pending_ = true;
29  task_runner_->PostDelayedTask(
30  [strong = fml::Ref(this)]() { strong->Drain(); }, drain_delay_);
31  }
32 }
RefPtr< T > Ref(T *ptr)
Definition: ref_ptr.h:233
virtual void PostDelayedTask(const fml::closure &task, fml::TimeDelta delay)
Definition: task_runner.cc:33

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