Flutter Engine
The Flutter Engine
Public Member Functions | Static Public Member Functions | List of all members
ToolUtils::TopoTestNode Class Reference

#include <ToolUtils.h>

Inheritance diagram for ToolUtils::TopoTestNode:
SkRefCnt SkRefCntBase

Public Member Functions

 TopoTestNode (int id)
 
void dependsOn (TopoTestNode *src)
 
void targets (uint32_t target)
 
int id () const
 
void reset ()
 
uint32_t outputPos () const
 
bool check ()
 
 SK_DECLARE_INTERNAL_LLIST_INTERFACE (TopoTestNode)
 
- Public Member Functions inherited from SkRefCntBase
 SkRefCntBase ()
 
virtual ~SkRefCntBase ()
 
bool unique () const
 
void ref () const
 
void unref () const
 

Static Public Member Functions

static void SetTempMark (TopoTestNode *node)
 
static void ResetTempMark (TopoTestNode *node)
 
static bool IsTempMarked (TopoTestNode *node)
 
static void Output (TopoTestNode *node, uint32_t outputPos)
 
static bool WasOutput (TopoTestNode *node)
 
static uint32_t GetIndex (TopoTestNode *node)
 
static int NumDependencies (TopoTestNode *node)
 
static TopoTestNodeDependency (TopoTestNode *node, int index)
 
static int NumTargets (TopoTestNode *node)
 
static uint32_t GetTarget (TopoTestNode *node, int i)
 
static uint32_t GetID (TopoTestNode *node)
 
static void AllocNodes (skia_private::TArray< sk_sp< ToolUtils::TopoTestNode > > *graph, int num)
 
static void Shuffle (SkSpan< sk_sp< TopoTestNode > > graph, SkRandom *rand)
 

Detailed Description

Definition at line 171 of file ToolUtils.h.

Constructor & Destructor Documentation

◆ TopoTestNode()

ToolUtils::TopoTestNode::TopoTestNode ( int  id)
inline

Definition at line 173 of file ToolUtils.h.

173: fID(id) {}

Member Function Documentation

◆ AllocNodes()

static void ToolUtils::TopoTestNode::AllocNodes ( skia_private::TArray< sk_sp< ToolUtils::TopoTestNode > > *  graph,
int  num 
)
inlinestatic

Definition at line 229 of file ToolUtils.h.

229 {
230 graph->reserve_exact(graph->size() + num);
231
232 for (int i = 0; i < num; ++i) {
234 }
235 }
int size() const
Definition: SkTArray.h:421
void reserve_exact(int n)
Definition: SkTArray.h:181

◆ check()

bool ToolUtils::TopoTestNode::check ( )
inline

Definition at line 191 of file ToolUtils.h.

191 {
192 if (!fWasOutput) {
193 return false;
194 }
195
196 for (int i = 0; i < fDependencies.size(); ++i) {
197 if (!fDependencies[i]->fWasOutput) {
198 return false;
199 }
200 // This node should've been output after all the nodes on which it depends
201 if (fOutputPos < fDependencies[i]->outputPos()) {
202 return false;
203 }
204 }
205
206 return true;
207 }
uint32_t outputPos() const
Definition: ToolUtils.h:185

◆ Dependency()

static TopoTestNode * ToolUtils::TopoTestNode::Dependency ( TopoTestNode node,
int  index 
)
inlinestatic

Definition at line 221 of file ToolUtils.h.

221 {
222 return node->fDependencies[index];
223 }

◆ dependsOn()

void ToolUtils::TopoTestNode::dependsOn ( TopoTestNode src)
inline

Definition at line 175 of file ToolUtils.h.

175{ *fDependencies.append() = src; }

◆ GetID()

static uint32_t ToolUtils::TopoTestNode::GetID ( TopoTestNode node)
inlinestatic

Definition at line 226 of file ToolUtils.h.

226{ return node->id(); }

◆ GetIndex()

