Skip to content

I20200129-0935

@eCemetery eCemetery tagged this 29 Jan 09:03
The CSS Engine calls
RegistryCSSPropertyHandlerProvider#getCSSPropertyHandlers for each
element and style
property during application of theme styles. The resulting collection is
normally empty or has one property handler. The method created an
ArrayList for each call, which is wasting resources.

With this change an empty list is used as long as no handler has to be
returned. When the first handler is added a singleton list is returned.
These singleton lists are cached as the amount of property handlers is
limited.

When a second handler is added, an ArrayList is instantiated and this
and further handlers added to it.

The same optimization is applied for
AbstractCSSEngine#applyStyleDeclaration. Also here 'handlers2' is
usually empty or contains 1 handler.

As a result, invocations of these method won't produce garbage.

Change-Id: I11da2e55fe451799499c2f70725ddee5308f3273
Signed-off-by: Karsten Thoms <karsten.thoms@itemis.de>
Assets 2
Loading