Loading include/private/ui/SharedState.h +5 −12 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <stdint.h> #include <sys/types.h> #include <utils/Debug.h> #include <utils/threads.h> namespace android { Loading Loading @@ -140,19 +141,11 @@ struct surface_flinger_cblk_t // 4KB max // --------------------------------------------------------------------------- template<bool> struct CTA; template<> struct CTA<true> { }; // compile-time assertions. just to avoid catastrophes. inline void compile_time_asserts() { CTA<sizeof(layer_cblk_t) == 128> sizeof__layer_cblk_t__eq_128; (void)sizeof__layer_cblk_t__eq_128; // we don't want a warning CTA<sizeof(per_client_cblk_t) <= 4096> sizeof__per_client_cblk_t__le_4096; (void)sizeof__per_client_cblk_t__le_4096; // we don't want a warning CTA<sizeof(surface_flinger_cblk_t) <= 4096> sizeof__surface_flinger_cblk_t__le_4096; (void)sizeof__surface_flinger_cblk_t__le_4096; // we don't want a warning } COMPILE_TIME_ASSERT(sizeof(layer_cblk_t) == 128) COMPILE_TIME_ASSERT(sizeof(per_client_cblk_t) <= 4096) COMPILE_TIME_ASSERT(sizeof(surface_flinger_cblk_t) <= 4096) // --------------------------------------------------------------------------- }; // namespace android #endif // ANDROID_UI_SHARED_STATE_H Loading include/utils/Debug.h +27 −4 Original line number Diff line number Diff line Loading @@ -14,10 +14,6 @@ * limitations under the License. */ // // Debugging tools. These should be able to be stripped // in release builds. // #ifndef ANDROID_DEBUG_H #define ANDROID_DEBUG_H Loading @@ -25,9 +21,30 @@ #include <sys/types.h> namespace android { // --------------------------------------------------------------------------- #ifdef __cplusplus template<bool> struct CompileTimeAssert; template<> struct CompileTimeAssert<true> {}; #define COMPILE_TIME_ASSERT(_exp) \ template class CompileTimeAssert< (_exp) >; #endif // --------------------------------------------------------------------------- #ifdef __cplusplus template<bool C, typename LSH, typename RHS> struct CompileTimeIfElse; template<typename LHS, typename RHS> struct CompileTimeIfElse<true, LHS, RHS> { typedef LHS TYPE; }; template<typename LHS, typename RHS> struct CompileTimeIfElse<false, LHS, RHS> { typedef RHS TYPE; }; #endif // --------------------------------------------------------------------------- #ifdef __cplusplus extern "C" { #endif const char* stringForIndent(int32_t indentLevel); Loading @@ -35,11 +52,17 @@ typedef void (*debugPrintFunc)(void* cookie, const char* txt); void printTypeCode(uint32_t typeCode, debugPrintFunc func = 0, void* cookie = 0); void printHexData(int32_t indent, const void *buf, size_t length, size_t bytesPerLine=16, int32_t singleLineBytesCutoff=16, size_t alignment=0, bool cArrayStyle=false, debugPrintFunc func = 0, void* cookie = 0); #ifdef __cplusplus } #endif // --------------------------------------------------------------------------- }; // namespace android #endif // ANDROID_DEBUG_H Loading
include/private/ui/SharedState.h +5 −12 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ #include <stdint.h> #include <sys/types.h> #include <utils/Debug.h> #include <utils/threads.h> namespace android { Loading Loading @@ -140,19 +141,11 @@ struct surface_flinger_cblk_t // 4KB max // --------------------------------------------------------------------------- template<bool> struct CTA; template<> struct CTA<true> { }; // compile-time assertions. just to avoid catastrophes. inline void compile_time_asserts() { CTA<sizeof(layer_cblk_t) == 128> sizeof__layer_cblk_t__eq_128; (void)sizeof__layer_cblk_t__eq_128; // we don't want a warning CTA<sizeof(per_client_cblk_t) <= 4096> sizeof__per_client_cblk_t__le_4096; (void)sizeof__per_client_cblk_t__le_4096; // we don't want a warning CTA<sizeof(surface_flinger_cblk_t) <= 4096> sizeof__surface_flinger_cblk_t__le_4096; (void)sizeof__surface_flinger_cblk_t__le_4096; // we don't want a warning } COMPILE_TIME_ASSERT(sizeof(layer_cblk_t) == 128) COMPILE_TIME_ASSERT(sizeof(per_client_cblk_t) <= 4096) COMPILE_TIME_ASSERT(sizeof(surface_flinger_cblk_t) <= 4096) // --------------------------------------------------------------------------- }; // namespace android #endif // ANDROID_UI_SHARED_STATE_H Loading
include/utils/Debug.h +27 −4 Original line number Diff line number Diff line Loading @@ -14,10 +14,6 @@ * limitations under the License. */ // // Debugging tools. These should be able to be stripped // in release builds. // #ifndef ANDROID_DEBUG_H #define ANDROID_DEBUG_H Loading @@ -25,9 +21,30 @@ #include <sys/types.h> namespace android { // --------------------------------------------------------------------------- #ifdef __cplusplus template<bool> struct CompileTimeAssert; template<> struct CompileTimeAssert<true> {}; #define COMPILE_TIME_ASSERT(_exp) \ template class CompileTimeAssert< (_exp) >; #endif // --------------------------------------------------------------------------- #ifdef __cplusplus template<bool C, typename LSH, typename RHS> struct CompileTimeIfElse; template<typename LHS, typename RHS> struct CompileTimeIfElse<true, LHS, RHS> { typedef LHS TYPE; }; template<typename LHS, typename RHS> struct CompileTimeIfElse<false, LHS, RHS> { typedef RHS TYPE; }; #endif // --------------------------------------------------------------------------- #ifdef __cplusplus extern "C" { #endif const char* stringForIndent(int32_t indentLevel); Loading @@ -35,11 +52,17 @@ typedef void (*debugPrintFunc)(void* cookie, const char* txt); void printTypeCode(uint32_t typeCode, debugPrintFunc func = 0, void* cookie = 0); void printHexData(int32_t indent, const void *buf, size_t length, size_t bytesPerLine=16, int32_t singleLineBytesCutoff=16, size_t alignment=0, bool cArrayStyle=false, debugPrintFunc func = 0, void* cookie = 0); #ifdef __cplusplus } #endif // --------------------------------------------------------------------------- }; // namespace android #endif // ANDROID_DEBUG_H