Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
skia_private::AutoSTMalloc< kCountRequested, T, typename > Class Template Reference

#include <SkTemplates.h>

Public Member Functions

 AutoSTMalloc ()
 
 AutoSTMalloc (size_t count)
 
 AutoSTMalloc (AutoSTMalloc &&)=delete
 
 AutoSTMalloc (const AutoSTMalloc &)=delete
 
AutoSTMallocoperator= (AutoSTMalloc &&)=delete
 
AutoSTMallocoperator= (const AutoSTMalloc &)=delete
 
 ~AutoSTMalloc ()
 
Treset (size_t count)
 
Tget () const
 
 operator T* ()
 
 operator const T * () const
 
Toperator[] (int index)
 
const Toperator[] (int index) const
 
const Tdata () const
 
Tdata ()
 
void realloc (size_t count)
 

Detailed Description

template<size_t kCountRequested, typename T, typename = std::enable_if_t<std::is_trivially_default_constructible<T>::value && std::is_trivially_destructible<T>::value>>
class skia_private::AutoSTMalloc< kCountRequested, T, typename >

Definition at line 330 of file SkTemplates.h.

Constructor & Destructor Documentation

◆ AutoSTMalloc() [1/4]

template<size_t kCountRequested, typename T , typename = std::enable_if_t<std::is_trivially_default_constructible<T>::value && std::is_trivially_destructible<T>::value>>
skia_private::AutoSTMalloc< kCountRequested, T, typename >::AutoSTMalloc ( )
inline

Definition at line 332 of file SkTemplates.h.

332: fPtr(fTStorage) {}

◆ AutoSTMalloc() [2/4]

template<size_t kCountRequested, typename T , typename = std::enable_if_t<std::is_trivially_default_constructible<T>::value && std::is_trivially_destructible<T>::value>>
skia_private::AutoSTMalloc< kCountRequested, T, typename >::AutoSTMalloc ( size_t  count)
inline

Definition at line 334 of file SkTemplates.h.

334 {
335 if (count > kCount) {
336 fPtr = (T*)sk_malloc_throw(count, sizeof(T));
337 } else if (count) {
338 fPtr = fTStorage;
339 } else {
340 fPtr = nullptr;
341 }
342 }
int count
static void * sk_malloc_throw(size_t size)
Definition SkMalloc.h:67
#define T

◆ AutoSTMalloc() [3/4]

template<size_t kCountRequested, typename T , typename = std::enable_if_t<std::is_trivially_default_constructible<T>::value && std::is_trivially_destructible<T>::value>>
skia_private::AutoSTMalloc< kCountRequested, T, typename >::AutoSTMalloc ( AutoSTMalloc< kCountRequested, T, typename > &&  )
delete

◆ AutoSTMalloc() [4/4]

template<size_t kCountRequested, typename T , typename = std::enable_if_t<std::is_trivially_default_constructible<T>::value && std::is_trivially_destructible<T>::value>>
skia_private::AutoSTMalloc< kCountRequested, T, typename >::AutoSTMalloc ( const AutoSTMalloc< kCountRequested, T, typename > &  )
delete

◆ ~AutoSTMalloc()

template<size_t kCountRequested, typename T , typename = std::enable_if_t<std::is_trivially_default_constructible<T>::value && std::is_trivially_destructible<T>::value>>
skia_private::AutoSTMalloc< kCountRequested, T, typename >::~AutoSTMalloc ( )
inline

Definition at line 349 of file SkTemplates.h.

349 {
350 if (fPtr != fTStorage) {
351 sk_free(fPtr);
352 }
353 }
SK_API void sk_free(void *)

Member Function Documentation

◆ data() [1/2]

template<size_t kCountRequested, typename T , typename = std::enable_if_t<std::is_trivially_default_constructible<T>::value && std::is_trivially_destructible<T>::value>>
T * skia_private::AutoSTMalloc< kCountRequested, T, typename >::data ( )
inline

Definition at line 390 of file SkTemplates.h.

390{ return fPtr; }

◆ data() [2/2]

template<size_t kCountRequested, typename T , typename = std::enable_if_t<std::is_trivially_default_constructible<T>::value && std::is_trivially_destructible<T>::value>>
const T * skia_private::AutoSTMalloc< kCountRequested, T, typename >::data ( ) const
inline

Aliases matching other types, like std::vector.

Definition at line 389 of file SkTemplates.h.

389{ return fPtr; }

◆ get()

template<size_t kCountRequested, typename T , typename = std::enable_if_t<std::is_trivially_default_constructible<T>::value && std::is_trivially_destructible<T>::value>>
T * skia_private::AutoSTMalloc< kCountRequested, T, typename >::get ( ) const
inline

Definition at line 370 of file SkTemplates.h.

370{ return fPtr; }

◆ operator const T *()