static uint32_t ToolUtils::TopoTestNode::GetIndex ( TopoTestNode node)
inlinestatic

Definition at line 219 of file ToolUtils.h.

219{ return node->outputPos(); }

◆ GetTarget()

static uint32_t ToolUtils::TopoTestNode::GetTarget ( TopoTestNode node,
int  i 
)
inlinestatic

Definition at line 225 of file ToolUtils.h.

225{ return node->fTargets[i]; }

◆ id()

int ToolUtils::TopoTestNode::id ( ) const
inline

Definition at line 178 of file ToolUtils.h.

178{ return fID; }

◆ IsTempMarked()

static bool ToolUtils::TopoTestNode::IsTempMarked ( TopoTestNode node)
inlinestatic

Definition at line 212 of file ToolUtils.h.

212{ return node->fTempMark; }

◆ NumDependencies()

static int ToolUtils::TopoTestNode::NumDependencies ( TopoTestNode node)
inlinestatic

Definition at line 220 of file ToolUtils.h.

220{ return node->fDependencies.size(); }

◆ NumTargets()

static int ToolUtils::TopoTestNode::NumTargets ( TopoTestNode node)
inlinestatic

Definition at line 224 of file ToolUtils.h.

224{ return node->fTargets.size(); }

◆ Output()

static void ToolUtils::TopoTestNode::Output ( TopoTestNode node,
uint32_t  outputPos 
)
inlinestatic

Definition at line 213 of file ToolUtils.h.

213 {
214 SkASSERT(!node->fWasOutput);
215 node->fOutputPos = outputPos;
216 node->fWasOutput = true;
217 }
#define SkASSERT(cond)
Definition: SkAssert.h:116

◆ outputPos()

uint32_t ToolUtils::TopoTestNode::outputPos ( ) const
inline

Definition at line 185 of file ToolUtils.h.

185 {
186 SkASSERT(fWasOutput);
187 return fOutputPos;
188 }

◆ reset()

void ToolUtils::TopoTestNode::reset ( )
inline

Definition at line 179 of file ToolUtils.h.

179 {
180 fOutputPos = 0;
181 fTempMark = false;
182 fWasOutput = false;
183 }

◆ ResetTempMark()

static void ToolUtils::TopoTestNode::ResetTempMark ( TopoTestNode node)
inlinestatic

Definition at line 211 of file ToolUtils.h.

211{ node->fTempMark = false; }

◆ SetTempMark()

static void ToolUtils::TopoTestNode::SetTempMark ( TopoTestNode node)
inlinestatic

Definition at line 210 of file ToolUtils.h.

210{ node->fTempMark = true; }

◆ Shuffle()

static void ToolUtils::TopoTestNode::Shuffle ( SkSpan< sk_sp< TopoTestNode > >  graph,
SkRandom rand 
)
inlinestatic

Definition at line 247 of file ToolUtils.h.

247 {
248 for (size_t i = graph.size() - 1; i > 0; --i) {
249 int swap = rand->nextU() % (i + 1);
250
251 graph[i].swap(graph[swap]);
252 }
253 }
void swap(sk_sp< T > &a, sk_sp< T > &b)
Definition: SkRefCnt.h:341
uint32_t nextU()
Definition: SkRandom.h:42
constexpr size_t size() const
Definition: SkSpan_impl.h:95

◆ SK_DECLARE_INTERNAL_LLIST_INTERFACE()

ToolUtils::TopoTestNode::SK_DECLARE_INTERNAL_LLIST_INTERFACE ( TopoTestNode  )

◆ targets()

void ToolUtils::TopoTestNode::targets ( uint32_t  target)
inline

Definition at line 176 of file ToolUtils.h.

176{ *fTargets.append() = target; }
T * append()
Definition: SkTDArray.h:191
uint32_t * target

◆ WasOutput()

static bool ToolUtils::TopoTestNode::WasOutput ( TopoTestNode node)
inlinestatic

Definition at line 218 of file ToolUtils.h.

218{ return node->fWasOutput; }

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