Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
ui::AXTreeUpdateState Struct Reference

Public Member Functions

 AXTreeUpdateState (const AXTree &tree)
 
bool IsRemovedNode (const AXNode *node) const
 
bool IsCreatedNode (AXNode::AXID node_id) const
 
bool IsCreatedNode (const AXNode *node) const
 
bool IsReparentedNode (const AXNode *node) const
 
bool DoesPendingNodeRequireInit (AXNode::AXID node_id) const
 
std::optional< AXNode::AXIDGetParentIdForPendingNode (AXNode::AXID node_id)
 
bool ShouldPendingNodeExistInTree (AXNode::AXID node_id)
 
const AXNodeDataGetLastKnownPendingNodeData (AXNode::AXID node_id) const
 
void ClearLastKnownPendingNodeData (AXNode::AXID node_id)
 
void SetLastKnownPendingNodeData (const AXNodeData *node_data)
 
int32_t GetPendingDestroySubtreeCount (AXNode::AXID node_id) const
 
bool IncrementPendingDestroySubtreeCount (AXNode::AXID node_id)
 
void DecrementPendingDestroySubtreeCount (AXNode::AXID node_id)
 
int32_t GetPendingDestroyNodeCount (AXNode::AXID node_id) const
 
bool IncrementPendingDestroyNodeCount (AXNode::AXID node_id)
 
void DecrementPendingDestroyNodeCount (AXNode::AXID node_id)
 
int32_t GetPendingCreateNodeCount (AXNode::AXID node_id) const
 
bool IncrementPendingCreateNodeCount (AXNode::AXID node_id, std::optional< AXNode::AXID > parent_node_id)
 
void DecrementPendingCreateNodeCount (AXNode::AXID node_id)
 
bool InvalidatesUnignoredCachedValues (AXNode::AXID node_id)
 
void InvalidateParentNodeUnignoredCacheValues (AXNode::AXID node_id)
 

Public Attributes

AXTreePendingStructureStatus pending_update_status
 
std::optional< AXNode::AXIDpending_root_id
 
bool root_will_be_created
 
std::set< AXNode::AXIDpending_nodes
 
std::set< AXNode::AXIDinvalidate_unignored_cached_values_ids
 
std::set< AXNode::AXIDnode_data_changed_ids
 
std::set< AXNode::AXIDnew_node_ids
 
std::set< AXNode::AXIDremoved_node_ids
 
std::map< AXNode::AXID, std::unique_ptr< PendingStructureChanges > > node_id_to_pending_data
 
std::map< AXNode::AXID, AXNodeDataold_node_id_to_data
 
std::optional< AXTreeDataold_tree_data
 

Detailed Description

Definition at line 248 of file ax_tree.cc.

Constructor & Destructor Documentation

◆ AXTreeUpdateState()

ui::AXTreeUpdateState::AXTreeUpdateState ( const AXTree tree)
inlineexplicit

Definition at line 249 of file ax_tree.cc.

Member Function Documentation

◆ ClearLastKnownPendingNodeData()

void ui::AXTreeUpdateState::ClearLastKnownPendingNodeData ( AXNode::AXID  node_id)
inline

Definition at line 343 of file ax_tree.cc.

343 {
345 BASE_LOG() << "This method should only be called while computing "
346 "pending changes, "
347 "before updates are made to the tree.";
349 }
350 GetOrCreatePendingStructureChanges(node_id)->last_known_data = nullptr;
351 }
const AXNodeData * last_known_data
Definition ax_tree.cc:231
#define BASE_UNREACHABLE()
Definition logging.h:69
#define BASE_LOG()
Definition logging.h:54

◆ DecrementPendingCreateNodeCount()

void ui::AXTreeUpdateState::DecrementPendingCreateNodeCount ( AXNode::AXID  node_id)
inline

Definition at line 502 of file ax_tree.cc.

502 {
504 BASE_LOG()
505 << "This method should not be called before pending changes have "
506 "finished computing.";
508 }
509 if (PendingStructureChanges* data = GetPendingStructureChanges(node_id)) {
510 BASE_DCHECK(data->create_node_count > 0);
511 --data->create_node_count;
512 }
513 }
DEF_SWITCHES_START aot vmservice shared library Name of the *so containing AOT compiled Dart assets for launching the service isolate vm snapshot data
Definition switches.h:41
#define BASE_DCHECK(condition)
Definition logging.h:63

