Flutter Engine
The Flutter Engine
Public Member Functions | Public Attributes | List of all members
flutter::testing::TestIOManager Class Referencefinal
Inheritance diagram for flutter::testing::TestIOManager:
flutter::IOManager

Public Member Functions

 TestIOManager (const fml::RefPtr< fml::TaskRunner > &task_runner, bool has_gpu_context=true)
 
 ~TestIOManager () override
 
fml::WeakPtr< IOManagerGetWeakIOManager () const override
 
fml::WeakPtr< GrDirectContextGetResourceContext () const override
 
fml::RefPtr< flutter::SkiaUnrefQueueGetSkiaUnrefQueue () const override
 
std::shared_ptr< const fml::SyncSwitchGetIsGpuDisabledSyncSwitch () override
 
std::shared_ptr< impeller::ContextGetImpellerContext () const override
 
void SetGpuDisabled (bool disabled)
 
- Public Member Functions inherited from flutter::IOManager
virtual ~IOManager ()=default
 
virtual fml::WeakPtr< IOManagerGetWeakIOManager () const =0
 
virtual fml::WeakPtr< GrDirectContextGetResourceContext () const =0
 
virtual fml::RefPtr< flutter::SkiaUnrefQueueGetSkiaUnrefQueue () const =0
 
virtual std::shared_ptr< const fml::SyncSwitchGetIsGpuDisabledSyncSwitch ()=0
 
virtual std::shared_ptr< impeller::ContextGetImpellerContext () const
 

Public Attributes

bool did_access_is_gpu_disabled_sync_switch_ = false
 

Detailed Description

Definition at line 92 of file image_decoder_unittests.cc.

Constructor & Destructor Documentation

◆ TestIOManager()

flutter::testing::TestIOManager::TestIOManager ( const fml::RefPtr< fml::TaskRunner > &  task_runner,
bool  has_gpu_context = true 
)
inlineexplicit

Definition at line 94 of file image_decoder_unittests.cc.

96 : gl_surface_(SkISize::Make(1, 1)),
97 impeller_context_(std::make_shared<impeller::TestImpellerContext>()),
98 gl_context_(has_gpu_context ? gl_surface_.CreateGrContext() : nullptr),
99 weak_gl_context_factory_(
100 has_gpu_context
101 ? std::make_unique<fml::WeakPtrFactory<GrDirectContext>>(
102 gl_context_.get())
103 : nullptr),
104 unref_queue_(fml::MakeRefCounted<SkiaUnrefQueue>(
105 task_runner,
107 gl_context_)),
108 runner_(task_runner),
109 is_gpu_disabled_sync_switch_(std::make_shared<fml::SyncSwitch>()),
110 weak_factory_(this) {
111 FML_CHECK(task_runner->RunsTasksOnCurrentThread())
112 << "The IO manager must be initialized its primary task runner. The "
113 "test harness may not be set up correctly/safely.";
114 weak_prototype_ = weak_factory_.GetWeakPtr();
115 }
sk_sp< GrDirectContext > CreateGrContext()
virtual bool RunsTasksOnCurrentThread()
Definition: task_runner.cc:43
static constexpr TimeDelta FromNanoseconds(int64_t nanos)
Definition: time_delta.h:40
T * get() const
Definition: SkRefCnt.h:303
#define FML_CHECK(condition)
Definition: logging.h:85
static constexpr SkISize Make(int32_t w, int32_t h)
Definition: SkSize.h:20

◆ ~TestIOManager()

flutter::testing::TestIOManager::~TestIOManager ( )
inlineoverride

Definition at line 117 of file image_decoder_unittests.cc.

117 {
120 [&latch, queue = unref_queue_]() {
121 queue->Drain();
122 latch.Signal();
123 });
124 latch.Wait();
125 }
static void RunNowOrPostTask(const fml::RefPtr< fml::TaskRunner > &runner, const fml::closure &task)
Definition: task_runner.cc:55
VkQueue queue
Definition: main.cc:55

Member Function Documentation

◆ GetImpellerContext()

std::shared_ptr< impeller::Context > flutter::testing::TestIOManager::GetImpellerContext ( ) const
inlineoverridevirtual

Reimplemented from flutter::IOManager.

Definition at line 150 of file image_decoder_unittests.cc.

150 {
151 return impeller_context_;
152 }

◆ GetIsGpuDisabledSyncSwitch()

std::shared_ptr< const fml::SyncSwitch > flutter::testing::TestIOManager::GetIsGpuDisabledSyncSwitch ( )
inlineoverridevirtual

Implements flutter::IOManager.

Definition at line 144 of file image_decoder_unittests.cc.

144 {
146 return is_gpu_disabled_sync_switch_;
147 }

◆ GetResourceContext()

fml::WeakPtr< GrDirectContext > flutter::testing::TestIOManager::GetResourceContext ( ) const
inlineoverridevirtual

Implements flutter::IOManager.

Definition at line 133 of file image_decoder_unittests.cc.

133 {
134 return weak_gl_context_factory_ ? weak_gl_context_factory_->GetWeakPtr()
136 }

◆ GetSkiaUnrefQueue()

fml::RefPtr< flutter::SkiaUnrefQueue > flutter::testing::TestIOManager::GetSkiaUnrefQueue ( ) const
inlineoverridevirtual

Implements flutter::IOManager.

Definition at line 139 of file image_decoder_unittests.cc.

139 {
140 return unref_queue_;
141 }

◆ GetWeakIOManager()

fml::WeakPtr< IOManager > flutter::testing::TestIOManager::GetWeakIOManager ( ) const
inlineoverridevirtual

Implements flutter::IOManager.

Definition at line 128 of file image_decoder_unittests.cc.

128 {
129 return weak_prototype_;
130 }

◆ SetGpuDisabled()

void flutter::testing::TestIOManager::SetGpuDisabled ( bool  disabled)
inline

Definition at line 154 of file image_decoder_unittests.cc.

154 {
155 is_gpu_disabled_sync_switch_->SetSwitch(disabled);
156 }

Member Data Documentation

◆ did_access_is_gpu_disabled_sync_switch_

bool flutter::testing::TestIOManager::did_access_is_gpu_disabled_sync_switch_ = false

Definition at line 158 of file image_decoder_unittests.cc.


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