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 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 gTraceInfo.screenshot.state = 1; \
88 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
91 #define SCREENSHOT_SET() \
94 LOG("screenshot_set : %d, %s\n", gTraceInfo.screenshot.state, __func__); \
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 LOG("screenshot_unset : %d, %s\n", gTraceInfo.screenshot.state, __func__); \
109 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
110 if(gTraceInfo.screenshot.state >= 0) \
111 gTraceInfo.screenshot.state = 0; \
112 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
115 #define SCREENSHOT_DONE() \
118 LOG("screenshot_done : %d, %s\n", gTraceInfo.screenshot.state, __func__); \
119 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
120 old = gTraceInfo.screenshot.state; \
121 if(gTraceInfo.screenshot.state == 1) \
122 gTraceInfo.screenshot.state = 2; \
123 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
125 activateCaptureTimer(); \
129 #define SCREENSHOT_TIMEOUT() \
132 LOG("screenshot_timeout : %d, %s\n", gTraceInfo.screenshot.state, __func__); \
133 pthread_mutex_lock(&(gTraceInfo.screenshot.ssMutex)); \
134 old = gTraceInfo.screenshot.state; \
135 if(gTraceInfo.screenshot.state == 2) \
136 gTraceInfo.screenshot.state = 0; \
137 pthread_mutex_unlock(&(gTraceInfo.screenshot.ssMutex)); \
139 if(isOptionEnabled(OPT_SNAPSHOT)) \
144 #define NUM_ORIGINAL_LIBRARY 9
154 LIBECORE_INPUT_EVAS = 6,
156 LIBCAPI_APPFW_APPLICATION = 8
159 extern char *lib_string[NUM_ORIGINAL_LIBRARY];
160 extern void *lib_handle[NUM_ORIGINAL_LIBRARY];
162 // type definition for global variable
166 pthread_mutex_t eventMutex;
172 pthread_mutex_t sockMutex;
178 unsigned int startTime;
184 pthread_mutex_t ssMutex;
198 __screenshotInfo screenshot;
202 int custom_chart_callback_count;
203 unsigned long optionflag;
206 extern __traceInfo gTraceInfo;
208 int get_map_address(void* symbol, void** map_start, void** map_end);
209 char** da_backtrace_symbols (void* const* array, int size);
210 char** cached_backtrace_symbols (void* const* array, int size);
213 int __profil(int mode);
216 void WcharToChar(char* pstrDest, const wchar_t* pwstrSrc);
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 orientationEnabled();
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_