4d8501c1f9689c833d38c9087df28b971a6ebe42 |
|
21-Dec-2015 |
Alex Vakulenko <avakulenko@google.com> |
libbrillo: Remove RTTI from the library The main reason why we needed run-time type information is so that we can get a type name string for a particular type T. This string was used in type comparisons in brillo::Any as the only reliable way of determining if two Any instances have values of the same type. For this typeid(T).name() was used which requires RTTI to be enabled. However using RTTI causes issues when linking to libraries with RTTI disabled. To resolve this issue, stop relying on RTTI in libbrillo and throughout the rest of Brillo code. A special work-around was implemented to obtain a type name for a given type, which relies on the fact that __PRETTY_FUNCTION__ macro on GCC/clang includes the full signature of a method, including any template parameters. For example, brillo::GetTypeTag<double>() would return const char *brillo::GetTypeTag() [T = double] and extracting the type name ("double") is just a matter of simple string manipulations. To speed up the code at run-time, we don't really need to extract the type name from this function name when comparing two types, but rather compare the two function names directly. This function name with embedded type is called "type tag" in the code. Unfortunately GCC and CLANG handle __PRETTY_FUNCTION__ differently for certain template types, so added #error statement to force compiling using clang only (since this is the compiler used most often for Brillo targets). BUG: 26292405 Change-Id: Ie70012b62f66911ee7787e5cf7eeab88359bd959
/external/libbrillo/brillo/any.h
|
fed60b0c640828b320f56293c8bebc43fd2b1da8 |
|
27-Oct-2015 |
Alex Vakulenko <avakulenko@google.com> |
Rename "libchromeos" into "libbrillo" Renamed libchromeos[-.*] libraries into libbrillo-... BUG: 24872993 Change-Id: Ibab1623b6a08a55cae3662e941d0d6644ff14df4
/external/libbrillo/brillo/any.h
|
8d6301aa107d64d92bb0257ded486591391bfe41 |
|
23-Oct-2015 |
Alex Vakulenko <avakulenko@google.com> |
Remove Any::GetType() and rely on type name when comparing types std::type_info::operator==() uses pointers to type names on some implementations (e.g. gcc with __GXX_MERGED_TYPEINFO_NAMES defined). This leads to problems such that types created in different translation units could be treated as different even though they refer to the same type. Working with type_info directly seems unreliable and names of the types should be used in comparisons directly. Fixed the implementation of Any::IsTypeCompatible<T>() to use type names and remove Any::GetType() to avoid any future problems for client code to compare the type information manually. Added Any::GetTypeName() and Any::GetUndecoratedTypeName() for convenience. BUG: 25132472 Change-Id: I8ba27a611c8edad2260dbed1c2f15633c8b3a3fe
/external/libbrillo/brillo/any.h
|
9ed0cab99f18acb3570a35e9408f24355f6b8324 |
|
13-Oct-2015 |
Alex Vakulenko <avakulenko@google.com> |
Move chromeos symbols into brillo namespace And move the include files into "brillo" directory instead of "chromeos" BUG: 24872993 TEST=built aosp and brillo and unit tests pass on dragonoboard Change-Id: Ieb979d1ebd3152921d36cd15acbd6247f02aae69
/external/libbrillo/brillo/any.h
|