00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013 #ifndef __SUPPORT_LOOPERPRV_H
00014 #define __SUPPORT_LOOPERPRV_H
00015
00016 #include <support/Looper.h>
00017
00018 #include <support/Debug.h>
00019 #include <support/ITextStream.h>
00020 #include <support/Locker.h>
00021 #include <support/Parcel.h>
00022 #include <support/Process.h>
00023 #include <support/StdIO.h>
00024 #include <support/TLS.h>
00025 #include <support/Value.h>
00026 #include <support/Vector.h>
00027
00028 #include <stdio.h>
00029 #include <stdlib.h>
00030 #include <string.h>
00031
00032
00033
00034
00035
00036 #ifdef BINDER_REFCOUNT_MSGS
00037 #undef BINDER_REFCOUNT_MSGS
00038 #endif
00039
00040 #define BINDER_REFCOUNT_MSGS 0
00041
00042 #ifdef BINDER_REFCOUNT_RESULT_MSGS
00043 #undef BINDER_REFCOUNT_RESULT_MSGS
00044 #endif
00045
00046 #define BINDER_REFCOUNT_RESULT_MSGS 0
00047
00048 #define BINDER_TRANSACTION_MSGS 0
00049 #define BINDER_BUFFER_MSGS 0
00050 #define BINDER_DEBUG_MSGS 0
00051
00052
00053
00054
00055
00056 #ifndef SUPPORTS_BINDER_IPC_PROFILING
00057 #if BUILD_TYPE == BUILD_TYPE_DEBUG
00058 #define SUPPORTS_BINDER_IPC_PROFILING 1
00059 #else
00060 #define SUPPORTS_BINDER_IPC_PROFILING 0
00061 #endif
00062 #endif
00063
00064 #if SUPPORTS_BINDER_IPC_PROFILING
00065
00066 #include "ProfileIPC.h"
00067
00068 #if _SUPPORTS_WARNING
00069 #warning Compiling for binder IPC profiling!
00070 #endif
00071
00072 #if _SUPPORTS_NAMESPACE
00073 namespace palmos {
00074 namespace support {
00075 #endif
00076
00077 struct binder_call_state : public ipc_call_state
00078 {
00079 binder_call_state();
00080 ~binder_call_state();
00081 };
00082
00083 void BeginBinderCall(ipc_call_state& state);
00084 void FinishBinderCall(ipc_call_state& state);
00085 void ResetBinderIPCProfile();
00086 void PrintBinderIPCProfile();
00087
00088 #define BINDER_IPC_PROFILE_STATE binder_call_state __ipc_profile_state__
00089 #define BEGIN_BINDER_CALL() BeginBinderCall(__ipc_profile_state__)
00090 #define FINISH_BINDER_CALL() FinishBinderCall(__ipc_profile_state__)
00091 #define RESET_BINDER_IPC_PROFILE() ResetBinderIPCProfile()
00092 #define PRINT_BINDER_IPC_PROFILE() PrintBinderIPCProfile()
00093
00094 extern char g_ipcProfileEnvVar[];
00095 extern BDebugCondition<g_ipcProfileEnvVar, 0, 0, 10000> g_profileLevel;
00096 extern char g_ipcProfileDumpPeriod[];
00097 extern BDebugInteger<g_ipcProfileDumpPeriod, 500, 0, 10000> g_profileDumpPeriod;
00098 extern char g_ipcProfileMaxItems[];
00099 extern BDebugInteger<g_ipcProfileMaxItems, 10, 1, 10000> g_profileMaxItems;
00100 extern char g_ipcProfileStackDepth[];
00101 extern BDebugInteger<g_ipcProfileStackDepth, B_CALLSTACK_DEPTH, 1, B_CALLSTACK_DEPTH> g_profileStackDepth;
00102 extern char g_ipcProfileSymbols[];
00103 extern BDebugInteger<g_ipcProfileSymbols, 1, 0, 1> g_profileSymbols;
00104
00105 #if _SUPPORTS_NAMESPACE
00106 } }
00107 #endif
00108
00109 #else
00110
00111 #define BINDER_IPC_PROFILE_STATE
00112 #define BEGIN_BINDER_CALL()
00113 #define FINISH_BINDER_CALL()
00114 #define RESET_BINDER_IPC_PROFILE()
00115 #define PRINT_BINDER_IPC_PROFILE()
00116
00117 #endif
00118
00119
00120
00121
00122
00123 enum {
00124 kSchedulingResumed = 0x00000001
00125 };
00126
00127 #if _SUPPORTS_NAMESPACE
00128 namespace palmos {
00129 namespace support {
00130 #endif
00131
00132 extern void __initialize_looper_platform(void);
00133 extern void __stop_looper_platform(void);
00134 extern void __terminate_looper_platform(void);
00135
00136
00137
00138
00139
00140 #if TARGET_HOST == TARGET_HOST_PALMOS
00141 #if BUILD_TYPE == BUILD_TYPE_DEBUG
00142 #include <AppMgrPrv.h>
00143 struct remote_host_info {
00144 int32_t processID;
00145 int32_t ref;
00146 int32_t target;
00147 int32_t namelen;
00148 char name[32];
00149 };
00150 extern SVector<remote_host_info> g_remoteHostInfo;
00151 #endif
00152 extern uint16_t g_weakPutQueue[4096];
00153 extern uint16_t g_strongPutQueue[4096];
00154 #endif
00155
00156
00157 extern SLocker* g_binderContextAccess;
00158 #if TARGET_HOST == TARGET_HOST_LINUX
00159 extern SLooper::ContextPermissionCheckFunc g_binderContextCheckFunc;
00160 #endif // #if TARGET_HOST == TARGET_HOST_LINUX
00161 extern void* g_binderContextUserData;
00162 struct context_entry
00163 {
00164 SContext context;
00165 sptr<IBinder> contextObject;
00166
00167 };
00168 extern SKeyedVector<SString, context_entry>* g_binderContext;
00169 extern SLocker* g_systemDirectoryLock;
00170 extern SString* g_systemDirectory;
00171
00172 #if _SUPPORTS_NAMESPACE
00173 } }
00174 #endif
00175
00176 #endif