class NodeProperties

Defined at line 102 of file ../../src/sysmem/server/node_properties.h

The NodeProperties are properties that are not specific to whether the node is presently a

live BufferCollectionToken, live BufferCollection, or just a raw non-live NodeProperties in

orphaned_constraints_.

This struct stays allocated as a BufferCollectionToken changes into a BufferCollection. The

node pointer is updated during that conversion, as the TreeNode interface is implemented by

BufferCollectionToken and BufferCollection separately.

Things that can change when transmuting from BufferCollectionToken to BufferCollection, from

BufferCollectionToken to OrphanedNode, or from BufferCollection to OrphanedNode, should generally

go in Node. Things that don't change when transmuting go in NodeProperties.

Public Methods

void ~NodeProperties ()

Defined at line 28 of file ../../src/sysmem/server/node_properties.cc

std::unique_ptr<NodeProperties> NewRoot (LogicalBufferCollection * logical_buffer_collection, const ClientDebugInfo * client_debug_info)

These are the only ways for client code to create a new NodeProperties. These enforce that

NodeProperties are to be lifetime-managed using std::unique_ptr

<NodeProperties

>. This is part

of preserving linkages from child NodeProperties to parent NodeProperties using a

NodeProperties*, since the child Node existing doesn't keep the parent alive.

Defined at line 40 of file ../../src/sysmem/server/node_properties.cc

NodeProperties * NewChild (LogicalBufferCollection * logical_buffer_collection)

The returned NodeProperties is already linked into the tree, and owned by the tree, so this

method just returns a raw pointer so we can inform the Node of its NodeProperties.

Defined at line 56 of file ../../src/sysmem/server/node_properties.cc

std::unique_ptr<NodeProperties> NewTemporary (LogicalBufferCollection * logical_buffer_collection, fuchsia_sysmem2::BufferCollectionConstraints buffer_collection_constraints, std::string debug_name)

Only for LogicalBufferCollection to use for temporary internal constraints. We still enforce

that all instances of NodeProperties are managed by std::unique_ptr

<NodeProperties

> for

consistency.

Defined at line 95 of file ../../src/sysmem/server/node_properties.cc

void NodeProperties (const NodeProperties & to_copy)

We keep pointers to NodeProperties around, so no copying or moving.

Defined at line 105 of file ../../src/sysmem/server/node_properties.h

void NodeProperties (NodeProperties && to_move)

Defined at line 106 of file ../../src/sysmem/server/node_properties.h

void RemoveFromTreeAndDelete ()

Remove this NodeProperties from the tree by unlinking this NodeProperties from its parent,

which in turn will delete this NodeProperties, and also delete the corresponding Node.

This call requires that this NodeProperties has zero children.

Defined at line 111 of file ../../src/sysmem/server/node_properties.cc

std::vector<NodeProperties *> BreadthFirstOrder (fit::function<NodeFilterResult (const NodeProperties &)> node_filter)

With default parameters, this returns a list of all the TreeNodeLinkage(s) starting at this

node as root, in breadth-first order, which can be used to Fail() all the nodes including this

node, by working from the back to the front of the list. This breadth-first order is generated

without stack recursion, and Fail() from back to front of the returned vector also doesn't

involve stack recursion.

If a node_filter is provided, and returns false for a given node, that node and the children of

that node are skipped.

The default node_filter matches all nodes.

Defined at line 138 of file ../../src/sysmem/server/node_properties.cc

std::vector<NodeProperties *> DepthFirstPreOrder (fit::function<NodeFilterResult (const NodeProperties &)> node_filter)

Defined at line 170 of file ../../src/sysmem/server/node_properties.cc

bool is_token ()

Even if the associated Node is currently an OrphanedNode, one of these three will return true,

and the other two will return false, depending on what type of Node was originally associated

with this NodeProperties. There is intentionally no accessor for is_orphaned_node(), because

OrphanedNode isn't a logical node type, it's just a Node sub-class that "handles" protocol and

connection lifetime aspects for a channel that's already been Close()ed and channel-closed.

The original/logical node type is what matters for the more abstract NodeProperties tree and

associated LogicalBufferCollection processing of the logical tree.

Defined at line 182 of file ../../src/sysmem/server/node_properties.h

bool is_token_group ()

Defined at line 183 of file ../../src/sysmem/server/node_properties.h

bool is_collection ()

Defined at line 184 of file ../../src/sysmem/server/node_properties.h

bool is_weak ()

Defined at line 202 of file ../../src/sysmem/server/node_properties.h

bool is_weak_ok_for_child_nodes_also ()

Defined at line 203 of file ../../src/sysmem/server/node_properties.h

NodeProperties * parent ()

Defined at line 203 of file ../../src/sysmem/server/node_properties.cc

bool is_weak_ok_from_parent ()

Defined at line 206 of file ../../src/sysmem/server/node_properties.h

Node * node ()

Defined at line 208 of file ../../src/sysmem/server/node_properties.cc

bool is_weak_ok ()

Defined at line 209 of file ../../src/sysmem/server/node_properties.h

uint32_t child_count ()

Defined at line 213 of file ../../src/sysmem/server/node_properties.cc

