Flutter Engine
The Flutter Engine
Public Member Functions | List of all members
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 (const 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 50 of file skia_gpu_object_unittests.cc.

Constructor & Destructor Documentation

◆ SkiaGpuObjectTest()

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

Definition at line 52 of file skia_gpu_object_unittests.cc.

53 : unref_task_runner_(CreateNewThread()),
54 unref_queue_(fml::MakeRefCounted<SkiaUnrefQueue>(
57 delayed_unref_queue_(fml::MakeRefCounted<SkiaUnrefQueue>(
60 // The unref queues must be created in the same thread of the
61 // unref_task_runner so the queue can access the same-thread-only WeakPtr of
62 // the GrContext constructed during the creation.
63 std::promise<bool> queues_created;
64 unref_task_runner_->PostTask([this, &queues_created]() {
65 unref_queue_ = fml::MakeRefCounted<SkiaUnrefQueue>(
67 delayed_unref_queue_ = fml::MakeRefCounted<SkiaUnrefQueue>(
69 queues_created.set_value(true);
70 });
71 queues_created.get_future().wait();
72 ::testing::FLAGS_gtest_death_test_style = "threadsafe";
73 }
fml::RefPtr< fml::TaskRunner > unref_task_runner()
fml::RefPtr< fml::TaskRunner > CreateNewThread(const 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) override
Definition: task_runner.cc:24
static constexpr TimeDelta FromSeconds(int64_t seconds)
Definition: time_delta.h:49

Member Function Documentation

◆ delayed_unref_queue()

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

Definition at line 79 of file skia_gpu_object_unittests.cc.

79 {
80 return delayed_unref_queue_;
81 }

◆ unref_queue()

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

Definition at line 78 of file skia_gpu_object_unittests.cc.

78{ return unref_queue_; }

◆ unref_task_runner()

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

Definition at line 75 of file skia_gpu_object_unittests.cc.

75 {
76 return unref_task_runner_;
77 }

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