azul_webrender

Module intern

Source
Expand description

The interning module provides a generic data structure interning container. It is similar in concept to a traditional string interning container, but it is specialized to the WR thread model.

There is an Interner structure, that lives in the scene builder thread, and a DataStore structure that lives in the frame builder thread.

Hashing, interning and handle creation is done by the interner structure during scene building.

Delta changes for the interner are pushed during a transaction to the frame builder. The frame builder is then able to access the content of the interned handles quickly, via array indexing.

Epoch tracking ensures that the garbage collection step which the interner uses to remove items is only invoked on items that the frame builder thread is no longer referencing.

Items in the data store are stored in a traditional free-list structure, for content access and memory usage efficiency.

The epoch is incremented each time a scene is built. The most recently used scene epoch is stored inside each handle. This is then used for cache invalidation.

Structs§

  • The data store lives in the frame builder thread. It contains a free-list of items for fast access.
  • The main interning data structure. This lives in the scene builder thread, and handles hashing and interning unique data structures. It also manages a free-list for the items in the data store, which is synchronized via an update list of additions / removals.
  • Memory report for interning-related data structures. cbindgen:derive-eq=false cbindgen:derive-ostream=false
  • A globally, unique identifier
  • A list of updates to be applied to the data store, provided by the interning structure.

Traits§