clean-up libutils includes
moved Foo.h as first include of Foo.cpp, and removed redundant includes. Made NativeHandle non virtual. Test: run & compile Bug: n/a Change-Id: I37fa746cd42c9ba23aba181f84cb6c619386406a
This commit is contained in:
parent
6048d9db5f
commit
22dbf3947f
28 changed files with 53 additions and 137 deletions
|
@ -17,13 +17,10 @@
|
|||
#define LOG_TAG "BlobCache"
|
||||
//#define LOG_NDEBUG 0
|
||||
|
||||
#include <inttypes.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <utils/BlobCache.h>
|
||||
#include <utils/Errors.h>
|
||||
#include <utils/Log.h>
|
||||
#include <utils/Timers.h>
|
||||
|
||||
#include <inttypes.h>
|
||||
|
||||
#include <cutils/properties.h>
|
||||
|
||||
|
|
|
@ -16,9 +16,10 @@
|
|||
|
||||
#define LOG_TAG "CallStack"
|
||||
|
||||
#include <utils/CallStack.h>
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include <utils/CallStack.h>
|
||||
#include <utils/Printer.h>
|
||||
#include <utils/Errors.h>
|
||||
#include <utils/Log.h>
|
||||
|
|
|
@ -16,10 +16,9 @@
|
|||
|
||||
#define __STDC_LIMIT_MACROS
|
||||
|
||||
#include <assert.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <utils/LinearTransform.h>
|
||||
#include <assert.h>
|
||||
|
||||
|
||||
// disable sanitize as these functions may intentionally overflow (see comments below).
|
||||
// the ifdef can be removed when host builds use clang.
|
||||
|
|
|
@ -21,14 +21,14 @@
|
|||
|
||||
namespace android {
|
||||
|
||||
LogIfSlow::LogIfSlow(const char* tag, android_LogPriority priority,
|
||||
int timeoutMillis, const char* message) :
|
||||
mTag(tag), mPriority(priority), mTimeoutMillis(timeoutMillis), mMessage(message),
|
||||
mStart(systemTime(SYSTEM_TIME_BOOTTIME)) {
|
||||
LogIfSlow::LogIfSlow(
|
||||
const char* tag, android_LogPriority priority, int timeoutMillis, const char* message)
|
||||
: mTag(tag), mPriority(priority), mTimeoutMillis(timeoutMillis), mMessage(message),
|
||||
mStart(systemTime(SYSTEM_TIME_BOOTTIME)) {
|
||||
}
|
||||
|
||||
LogIfSlow::~LogIfSlow() {
|
||||
int durationMillis = nanoseconds_to_milliseconds(systemTime(SYSTEM_TIME_BOOTTIME) - mStart);
|
||||
int durationMillis = (int)nanoseconds_to_milliseconds(systemTime(SYSTEM_TIME_BOOTTIME) - mStart);
|
||||
if (durationMillis > mTimeoutMillis) {
|
||||
LOG_PRI(mPriority, mTag, "%s: %dms", mMessage, durationMillis);
|
||||
}
|
||||
|
|
|
@ -13,17 +13,8 @@
|
|||
// Debugs callback registration and invocation.
|
||||
#define DEBUG_CALLBACKS 0
|
||||
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <inttypes.h>
|
||||
#include <limits.h>
|
||||
#include <string.h>
|
||||
#include <sys/eventfd.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <log/log.h>
|
||||
#include <utils/Looper.h>
|
||||
#include <utils/Timers.h>
|
||||
#include <sys/eventfd.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
|
|
|
@ -19,14 +19,14 @@
|
|||
|
||||
namespace android {
|
||||
|
||||
sp<NativeHandle> NativeHandle::create(
|
||||
native_handle_t* handle, bool ownsHandle) {
|
||||
sp<NativeHandle> NativeHandle::create(native_handle_t* handle, bool ownsHandle) {
|
||||
return handle ? new NativeHandle(handle, ownsHandle) : NULL;
|
||||
}
|
||||
|
||||
NativeHandle::NativeHandle(native_handle_t* handle, bool ownsHandle)
|
||||
: mHandle(handle), mOwnsHandle(ownsHandle)
|
||||
{}
|
||||
: mHandle(handle), mOwnsHandle(ownsHandle) {
|
||||
|
||||
}
|
||||
|
||||
NativeHandle::~NativeHandle() {
|
||||
if (mOwnsHandle) {
|
||||
|
|
|
@ -21,10 +21,6 @@
|
|||
#include <utils/String8.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
/*
|
||||
|
|
|
@ -17,18 +17,11 @@
|
|||
#define LOG_TAG "ProcessCallStack"
|
||||
// #define LOG_NDEBUG 0
|
||||
|
||||
#include <dirent.h>
|
||||
#include <errno.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <memory>
|
||||
|
||||
#include <utils/Log.h>
|
||||
#include <utils/Errors.h>
|
||||
#include <utils/ProcessCallStack.h>
|
||||
#include <utils/Printer.h>
|
||||
|
||||
#include <limits.h>
|
||||
#include <dirent.h>
|
||||
|
||||
#include <utils/Printer.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
|
|
|
@ -16,11 +16,7 @@
|
|||
|
||||
#define LOG_TAG "PropertyMap"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <utils/PropertyMap.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
// Enables debug output for the parser.
|
||||
#define DEBUG_PARSER 0
|
||||
|
|
|
@ -17,18 +17,9 @@
|
|||
#define LOG_TAG "RefBase"
|
||||
// #define LOG_NDEBUG 0
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <utils/RefBase.h>
|
||||
|
||||
#include <utils/CallStack.h>
|
||||
#include <utils/Log.h>
|
||||
#include <utils/threads.h>
|
||||
|
||||
#ifndef __unused
|
||||
#define __unused __attribute__((__unused__))
|
||||
|
|
|
@ -16,13 +16,13 @@
|
|||
|
||||
#define LOG_TAG "sharedbuffer"
|
||||
|
||||
#include "SharedBuffer.h"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <log/log.h>
|
||||
|
||||
#include "SharedBuffer.h"
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
namespace android {
|
||||
|
|
|
@ -16,9 +16,7 @@
|
|||
|
||||
#define LOG_TAG "StopWatch"
|
||||
|
||||
#include <string.h>
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <utils/StopWatch.h>
|
||||
|
||||
/* for PRId64 */
|
||||
#ifndef __STDC_FORMAT_MACROS
|
||||
|
@ -27,8 +25,6 @@
|
|||
#include <inttypes.h>
|
||||
|
||||
#include <utils/Log.h>
|
||||
#include <utils/Errors.h>
|
||||
#include <utils/StopWatch.h>
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
|
@ -17,12 +17,6 @@
|
|||
#include <utils/String16.h>
|
||||
|
||||
#include <utils/Log.h>
|
||||
#include <utils/Unicode.h>
|
||||
#include <utils/threads.h>
|
||||
|
||||
#include <memory.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "SharedBuffer.h"
|
||||
|
||||
|
|
|
@ -21,11 +21,7 @@
|
|||
|
||||
#include <utils/Compat.h>
|
||||
#include <utils/Log.h>
|
||||
#include <utils/Unicode.h>
|
||||
#include <utils/String16.h>
|
||||
#include <utils/threads.h>
|
||||
|
||||
#include <ctype.h>
|
||||
|
||||
#include "SharedBuffer.h"
|
||||
|
||||
|
|
|
@ -19,17 +19,17 @@
|
|||
* System clock functions.
|
||||
*/
|
||||
|
||||
#define LOG_TAG "SystemClock"
|
||||
|
||||
#include <utils/SystemClock.h>
|
||||
|
||||
#include <sys/time.h>
|
||||
#include <limits.h>
|
||||
#include <fcntl.h>
|
||||
#include <string.h>
|
||||
#include <errno.h>
|
||||
|
||||
#include <cutils/compiler.h>
|
||||
#include <utils/SystemClock.h>
|
||||
#include <utils/Timers.h>
|
||||
|
||||
#define LOG_TAG "SystemClock"
|
||||
#include <utils/Timers.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
namespace android {
|
||||
|
|
|
@ -18,16 +18,10 @@
|
|||
#define LOG_TAG "libutils.threads"
|
||||
|
||||
#include <assert.h>
|
||||
#include <errno.h>
|
||||
#include <memory.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <unistd.h>
|
||||
#include <utils/Thread.h>
|
||||
#include <utils/AndroidThreads.h>
|
||||
|
||||
#if !defined(_WIN32)
|
||||
# include <pthread.h>
|
||||
# include <sched.h>
|
||||
# include <sys/resource.h>
|
||||
#else
|
||||
# include <windows.h>
|
||||
|
@ -40,7 +34,6 @@
|
|||
#include <sys/prctl.h>
|
||||
#endif
|
||||
|
||||
#include <utils/threads.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include <cutils/sched_policy.h>
|
||||
|
|
|
@ -20,7 +20,6 @@
|
|||
#include <utils/Timers.h>
|
||||
|
||||
#include <limits.h>
|
||||
#include <sys/time.h>
|
||||
#include <time.h>
|
||||
|
||||
#if defined(__ANDROID__)
|
||||
|
@ -53,7 +52,7 @@ nsecs_t systemTime(int /*clock*/)
|
|||
|
||||
int toMillisecondTimeoutDelay(nsecs_t referenceTime, nsecs_t timeoutTime)
|
||||
{
|
||||
int timeoutDelayMillis;
|
||||
nsecs_t timeoutDelayMillis;
|
||||
if (timeoutTime > referenceTime) {
|
||||
uint64_t timeoutDelay = uint64_t(timeoutTime - referenceTime);
|
||||
if (timeoutDelay > uint64_t((INT_MAX - 1) * 1000000LL)) {
|
||||
|
@ -64,5 +63,5 @@ int toMillisecondTimeoutDelay(nsecs_t referenceTime, nsecs_t timeoutTime)
|
|||
} else {
|
||||
timeoutDelayMillis = 0;
|
||||
}
|
||||
return timeoutDelayMillis;
|
||||
return (int)timeoutDelayMillis;
|
||||
}
|
||||
|
|
|
@ -16,14 +16,10 @@
|
|||
|
||||
#define LOG_TAG "Tokenizer"
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <utils/Tokenizer.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <utils/Log.h>
|
||||
#include <utils/Tokenizer.h>
|
||||
|
||||
// Enables debug output for the tokenizer.
|
||||
#define DEBUG_TOKENIZER 0
|
||||
|
|
|
@ -14,12 +14,11 @@
|
|||
* limitations under the License.
|
||||
*/
|
||||
|
||||
#include <utils/misc.h>
|
||||
#include <utils/Trace.h>
|
||||
#include <utils/misc.h>
|
||||
|
||||
static void traceInit() __attribute__((constructor));
|
||||
|
||||
static void traceInit()
|
||||
{
|
||||
static void traceInit() {
|
||||
::android::add_sysprop_change_callback(atrace_update_tags, 0);
|
||||
}
|
||||
|
|
|
@ -16,11 +16,10 @@
|
|||
|
||||
#define LOG_TAG "unicode"
|
||||
|
||||
#include <utils/Unicode.h>
|
||||
#include <limits.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include <log/log.h>
|
||||
#include <utils/Unicode.h>
|
||||
|
||||
#if defined(_WIN32)
|
||||
# undef nhtol
|
||||
|
|
|
@ -16,13 +16,13 @@
|
|||
|
||||
#define LOG_TAG "Vector"
|
||||
|
||||
#include <utils/VectorImpl.h>
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
#include <log/log.h>
|
||||
#include <utils/Errors.h>
|
||||
#include <utils/VectorImpl.h>
|
||||
|
||||
#include <safe_iop.h>
|
||||
|
||||
|
|
|
@ -19,10 +19,8 @@
|
|||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <utils/Flattenable.h>
|
||||
#include <utils/RefBase.h>
|
||||
#include <utils/SortedVector.h>
|
||||
#include <utils/threads.h>
|
||||
|
||||
namespace android {
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@ typedef struct native_handle native_handle_t;
|
|||
|
||||
namespace android {
|
||||
|
||||
class NativeHandle: public LightRefBase<NativeHandle> {
|
||||
class NativeHandle : public LightRefBase<NativeHandle> {
|
||||
public:
|
||||
// Create a refcounted wrapper around a native_handle_t, and declare
|
||||
// whether the wrapper owns the handle (so that it should clean up the
|
||||
|
@ -41,7 +41,7 @@ private:
|
|||
friend class LightRefBase<NativeHandle>;
|
||||
|
||||
NativeHandle(native_handle_t* handle, bool ownsHandle);
|
||||
virtual ~NativeHandle();
|
||||
~NativeHandle();
|
||||
|
||||
native_handle_t* mHandle;
|
||||
bool mOwnsHandle;
|
||||
|
|
|
@ -371,10 +371,8 @@ protected:
|
|||
|
||||
private:
|
||||
friend class ReferenceMover;
|
||||
inline static void renameRefs(size_t /*n*/,
|
||||
const ReferenceRenamer& /*renamer*/) { }
|
||||
inline static void renameRefId(T* /*ref*/,
|
||||
const void* /*old_id*/ , const void* /*new_id*/) { }
|
||||
inline static void renameRefs(size_t /*n*/, const ReferenceRenamer& /*renamer*/) { }
|
||||
inline static void renameRefId(T* /*ref*/, const void* /*old_id*/ , const void* /*new_id*/) { }
|
||||
|
||||
private:
|
||||
mutable std::atomic<int32_t> mCount;
|
||||
|
|
|
@ -18,9 +18,12 @@
|
|||
#define ANDROID_UTILS_SINGLETON_H
|
||||
|
||||
#include <stdint.h>
|
||||
|
||||
// some vendor code assumes they have atoi() after including this file.
|
||||
#include <stdlib.h>
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <utils/Mutex.h>
|
||||
#include <utils/threads.h>
|
||||
#include <cutils/compiler.h>
|
||||
|
||||
namespace android {
|
||||
|
|
|
@ -17,12 +17,6 @@
|
|||
#ifndef ANDROID_STRONG_POINTER_H
|
||||
#define ANDROID_STRONG_POINTER_H
|
||||
|
||||
#include <cutils/atomic.h>
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/types.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
namespace android {
|
||||
|
||||
|
|
|
@ -19,16 +19,8 @@
|
|||
|
||||
#if defined(__ANDROID__)
|
||||
|
||||
#include <fcntl.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/types.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include <cutils/compiler.h>
|
||||
#include <utils/threads.h>
|
||||
#include <cutils/trace.h>
|
||||
|
||||
// See <cutils/trace.h> for more ATRACE_* macros.
|
||||
|
@ -37,6 +29,7 @@
|
|||
#define _PASTE(x, y) x ## y
|
||||
#define PASTE(x, y) _PASTE(x,y)
|
||||
#define ATRACE_NAME(name) android::ScopedTrace PASTE(___tracer, __LINE__) (ATRACE_TAG, name)
|
||||
|
||||
// ATRACE_CALL is an ATRACE_NAME that uses the current function name.
|
||||
#define ATRACE_CALL() ATRACE_NAME(__FUNCTION__)
|
||||
|
||||
|
@ -44,14 +37,13 @@ namespace android {
|
|||
|
||||
class ScopedTrace {
|
||||
public:
|
||||
inline ScopedTrace(uint64_t tag, const char* name)
|
||||
: mTag(tag) {
|
||||
atrace_begin(mTag,name);
|
||||
}
|
||||
inline ScopedTrace(uint64_t tag, const char* name) : mTag(tag) {
|
||||
atrace_begin(mTag, name);
|
||||
}
|
||||
|
||||
inline ~ScopedTrace() {
|
||||
atrace_end(mTag);
|
||||
}
|
||||
inline ~ScopedTrace() {
|
||||
atrace_end(mTag);
|
||||
}
|
||||
|
||||
private:
|
||||
uint64_t mTag;
|
||||
|
|
|
@ -22,12 +22,7 @@
|
|||
#include <utils/misc.h>
|
||||
#include <utils/Log.h>
|
||||
|
||||
#include <sys/stat.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#if !defined(_WIN32)
|
||||
# include <pthread.h>
|
||||
#endif
|
||||
|
||||
#include <utils/Vector.h>
|
||||
|
|
Loading…
Reference in a new issue