Flutter Impeller
impeller::testing::FailingAllocator Class Reference
Inheritance diagram for impeller::testing::FailingAllocator:
impeller::Allocator

Public Member Functions

 FailingAllocator (std::shared_ptr< Allocator > delegate)
 
 ~FailingAllocator ()=default
 
std::shared_ptr< DeviceBufferOnCreateBuffer (const DeviceBufferDescriptor &desc)
 
std::shared_ptr< TextureOnCreateTexture (const TextureDescriptor &desc)
 
ISize GetMaxTextureSizeSupported () const override
 
- Public Member Functions inherited from impeller::Allocator
virtual ~Allocator ()
 
bool IsValid () const
 
std::shared_ptr< DeviceBufferCreateBuffer (const DeviceBufferDescriptor &desc)
 
std::shared_ptr< TextureCreateTexture (const TextureDescriptor &desc)
 
virtual uint16_t MinimumBytesPerRow (PixelFormat format) const
 Minimum value for row_bytes on a Texture. The row bytes parameter of that method must be aligned to this value. More...
 
std::shared_ptr< DeviceBufferCreateBufferWithCopy (const uint8_t *buffer, size_t length)
 
std::shared_ptr< DeviceBufferCreateBufferWithCopy (const fml::Mapping &mapping)
 
virtual void DebugTraceMemoryStatistics () const
 Write debug memory usage information to the dart timeline in debug and profile modes. More...
 
virtual Bytes DebugGetHeapUsage () const
 

Additional Inherited Members

- Protected Member Functions inherited from impeller::Allocator
 Allocator ()
 

Detailed Description

Definition at line 168 of file host_buffer_unittests.cc.

Constructor & Destructor Documentation

◆ FailingAllocator()

impeller::testing::FailingAllocator::FailingAllocator ( std::shared_ptr< Allocator delegate)
inlineexplicit

Definition at line 170 of file host_buffer_unittests.cc.

171  : Allocator(), delegate_(std::move(delegate)) {}

◆ ~FailingAllocator()

impeller::testing::FailingAllocator::~FailingAllocator ( )
default

Member Function Documentation

◆ GetMaxTextureSizeSupported()

ISize impeller::testing::FailingAllocator::GetMaxTextureSizeSupported ( ) const
inlineoverridevirtual

Implements impeller::Allocator.

Definition at line 188 of file host_buffer_unittests.cc.

188  {
189  return delegate_->GetMaxTextureSizeSupported();
190  }

◆ OnCreateBuffer()

std::shared_ptr<DeviceBuffer> impeller::testing::FailingAllocator::OnCreateBuffer ( const DeviceBufferDescriptor desc)
inlinevirtual

Implements impeller::Allocator.

Definition at line 175 of file host_buffer_unittests.cc.

176  {
177  // Magic number used in test below to trigger failure.
178  if (desc.size == kMagicFailingAllocation) {
179  return nullptr;
180  }
181  return delegate_->CreateBuffer(desc);
182  }

References impeller::testing::kMagicFailingAllocation, and impeller::DeviceBufferDescriptor::size.

◆ OnCreateTexture()

std::shared_ptr<Texture> impeller::testing::FailingAllocator::OnCreateTexture ( const TextureDescriptor desc)
inlinevirtual

Implements impeller::Allocator.

Definition at line 184 of file host_buffer_unittests.cc.

184  {
185  return delegate_->CreateTexture(desc);
186  }

The documentation for this class was generated from the following file:
impeller::testing::kMagicFailingAllocation
static constexpr const size_t kMagicFailingAllocation
Definition: host_buffer_unittests.cc:166
impeller::Allocator::Allocator
Allocator()