◆ DecrementPendingDestroyNodeCount()

void ui::AXTreeUpdateState::DecrementPendingDestroyNodeCount ( AXNode::AXID  node_id)
inline

Definition at line 451 of file ax_tree.cc.

451 {
453 BASE_LOG()
454 << "This method should not be called before pending changes have "
455 "finished computing.";
457 }
458 if (PendingStructureChanges* data = GetPendingStructureChanges(node_id)) {
459 BASE_DCHECK(data->destroy_node_count > 0);
460 --data->destroy_node_count;
461 }
462 }

◆ DecrementPendingDestroySubtreeCount()

void ui::AXTreeUpdateState::DecrementPendingDestroySubtreeCount ( AXNode::AXID  node_id)
inline

Definition at line 399 of file ax_tree.cc.

399 {
401 BASE_LOG()
402 << "This method should not be called before pending changes have "
403 "finished computing.";
405 }
406 if (PendingStructureChanges* data = GetPendingStructureChanges(node_id)) {
407 BASE_DCHECK(data->destroy_subtree_count > 0);
408 --data->destroy_subtree_count;
409 }
410 }

◆ DoesPendingNodeRequireInit()

bool ui::AXTreeUpdateState::DoesPendingNodeRequireInit ( AXNode::AXID  node_id) const
inline

Definition at line 292 of file ax_tree.cc.

292 {
294 BASE_LOG() << "This method should only be called while computing "
295 "pending changes, "
296 "before updates are made to the tree.";
298 }
299 PendingStructureChanges* data = GetPendingStructureChanges(node_id);
300 return data && data->DoesNodeRequireInit();
301 }

◆ GetLastKnownPendingNodeData()

const AXNodeData & ui::AXTreeUpdateState::GetLastKnownPendingNodeData ( AXNode::AXID  node_id) const
inline

Definition at line 329 of file ax_tree.cc.

329 {
331 BASE_LOG() << "This method should only be called while computing "
332 "pending changes, "
333 "before updates are made to the tree.";
335 }
336 static base::NoDestructor<ui::AXNodeData> empty_data;
337 PendingStructureChanges* data = GetPendingStructureChanges(node_id);
338 return (data && data->last_known_data) ? *data->last_known_data
339 : *empty_data;
340 }

◆ GetParentIdForPendingNode()

std::optional< AXNode::AXID > ui::AXTreeUpdateState::GetParentIdForPendingNode ( AXNode::AXID  node_id)
inline

Definition at line 304 of file ax_tree.cc.

304 {
306 BASE_LOG() << "This method should only be called while computing "
307 "pending changes, "
308 "before updates are made to the tree.";
310 }
311 PendingStructureChanges* data = GetOrCreatePendingStructureChanges(node_id);
312 BASE_DCHECK(!data->parent_node_id ||
313 ShouldPendingNodeExistInTree(*data->parent_node_id));
314 return data->parent_node_id;
315 }
bool ShouldPendingNodeExistInTree(AXNode::AXID node_id)
Definition ax_tree.cc:318

◆ GetPendingCreateNodeCount()

int32_t ui::AXTreeUpdateState::GetPendingCreateNodeCount ( AXNode::AXID  node_id) const
inline

Definition at line 466 of file ax_tree.cc.

466 {
468 BASE_LOG()
469 << "This method should not be called before pending changes have "
470 "finished computing.";
472 }
473 if (PendingStructureChanges* data = GetPendingStructureChanges(node_id))
474 return data->create_node_count;
475 return 0;
476 }

◆ GetPendingDestroyNodeCount()

int32_t ui::AXTreeUpdateState::GetPendingDestroyNodeCount ( AXNode::AXID  node_id) const
inline

Definition at line 414 of file ax_tree.cc.

414 {
416 BASE_LOG()
417 << "This method should not be called before pending changes have "
418 "finished computing.";
420 }
421 if (PendingStructureChanges* data = GetPendingStructureChanges(node_id))
422 return data->destroy_node_count;
423 return 0;
424 }

◆ GetPendingDestroySubtreeCount()

int32_t ui::AXTreeUpdateState::GetPendingDestroySubtreeCount ( AXNode::AXID  node_id) const
inline

