Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | List of all members
dart::MemoryRegion Class Reference

#include <memory_region.h>

Inheritance diagram for dart::MemoryRegion:
dart::ValueObject

Public Member Functions

 MemoryRegion ()
 
 MemoryRegion (void *pointer, uword size)
 
 MemoryRegion (const MemoryRegion &other)
 
MemoryRegionoperator= (const MemoryRegion &other)
 
void * pointer () const
 
uword size () const
 
void set_size (uword new_size)
 
uword start () const
 
uword end () const
 
template<typename T >
T Load (uword offset) const
 
template<typename T >
void Store (uword offset, T value) const
 
template<typename T >
void StoreUnaligned (uword offset, T value) const
 
template<typename T >
TPointerTo (uword offset) const
 
bool Contains (uword address) const
 
void CopyFrom (uword offset, const MemoryRegion &from) const
 
void Subregion (const MemoryRegion &from, uword offset, uword size)
 
void Extend (const MemoryRegion &region, uword extra)
 
- Public Member Functions inherited from dart::ValueObject
 ValueObject ()
 
 ~ValueObject ()
 

Detailed Description

Definition at line 18 of file memory_region.h.

Constructor & Destructor Documentation

◆ MemoryRegion() [1/3]

dart::MemoryRegion::MemoryRegion ( )
inline

Definition at line 20 of file memory_region.h.

20: pointer_(nullptr), size_(0) {}

◆ MemoryRegion() [2/3]

dart::MemoryRegion::MemoryRegion ( void *  pointer,
uword  size 
)
inline

Definition at line 21 of file memory_region.h.

21: pointer_(pointer), size_(size) {}
void * pointer() const
uword size() const

◆ MemoryRegion() [3/3]

dart::MemoryRegion::MemoryRegion ( const MemoryRegion other)
inline

Definition at line 22 of file memory_region.h.

22: ValueObject() { *this = other; }

Member Function Documentation

◆ Contains()

bool dart::MemoryRegion::Contains ( uword  address) const
inline

Definition at line 56 of file memory_region.h.

56 {
57 return (address >= start()) && (address < end());
58 }
uword end() const
uword start() const

◆ CopyFrom()

void dart::MemoryRegion::CopyFrom ( uword  offset,
const MemoryRegion from 
) const

Definition at line 9 of file memory_region.cc.

9 {
10 ASSERT(from.pointer() != nullptr && from.size() > 0);
11 ASSERT(this->size() >= from.size());
12 ASSERT(offset <= this->size() - from.size());
13 memmove(reinterpret_cast<void*>(start() + offset), from.pointer(),
14 from.size());
15}
#define ASSERT(E)
Point offset

◆ end()

uword dart::MemoryRegion::end ( ) const
inline

Definition at line 34 of file memory_region.h.

34{ return start() + size_; }

◆ Extend()

void dart::MemoryRegion::Extend ( const MemoryRegion region,
uword  extra 
)
inline

Definition at line 71 of file memory_region.h.

71 {
72 pointer_ = region.pointer();
73 size_ = (region.size() + extra);
74 }
ClipOpAndAA opAA SkRegion region
Definition SkRecords.h:238

◆ Load()

template<typename T >
T dart::MemoryRegion::Load ( uword  offset) const
inline

Definition at line 37 of file memory_region.h.

37 {
38 return *ComputeInternalPointer<T>(offset);
39 }

◆ operator=()

MemoryRegion & dart::MemoryRegion::operator= ( const MemoryRegion other)
inline

Definition at line 23 of file memory_region.h.

23 {
24 pointer_ = other.pointer_;
25 size_ = other.size_;
26 return *this;
27 }

◆ pointer()

void * dart::MemoryRegion::pointer ( ) const
inline

Definition at line 29 of file memory_region.h.

29{ return pointer_; }

◆ PointerTo()

template<typename T >
T * dart::MemoryRegion::PointerTo ( uword  offset) const
inline

Definition at line 52 of file memory_region.h.

52 {
53 return ComputeInternalPointer<T>(offset);
54 }

◆ set_size()

void dart::MemoryRegion::set_size ( uword  new_size)
inline

Definition at line 31 of file memory_region.h.

31{ size_ = new_size; }

◆ size()

uword dart::MemoryRegion::size ( ) const
inline

Definition at line 30 of file memory_region.h.

30{ return size_; }

◆ start()

uword dart::MemoryRegion::start ( ) const
inline

Definition at line 33 of file memory_region.h.

33{ return reinterpret_cast<uword>(pointer_); }
uintptr_t uword
Definition globals.h:501

◆ Store()

template<typename T >
void dart::MemoryRegion::Store ( uword  offset,
T  value 
) const
inline

Definition at line 42 of file memory_region.h.

42 {
43 *ComputeInternalPointer<T>(offset) = value;
44 }
uint8_t value

◆ StoreUnaligned()

template<typename T >
void dart::MemoryRegion::StoreUnaligned ( uword  offset,
T  value 
) const
inline

Definition at line 47 of file memory_region.h.

47 {
48 dart::StoreUnaligned(ComputeInternalPointer<T>(offset), value);
49 }
static void StoreUnaligned(T *ptr, T value)
Definition unaligned.h:22

◆ Subregion()

void dart::MemoryRegion::Subregion ( const MemoryRegion from,
uword  offset,
uword  size 
)
inline

Definition at line 63 of file memory_region.h.

63 {
64 ASSERT(from.size() >= size);
65 ASSERT(offset <= (from.size() - size));
66 pointer_ = reinterpret_cast<void*>(from.start() + offset);
67 size_ = size;
68 }

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