Flutter Engine
flutter::testing::SkiaGpuObjectTest Class Reference
Inheritance diagram for flutter::testing::SkiaGpuObjectTest:
flutter::testing::ThreadTest

Public Member Functions

 SkiaGpuObjectTest ()
 
fml::RefPtr< fml::TaskRunnerunref_task_runner ()
 
fml::RefPtr< SkiaUnrefQueueunref_queue ()
 
fml::RefPtr< SkiaUnrefQueuedelayed_unref_queue ()
 
- Public Member Functions inherited from flutter::testing::ThreadTest
 ThreadTest ()
 
fml::RefPtr< fml::TaskRunnerGetCurrentTaskRunner ()
 Get the task runner for the thread that the current unit-test is running on. This creates a message loop as necessary. More...
 
fml::RefPtr< fml::TaskRunnerCreateNewThread (std::string name="")
 Creates a new thread, initializes a message loop on it, and, returns its task runner to the unit-test. The message loop is terminated (and its thread joined) when the test ends. This allows tests to create multiple named threads as necessary. More...
 

Detailed Description

Definition at line 37 of file skia_gpu_object_unittests.cc.

Constructor & Destructor Documentation

◆ SkiaGpuObjectTest()

flutter::testing::SkiaGpuObjectTest::SkiaGpuObjectTest ( )
inline

Definition at line 39 of file skia_gpu_object_unittests.cc.

References fml::TimeDelta::FromSeconds().

40  : unref_task_runner_(CreateNewThread()),
41  unref_queue_(fml::MakeRefCounted<SkiaUnrefQueue>(
44  delayed_unref_queue_(fml::MakeRefCounted<SkiaUnrefQueue>(
47  // The unref queues must be created in the same thread of the
48  // unref_task_runner so the queue can access the same-thread-only WeakPtr of
49  // the GrContext constructed during the creation.
50  std::promise<bool> queuesCreated;
51  unref_task_runner_->PostTask([this, &queuesCreated]() {
52  unref_queue_ = fml::MakeRefCounted<SkiaUnrefQueue>(
54  delayed_unref_queue_ = fml::MakeRefCounted<SkiaUnrefQueue>(
56  queuesCreated.set_value(true);
57  });
58  queuesCreated.get_future().wait();
59  ::testing::FLAGS_gtest_death_test_style = "threadsafe";
60  }
static constexpr TimeDelta FromSeconds(int64_t seconds)
Definition: time_delta.h:49
fml::RefPtr< fml::TaskRunner > CreateNewThread(std::string name="")
Creates a new thread, initializes a message loop on it, and, returns its task runner to the unit-test...
Definition: thread_test.cc:26
virtual void PostTask(const fml::closure &task)
Definition: task_runner.cc:24
fml::RefPtr< fml::TaskRunner > unref_task_runner()

Member Function Documentation

◆ delayed_unref_queue()

fml::RefPtr<SkiaUnrefQueue> flutter::testing::SkiaGpuObjectTest::delayed_unref_queue ( )
inline

Definition at line 66 of file skia_gpu_object_unittests.cc.

66  {
67  return delayed_unref_queue_;
68  }

◆ unref_queue()

fml::RefPtr<SkiaUnrefQueue> flutter::testing::SkiaGpuObjectTest::unref_queue ( )
inline

Definition at line 65 of file skia_gpu_object_unittests.cc.

65 { return unref_queue_; }

◆ unref_task_runner()

fml::RefPtr<fml::TaskRunner> flutter::testing::SkiaGpuObjectTest::unref_task_runner ( )
inline

Definition at line 62 of file skia_gpu_object_unittests.cc.

62  {
63  return unref_task_runner_;
64  }

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