4 * Copyright (c) 2000 - 2011 Samsung Electronics Co., Ltd. All rights reserved.
8 * Jaewon Lim <jaewon81.lim@samsung.com>
9 * Woojin Jung <woojin2.jung@samsung.com>
10 * Juyoung Kim <j0.kim@samsung.com>
12 * This library is free software; you can redistribute it and/or modify it under
13 * the terms of the GNU Lesser General Public License as published by the
14 * Free Software Foundation; either version 2.1 of the License, or (at your option)
17 * This library is distributed in the hope that it will be useful, but WITHOUT ANY
18 * WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
20 * License for more details.
22 * You should have received a copy of the GNU Lesser General Public License
23 * along with this library; if not, write to the Free Software Foundation, Inc., 51
24 * Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
35 #include <pthread.h> // for pthread_mutex_t
45 #define MAX_PATH_LENGTH 256
46 #define MAX_STACK_DEPTH 128
47 #define TRIM_STACK_DEPTH 2
50 #define WIN_RENDER_POST 0
51 #define CONTROLBAR_RENDER_POST 1
52 #define NAVIFRAME_RENDER_POST 2
53 #define PAGER_RENDER_POST 3
54 #define RENDER_POST_COUNT 4
56 #define SNAPSHOT_WAIT_TIME_MAX 10000
59 #define ENABLE_INTERNAL_MALLOC 0x0001
60 #define ENABLE_SNAPSHOT 0x0002
62 #define LOG(FORMAT, ...) \
65 sprintf(buf, FORMAT, __VA_ARGS__); \
69 #define SCREENSHOT_LOCK() \
72 LOG("screenshot_lock : %d, %s\n", gTraceInfo.screenshot.state, __func__); \
73 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
74 old = gTraceInfo.screenshot.state; \
75 gTraceInfo.screenshot.state = -1; \
76 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
78 if(isOptionEnabled(OPT_SNAPSHOT)) \
83 #define SCREENSHOT_UNLOCK() \
85 LOG("screenshot_unlock : %d, %s\n", gTraceInfo.screenshot.state, __func__); \
86 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
87 if(gTraceInfo.screenshot.state < 0) \
88 gTraceInfo.screenshot.state = 1; \
89 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
92 #define SCREENSHOT_SET() \
95 LOG("screenshot_set : %d, %s\n", gTraceInfo.screenshot.state, __func__); \
96 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
97 old = gTraceInfo.screenshot.state; \
98 if(gTraceInfo.screenshot.state >= 0) \
99 gTraceInfo.screenshot.state = 1; \
100 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
102 if(isOptionEnabled(OPT_SNAPSHOT)) \
107 #define SCREENSHOT_UNSET() \
109 LOG("screenshot_unset : %d, %s\n", gTraceInfo.screenshot.state, __func__); \
110 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
111 if(gTraceInfo.screenshot.state >= 0) \
112 gTraceInfo.screenshot.state = 0; \
113 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
116 #define SCREENSHOT_DONE() \
119 LOG("screenshot_done : %d, %s\n", gTraceInfo.screenshot.state, __func__); \
120 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
121 old = gTraceInfo.screenshot.state; \
122 if(gTraceInfo.screenshot.state == 1) \
123 gTraceInfo.screenshot.state = 2; \
124 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
126 activateCaptureTimer(); \
130 #define SCREENSHOT_TIMEOUT() \
133 LOG("screenshot_timeout : %d, %s\n", gTraceInfo.screenshot.state, __func__); \
134 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
135 old = gTraceInfo.screenshot.state; \
136 if(gTraceInfo.screenshot.state == 2) \
137 gTraceInfo.screenshot.state = 0; \
138 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
140 if(isOptionEnabled(OPT_SNAPSHOT)) \
145 #define NUM_ORIGINAL_LIBRARY 9
155 LIBECORE_INPUT_EVAS = 6,
157 LIBCAPI_APPFW_APPLICATION = 8
160 extern char *lib_string[NUM_ORIGINAL_LIBRARY];
161 extern void *lib_handle[NUM_ORIGINAL_LIBRARY];
163 // type definition for global variable
167 pthread_mutex_t eventMutex;
173 pthread_mutex_t sockMutex;
179 unsigned int startTime;
185 pthread_mutex_t ssMutex;
199 __screenshotInfo screenshot;
203 int custom_chart_callback_count;
204 unsigned long optionflag;
207 extern __traceInfo gTraceInfo;
209 int get_map_address(void* symbol, void** map_start, void** map_end);
210 char** da_backtrace_symbols (void* const* array, int size);
211 char** cached_backtrace_symbols (void* const* array, int size);
214 int __profil(int mode);
217 void WcharToChar(char* pstrDest, const wchar_t* pwstrSrc);
219 // screen capture functions
220 int initialize_screencapture();
221 int finalize_screencapture();
223 int activateCaptureTimer();
224 void _cb_render_post(void* data, Evas* e, void* eventinfo);
226 // event related functions
227 int initialize_event();
228 int finalize_event();
229 int getOrientation();
230 void on_orientation_changed(int angle, bool capi);
232 int remove_indir(const char* dirname);
235 #define isOptionEnabled(OPT) ((gTraceInfo.optionflag & OPT) != 0)
241 #endif // _DAHELPER_H_