4 * Copyright (c) 2000 - 2013 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 extern int app_efl_main_flg;
47 #define MAX_PATH_LENGTH 256
48 #define MAX_STACK_DEPTH 128
49 #define TRIM_STACK_DEPTH 2
52 #define WIN_RENDER_POST 0
53 #define CONTROLBAR_RENDER_POST 1
54 #define NAVIFRAME_RENDER_POST 2
55 #define PAGER_RENDER_POST 3
56 #define RENDER_POST_COUNT 4
58 #define SNAPSHOT_WAIT_TIME_MAX 10000
61 #define ENABLE_INTERNAL_MALLOC 0x0001
62 #define ENABLE_SNAPSHOT 0x0002
64 #define LOG(FORMAT, ...) \
67 sprintf(buf, FORMAT, __VA_ARGS__); \
71 #define SCREENSHOT_LOCK() \
74 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
75 old = gTraceInfo.screenshot.state; \
76 gTraceInfo.screenshot.state = -1; \
77 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
79 if(isOptionEnabled(OPT_SNAPSHOT)) \
84 #define SCREENSHOT_UNLOCK() \
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 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
96 old = gTraceInfo.screenshot.state; \
97 if(gTraceInfo.screenshot.state >= 0) \
98 gTraceInfo.screenshot.state = 1; \
99 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
101 if(isOptionEnabled(OPT_SNAPSHOT)) \
106 #define SCREENSHOT_UNSET() \
108 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
109 if(gTraceInfo.screenshot.state >= 0) \
110 gTraceInfo.screenshot.state = 0; \
111 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
114 #define SCREENSHOT_DONE() \
117 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
118 old = gTraceInfo.screenshot.state; \
119 if(gTraceInfo.screenshot.state == 1) \
120 gTraceInfo.screenshot.state = 2; \
121 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
123 activateCaptureTimer(); \
127 #define SCREENSHOT_TIMEOUT() \
130 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
131 old = gTraceInfo.screenshot.state; \
132 if(gTraceInfo.screenshot.state == 2) \
133 gTraceInfo.screenshot.state = 0; \
134 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
136 if(isOptionEnabled(OPT_SNAPSHOT)) \
141 #define NUM_ORIGINAL_LIBRARY 9
148 LIBECORE_INPUT_EVAS = 3,
150 LIBCAPI_APPFW_APPLICATION = 5,
156 extern const char *lib_string[NUM_ORIGINAL_LIBRARY];
157 extern void *lib_handle[NUM_ORIGINAL_LIBRARY];
159 // type definition for global variable
163 pthread_mutex_t eventMutex;
169 pthread_mutex_t sockMutex;
181 pthread_mutex_t ssMutex;
195 __screenshotInfo screenshot;
199 int custom_chart_callback_count;
203 extern __traceInfo gTraceInfo;
205 int get_map_address(void* symbol, void** map_start, void** map_end);
206 char** da_backtrace_symbols (void* const* array, int size);
207 char** cached_backtrace_symbols (void* const* array, int size);
209 /* real malloc function pointer */
210 extern void *(*real_malloc)(size_t);
215 extern void reset_pid_tid();
218 int __profil(int mode);
221 void WcharToChar(char* pstrDest, const wchar_t* pwstrSrc);
222 char *absolutize_filepath(const char *fname, char *buf, size_t bufsiz);
224 /* returns the real absolute file path (resolves symlinks) */
225 char *real_abs_path(int fd, char *buffer, size_t bufsiz);
227 // screen capture functions
228 int initialize_screencapture();
229 int finalize_screencapture();
231 int activateCaptureTimer();
232 void _cb_render_post(void* data, Evas* e, void* eventinfo);
234 // event related functions
235 int initialize_event();
236 int finalize_event();
237 int getOrientation();
238 void on_orientation_changed(int angle, bool capi);
240 int remove_indir(const char* dirname);
243 #define isOptionEnabled(OPT) ((gTraceInfo.optionflag & OPT) != 0)
249 #endif // _DAHELPER_H_