#define ENABLE_TIZEN_GET_EXTERNAL_RESOURCES_IN_MHTML_FROM_NETWORK 1 /* Praveen(praveen.ks@samsung.com) : Allow external resources in MHTML file to be fetched from network rather than failing them */
+#define ENABLE_TIZEN_MAIN_THREAD_SCHEDULE_DISCARD_DUPLICATE_REQUEST 1 /* Jihye Kang(jye.kang@samsung.com) : Fix lockup while doing stress test for filewriter */
+
#endif /* OS(TIZEN) */
/* ==== OS() - underlying operating system; only to be used for mandated low-level services like
#include "config.h"
#include "MainThread.h"
+#include "Threading.h"
#include <Ecore.h>
#include <wtf/OwnPtr.h>
#include <wtf/PassOwnPtr.h>
return pipeObject;
}
+#if ENABLE(TIZEN_MAIN_THREAD_SCHEDULE_DISCARD_DUPLICATE_REQUEST)
+static Mutex& scheduleRequestedMutex()
+{
+ DEFINE_STATIC_LOCAL(Mutex, staticMutex, ());
+ return staticMutex;
+}
+
+static bool& scheduleRequested()
+{
+ DEFINE_STATIC_LOCAL(bool, staticScheduleRequested, ());
+ return staticScheduleRequested;
+}
+#endif
+
static void monitorDispatchFunctions(void*, void*, unsigned int)
{
+#if ENABLE(TIZEN_MAIN_THREAD_SCHEDULE_DISCARD_DUPLICATE_REQUEST)
+ {
+ MutexLocker locker(scheduleRequestedMutex());
+ scheduleRequested() = false;
+ }
+#endif
dispatchFunctionsFromMainThread();
}
void scheduleDispatchFunctionsOnMainThread()
{
+#if ENABLE(TIZEN_MAIN_THREAD_SCHEDULE_DISCARD_DUPLICATE_REQUEST)
+ {
+ MutexLocker locker(scheduleRequestedMutex());
+ if (scheduleRequested())
+ return;
+ scheduleRequested() = true;
+ }
+
+ Eina_Bool result = false;
+ while (!result) {
+ result = ecore_pipe_write(pipeObject().get(), "", 0);
+ if (!result) {
+ TIZEN_LOGE("Failed to write shceduleDispatchFunction pipe message");
+ pipeObject() = adoptPtr(ecore_pipe_add(monitorDispatchFunctions, 0));
+ }
+ }
+#else
ecore_pipe_write(pipeObject().get(), "", 0);
+#endif
}
}