template<size_t kCountRequested, typename T , typename = std::enable_if_t<std::is_trivially_default_constructible<T>::value && std::is_trivially_destructible<T>::value>>
skia_private::AutoSTMalloc< kCountRequested, T, typename >::operator const T * ( ) const
inline

Definition at line 376 of file SkTemplates.h.

376 {
377 return fPtr;
378 }

◆ operator T*()

template<size_t kCountRequested, typename T , typename = std::enable_if_t<std::is_trivially_default_constructible<T>::value && std::is_trivially_destructible<T>::value>>
skia_private::AutoSTMalloc< kCountRequested, T, typename >::operator T* ( )
inline

Definition at line 372 of file SkTemplates.h.

372 {
373 return fPtr;
374 }

◆ operator=() [1/2]

template<size_t kCountRequested, typename T , typename = std::enable_if_t<std::is_trivially_default_constructible<T>::value && std::is_trivially_destructible<T>::value>>
AutoSTMalloc & skia_private::AutoSTMalloc< kCountRequested, T, typename >::operator= ( AutoSTMalloc< kCountRequested, T, typename > &&  )
delete

◆ operator=() [2/2]

template<size_t kCountRequested, typename T , typename = std::enable_if_t<std::is_trivially_default_constructible<T>::value && std::is_trivially_destructible<T>::value>>
AutoSTMalloc & skia_private::AutoSTMalloc< kCountRequested, T, typename >::operator= ( const AutoSTMalloc< kCountRequested, T, typename > &  )
delete

◆ operator[]() [1/2]

template<size_t kCountRequested, typename T , typename = std::enable_if_t<std::is_trivially_default_constructible<T>::value && std::is_trivially_destructible<T>::value>>
T & skia_private::AutoSTMalloc< kCountRequested, T, typename >::operator[] ( int  index)
inline

Definition at line 380 of file SkTemplates.h.

380 {
381 return fPtr[index];
382 }

◆ operator[]() [2/2]

template<size_t kCountRequested, typename T , typename = std::enable_if_t<std::is_trivially_default_constructible<T>::value && std::is_trivially_destructible<T>::value>>
const T & skia_private::AutoSTMalloc< kCountRequested, T, typename >::operator[] ( int  index) const
inline

Definition at line 384 of file SkTemplates.h.

384 {
385 return fPtr[index];
386 }

◆ realloc()

template<size_t kCountRequested, typename T , typename = std::enable_if_t<std::is_trivially_default_constructible<T>::value && std::is_trivially_destructible<T>::value>>
void skia_private::AutoSTMalloc< kCountRequested, T, typename >::realloc ( size_t  count)
inline

Definition at line 393 of file SkTemplates.h.

393 {
394 if (count > kCount) {
395 if (fPtr == fTStorage) {
396 fPtr = (T*)sk_malloc_throw(count, sizeof(T));
397 memcpy((void*)fPtr, fTStorage, kCount * sizeof(T));
398 } else {
399 fPtr = (T*)sk_realloc_throw(fPtr, count, sizeof(T));
400 }
401 } else if (count) {
402 if (fPtr != fTStorage) {
403 fPtr = (T*)sk_realloc_throw(fPtr, count, sizeof(T));
404 }
405 } else {
406 this->reset(0);
407 }
408 }
m reset()
SK_API void * sk_realloc_throw(void *buffer, size_t size)

◆ reset()

template<size_t kCountRequested, typename T , typename = std::enable_if_t<std::is_trivially_default_constructible<T>::value && std::is_trivially_destructible<T>::value>>
T * skia_private::AutoSTMalloc< kCountRequested, T, typename >::reset ( size_t  count)
inline

Definition at line 356 of file SkTemplates.h.

356 {
357 if (fPtr != fTStorage) {
358 sk_free(fPtr);
359 }
360 if (count > kCount) {
361 fPtr = (T*)sk_malloc_throw(count, sizeof(T));
362 } else if (count) {
363 fPtr = fTStorage;
364 } else {
365 fPtr = nullptr;
366 }
367 return fPtr;
368 }

Member Data Documentation

◆ fStorage32

template<size_t kCountRequested, typename T , typename = std::enable_if_t<std::is_trivially_default_constructible<T>::value && std::is_trivially_destructible<T>::value>>
uint32_t skia_private::AutoSTMalloc< kCountRequested, T, typename >::fStorage32[SkAlign4(kCount *sizeof(T)) > > 2]

Definition at line 426 of file SkTemplates.h.

◆ fTStorage

template<size_t kCountRequested, typename T , typename = std::enable_if_t<std::is_trivially_default_constructible<T>::value && std::is_trivially_destructible<T>::value>>
T skia_private::AutoSTMalloc< kCountRequested, T, typename >::fTStorage[1]

Definition at line 427 of file SkTemplates.h.


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