NodeProperties & child (uint32_t which)

Defined at line 215 of file ../../src/sysmem/server/node_properties.cc

ClientDebugInfo & client_debug_info ()

Defined at line 217 of file ../../src/sysmem/server/node_properties.cc

const ClientDebugInfo & client_debug_info ()

Defined at line 219 of file ../../src/sysmem/server/node_properties.cc

uint32_t & rights_attenuation_mask ()

Defined at line 221 of file ../../src/sysmem/server/node_properties.cc

ErrorPropagationMode & error_propagation_mode ()

Defined at line 223 of file ../../src/sysmem/server/node_properties.cc

zx::unowned<zx::event> node_ref ()

Defined at line 225 of file ../../src/sysmem/server/node_properties.h

const ErrorPropagationMode & error_propagation_mode ()

Defined at line 225 of file ../../src/sysmem/server/node_properties.cc

zx_koid_t node_ref_koid ()

Defined at line 226 of file ../../src/sysmem/server/node_properties.h

bool is_marked ()

Defined at line 228 of file ../../src/sysmem/server/node_properties.h

bool buffers_logically_allocated ()

Defined at line 229 of file ../../src/sysmem/server/node_properties.cc

void set_marked (bool is_marked)

Defined at line 229 of file ../../src/sysmem/server/node_properties.h

void SetBuffersLogicallyAllocated ()

Defined at line 231 of file ../../src/sysmem/server/node_properties.cc

bool has_constraints ()

BufferCollectionToken never has constraints yet, so returns nullptr.

BufferCollection may have constraints.

OrphanedConstraints may have constraints.

Defined at line 236 of file ../../src/sysmem/server/node_properties.cc

const fuchsia_sysmem2::BufferCollectionConstraints * buffer_collection_constraints ()

Defined at line 238 of file ../../src/sysmem/server/node_properties.cc

const std::optional<fuchsia_sysmem2::SingleBufferSettings> & must_match_settings ()

Defined at line 246 of file ../../src/sysmem/server/node_properties.cc

bool SetMustMatchVmo (zx::vmo must_match_vmo)

Defined at line 251 of file ../../src/sysmem/server/node_properties.cc

void SetBufferCollectionConstraints (fuchsia_sysmem2::BufferCollectionConstraints buffer_collection_constraints)

Defined at line 297 of file ../../src/sysmem/server/node_properties.cc

void SetNode (fbl::RefPtr<Node> node)

Defined at line 303 of file ../../src/sysmem/server/node_properties.cc

void SetWhichChild (uint32_t which_child)

Only used on NodeConstraints corresponding to a BufferCollectionTokenGroup.

During attempted constraints aggregation, only the which_child child is aggregated.

Required: which_child

<

child_count().

Defined at line 325 of file ../../src/sysmem/server/node_properties.cc

void ResetWhichChild ()

Set which_child() back to nullopt.

Defined at line 330 of file ../../src/sysmem/server/node_properties.cc

std::optional<uint32_t> which_child ()

Defined at line 332 of file ../../src/sysmem/server/node_properties.cc

bool visible ()

This means "this" is visible given group child selections at the moment. The visible/hidden

status remains consistent with the current which_child() setting of each group (even when

SetWhichChild() has just changed which_child()).

Defined at line 334 of file ../../src/sysmem/server/node_properties.cc

void SetWeak ()

Defined at line 355 of file ../../src/sysmem/server/node_properties.cc

void SetWeakOk (bool for_child_nodes_also)

Defined at line 363 of file ../../src/sysmem/server/node_properties.cc

bool AttachNodeTracking (zx::eventpair server_end)

Defined at line 370 of file ../../src/sysmem/server/node_properties.cc

uint32_t node_count ()

These counts are for the current NodeProperties + any current children (direct and indirect) of

the current NodeProperties. For LogicalBufferCollection::root_, these counts are for the whole

tree.

TODO(https://fxbug.dev/42150808): Limit node_count() of root_, but instead of failing root_

when limit reached, prune a sub-tree selected to prefer more-nested over less nested, and

larger node count over smaller node count (lexicographically).

Defined at line 397 of file ../../src/sysmem/server/node_properties.cc

uint32_t connected_client_count ()

Defined at line 399 of file ../../src/sysmem/server/node_properties.cc

uint32_t buffer_collection_count ()

Defined at line 401 of file ../../src/sysmem/server/node_properties.cc

uint32_t buffer_collection_token_count ()

Defined at line 403 of file ../../src/sysmem/server/node_properties.cc

void LogInfo (Location location, const char * format)

Defined at line 407 of file ../../src/sysmem/server/node_properties.cc

void LogError (Location location, const char * format)

Defined at line 414 of file ../../src/sysmem/server/node_properties.cc

void LogConstraints (Location location)

For debugging.

Defined at line 421 of file ../../src/sysmem/server/node_properties.cc

const char * node_type_name ()

Defined at line 429 of file ../../src/sysmem/server/node_properties.cc

ConnectionVersion connection_version ()

Defined at line 431 of file ../../src/sysmem/server/node_properties.cc

Friends

class LogicalBufferCollection