|
This patch:
* Introduces an AtspiInterface enumeration with all possible AT-SPI
interfaces and an AtspiInterfaces collection (using EnumBitSet), and
changes the return type of Accessible::GetInterfaces() to
AtspiInterfaces. The new, compact storage format allows the collection
of interfaces to be cached. Interfaces will be queried even more often
with the upcoming polymorphic NUIViewAccessible. Thus, it makes sense to
introduce such an optimization, and checking whether a bit is set in a
4-byte bitmask is significantly cheaper than performing a series of
dynamic_cast's every time GetInterfaces() is called. Such calculation is
only performed once by a new virtual method, DoGetInterfaces().
* Adds a new static method Accessible::GetInterfaceName() which converts
an AtspiInterface value to a string identifier used in DBus
communication, which allows to remove most of the macro definitions in
accessibility-common.h.
* Adds some missing operators to Accessibility::BitSet and EnumBitSet.
* Introduces a template type resolver AtspiInterfaceType which converts
an AtspiInterface value to a native C++ type, and adds
Accessible::DownCast() which uses this helper to check both the return
value of GetInterfaces() and the result of dynamic_cast. This double
checking is required by the upcoming NUIViewAccessible. As a possible
optimization, dynamic_cast could be changed to static_cast for release
builds in the future (which should be safe as long as DoGetInterfaces()
is implemented correctly).
* Adds a new template method FindCurrentObjectWithInterface() to
BridgeBase in order to centralize previously duplicated error return
logic in implementations of FindSelf() in various Bridge classes, which
differed only in the target type and interface name to be reported in
the error DBus reply.
* Adds a new virtual method Accessible::DoGetInterfaces() which allows
any derived classes to customize (specifically, narrow down) the set of
interfaces visible to DBus callers (and FindCurrentObjectWithInterface()
respects that). This is the first step towards allowing NUI controls to
freely implement AT-SPI interfaces (currently they have to choose from a
small predefined set of NUIViewAccessible-derived classes due to the use
of dynamic_cast).
Change-Id: I14428ec20693a9b121d40ac1b12b6e30c709d313
|