Definition at line 367 of file ax_tree.cc.

367 {
369 BASE_LOG()
370 << "This method should not be called before pending changes have "
371 "finished computing.";
373 }
374 if (PendingStructureChanges* data = GetPendingStructureChanges(node_id))
375 return data->destroy_subtree_count;
376 return 0;
377 }

◆ IncrementPendingCreateNodeCount()

bool ui::AXTreeUpdateState::IncrementPendingCreateNodeCount ( AXNode::AXID  node_id,
std::optional< AXNode::AXID parent_node_id 
)
inline

Definition at line 481 of file ax_tree.cc.

483 {
485 BASE_LOG() << "This method should only be called while computing "
486 "pending changes, "
487 "before updates are made to the tree.";
489 }
490 PendingStructureChanges* data = GetOrCreatePendingStructureChanges(node_id);
491 if (data->node_exists)
492 return false;
493
494 ++data->create_node_count;
495 data->node_exists = true;
496 data->parent_node_id = parent_node_id;
497 return true;
498 }

◆ IncrementPendingDestroyNodeCount()

bool ui::AXTreeUpdateState::IncrementPendingDestroyNodeCount ( AXNode::AXID  node_id)
inline

Definition at line 429 of file ax_tree.cc.

429 {
431 BASE_LOG() << "This method should only be called while computing "
432 "pending changes, "
433 "before updates are made to the tree.";
435 }
436 PendingStructureChanges* data = GetOrCreatePendingStructureChanges(node_id);
437 if (!data->node_exists)
438 return false;
439
440 ++data->destroy_node_count;
441 data->node_exists = false;
442 data->last_known_data = nullptr;
443 data->parent_node_id = std::nullopt;
444 if (pending_root_id == node_id)
445 pending_root_id = std::nullopt;
446 return true;
447 }
std::optional< AXNode::AXID > pending_root_id
Definition ax_tree.cc:543

◆ IncrementPendingDestroySubtreeCount()

bool ui::AXTreeUpdateState::IncrementPendingDestroySubtreeCount ( AXNode::AXID  node_id)
inline

Definition at line 382 of file ax_tree.cc.

382 {
384 BASE_LOG() << "This method should only be called while computing "
385 "pending changes, "
386 "before updates are made to the tree.";
388 }
389 PendingStructureChanges* data = GetOrCreatePendingStructureChanges(node_id);
390 if (!data->node_exists)
391 return false;
392
393 ++data->destroy_subtree_count;
394 return true;
395 }

◆ InvalidateParentNodeUnignoredCacheValues()

void ui::AXTreeUpdateState::InvalidateParentNodeUnignoredCacheValues ( AXNode::AXID  node_id)
inline

Definition at line 523 of file ax_tree.cc.

523 {
525 BASE_LOG() << "This method should only be called while computing "
526 "pending changes, "
527 "before updates are made to the tree.";
529 }
530 std::optional<AXNode::AXID> parent_node_id =
532 if (parent_node_id) {
533 invalidate_unignored_cached_values_ids.insert(*parent_node_id);
534 }
535 }
std::optional< AXNode::AXID > GetParentIdForPendingNode(AXNode::AXID node_id)
Definition ax_tree.cc:304
std::set< AXNode::AXID > invalidate_unignored_cached_values_ids
Definition ax_tree.cc:559

◆ InvalidatesUnignoredCachedValues()

bool ui::AXTreeUpdateState::InvalidatesUnignoredCachedValues ( AXNode::AXID  node_id)
inline

Definition at line 517 of file ax_tree.cc.

517 {
519 }
bool Contains(const Container &container, const Value &value)

◆ IsCreatedNode() [1/2]

bool ui::AXTreeUpdateState::IsCreatedNode ( AXNode::AXID  node_id) const
inline

Definition at line 260 of file ax_tree.cc.

260 {
261 return base::Contains(new_node_ids, node_id);
262 }
std::set< AXNode::AXID > new_node_ids
Definition ax_tree.cc:565

◆ IsCreatedNode() [2/2]

bool ui::AXTreeUpdateState::IsCreatedNode ( const AXNode node) const
inline

Definition at line 265 of file ax_tree.cc.

