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 #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 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
73 old = gTraceInfo.screenshot.state; \
74 gTraceInfo.screenshot.state = -1; \
75 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
77 if(isOptionEnabled(OPT_SNAPSHOT)) \
82 #define SCREENSHOT_UNLOCK() \
84 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
85 if(gTraceInfo.screenshot.state < 0) \
86 gTraceInfo.screenshot.state = 1; \
87 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
90 #define SCREENSHOT_SET() \
93 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
94 old = gTraceInfo.screenshot.state; \
95 if(gTraceInfo.screenshot.state >= 0) \
96 gTraceInfo.screenshot.state = 1; \
97 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
99 if(isOptionEnabled(OPT_SNAPSHOT)) \
104 #define SCREENSHOT_UNSET() \
106 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
107 if(gTraceInfo.screenshot.state >= 0) \
108 gTraceInfo.screenshot.state = 0; \
109 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
112 #define SCREENSHOT_DONE() \
115 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
116 old = gTraceInfo.screenshot.state; \
117 if(gTraceInfo.screenshot.state == 1) \
118 gTraceInfo.screenshot.state = 2; \
119 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
121 activateCaptureTimer(); \
125 #define SCREENSHOT_TIMEOUT() \
128 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
129 old = gTraceInfo.screenshot.state; \
130 if(gTraceInfo.screenshot.state == 2) \
131 gTraceInfo.screenshot.state = 0; \
132 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
134 if(isOptionEnabled(OPT_SNAPSHOT)) \
139 #define NUM_ORIGINAL_LIBRARY 12
149 LIBECORE_INPUT_EVAS = 6,
151 LIBCAPI_APPFW_APPLICATION = 8,
157 extern const char *lib_string[NUM_ORIGINAL_LIBRARY];
158 extern void *lib_handle[NUM_ORIGINAL_LIBRARY];
160 // type definition for global variable
164 pthread_mutex_t eventMutex;
170 pthread_mutex_t sockMutex;
182 pthread_mutex_t ssMutex;
196 __screenshotInfo screenshot;
200 int custom_chart_callback_count;
201 unsigned long optionflag;
204 extern __traceInfo gTraceInfo;
206 int get_map_address(void* symbol, void** map_start, void** map_end);
207 char** da_backtrace_symbols (void* const* array, int size);
208 char** cached_backtrace_symbols (void* const* array, int size);
211 int __profil(int mode);
214 void WcharToChar(char* pstrDest, const wchar_t* pwstrSrc);
216 void application_exit();
218 // screen capture functions
219 int initialize_screencapture();
220 int finalize_screencapture();
222 int activateCaptureTimer();
223 void _cb_render_post(void* data, Evas* e, void* eventinfo);
225 // event related functions
226 int initialize_event();
227 int finalize_event();
228 int getOrientation();
229 void on_orientation_changed(int angle, bool capi);
231 int remove_indir(const char* dirname);
234 #define isOptionEnabled(OPT) ((gTraceInfo.optionflag & OPT) != 0)
240 #endif // _DAHELPER_H_