265 {
266 return IsCreatedNode(node->id());
267 }
bool IsCreatedNode(AXNode::AXID node_id) const
Definition ax_tree.cc:260

◆ IsRemovedNode()

bool ui::AXTreeUpdateState::IsRemovedNode ( const AXNode node) const
inline

Definition at line 255 of file ax_tree.cc.

255 {
256 return base::Contains(removed_node_ids, node->id());
257 }
std::set< AXNode::AXID > removed_node_ids
Definition ax_tree.cc:572

◆ IsReparentedNode()

bool ui::AXTreeUpdateState::IsReparentedNode ( const AXNode node) const
inline

Definition at line 270 of file ax_tree.cc.

270 {
272 BASE_LOG()
273 << "This method should not be called before pending changes have "
274 "finished computing.";
276 }
277 PendingStructureChanges* data = GetPendingStructureChanges(node->id());
278 if (!data)
279 return false;
280 // In order to know if the node will be reparented during the update,
281 // we check if either the node will be destroyed or has been destroyed at
282 // least once during the update.
283 // Since this method is only allowed to be called after calculating all
284 // pending structure changes, |node_exists| tells us if the node should
285 // exist after all updates have been applied.
286 return (data->DoesNodeExpectNodeWillBeDestroyed() || IsRemovedNode(node)) &&
287 data->node_exists;
288 }
bool IsRemovedNode(const AXNode *node) const
Definition ax_tree.cc:255

◆ SetLastKnownPendingNodeData()

void ui::AXTreeUpdateState::SetLastKnownPendingNodeData ( const AXNodeData node_data)
inline

Definition at line 354 of file ax_tree.cc.

354 {
356 BASE_LOG() << "This method should only be called while computing "
357 "pending changes, "
358 "before updates are made to the tree.";
360 }
361 GetOrCreatePendingStructureChanges(node_data->id)->last_known_data =
362 node_data;
363 }

◆ ShouldPendingNodeExistInTree()

bool ui::AXTreeUpdateState::ShouldPendingNodeExistInTree ( AXNode::AXID  node_id)
inline

Definition at line 318 of file ax_tree.cc.

318 {
320 BASE_LOG() << "This method should only be called while computing "
321 "pending changes, "
322 "before updates are made to the tree.";
324 }
325 return GetOrCreatePendingStructureChanges(node_id)->node_exists;
326 }

Member Data Documentation

◆ invalidate_unignored_cached_values_ids

std::set<AXNode::AXID> ui::AXTreeUpdateState::invalidate_unignored_cached_values_ids

Definition at line 559 of file ax_tree.cc.

◆ new_node_ids

std::set<AXNode::AXID> ui::AXTreeUpdateState::new_node_ids

Definition at line 565 of file ax_tree.cc.

◆ node_data_changed_ids

std::set<AXNode::AXID> ui::AXTreeUpdateState::node_data_changed_ids

Definition at line 562 of file ax_tree.cc.

◆ node_id_to_pending_data

std::map<AXNode::AXID, std::unique_ptr<PendingStructureChanges> > ui::AXTreeUpdateState::node_id_to_pending_data

Definition at line 576 of file ax_tree.cc.

◆ old_node_id_to_data

std::map<AXNode::AXID, AXNodeData> ui::AXTreeUpdateState::old_node_id_to_data

Definition at line 580 of file ax_tree.cc.

◆ old_tree_data

std::optional<AXTreeData> ui::AXTreeUpdateState::old_tree_data

Definition at line 584 of file ax_tree.cc.

◆ pending_nodes

std::set<AXNode::AXID> ui::AXTreeUpdateState::pending_nodes

Definition at line 555 of file ax_tree.cc.

◆ pending_root_id

std::optional<AXNode::AXID> ui::AXTreeUpdateState::pending_root_id

Definition at line 543 of file ax_tree.cc.

◆ pending_update_status

AXTreePendingStructureStatus ui::AXTreeUpdateState::pending_update_status

Definition at line 539 of file ax_tree.cc.

◆ removed_node_ids

std::set<AXNode::AXID> ui::AXTreeUpdateState::removed_node_ids

Definition at line 572 of file ax_tree.cc.

◆ root_will_be_created

bool ui::AXTreeUpdateState::root_will_be_created

Definition at line 549 of file ax_tree.cc.


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