// Returns a realtime period provided by `delegate`.
static TimeDelta GetRealtimePeriod(Delegate* delegate);
+#if defined(ENABLE_WRT_JS)
+ static void BlockThreading();
+ static void UnblockThreading();
+#endif
+
#if BUILDFLAG(IS_LINUX) || BUILDFLAG(IS_CHROMEOS)
// Toggles a specific thread's type at runtime. This can be used to
// change the priority of a thread in a different process and will fail
return nullptr;
}
+#if defined(ENABLE_WRT_JS)
+base::Lock threading_lock;
+#endif
+
bool CreateThread(size_t stack_size,
bool joinable,
PlatformThread::Delegate* delegate,
PlatformThreadHandle* thread_handle,
ThreadType thread_type,
MessagePumpType message_pump_type) {
+#if defined(ENABLE_WRT_JS)
+ base::AutoLock lock(threading_lock);
+#endif
DCHECK(thread_handle);
base::InitThreading();
CHECK_EQ(0, pthread_detach(thread_handle.platform_handle()));
}
+#if defined(ENABLE_WRT_JS)
+static bool is_acquired = false;
+
+// static
+void PlatformThread::BlockThreading() {
+ threading_lock.Acquire();
+ is_acquired = true;
+}
+
+// static
+void PlatformThread::UnblockThreading() {
+ if (is_acquired)
+ threading_lock.Release();
+ is_acquired = false;
+}
+#endif
+
// Mac and Fuchsia have their own SetCurrentThreadType() and
// GetCurrentThreadPriorityForTest() implementations.
#if !BUILDFLAG(IS_APPLE) && !BUILDFLAG(IS_FUCHSIA)
#include <tzplatform_config.h>
#include "base/logging.h"
-#include "base/threading/thread_id_name_manager.h"
#include "content/common/zygote/zygote_communication_linux.h"
#include "content/public/common/zygote/zygote_handle.h"
#include "tizen_src/chromium_impl/components/xwalk_extensions/browser/xwalk_extension_manager.h"
#include "base/command_line.h"
#include "base/files/file_util.h"
#include "base/logging.h"
+#include "base/threading/platform_thread.h"
#include "content/public/app/content_main.h"
#include "content/public/app/content_main_runner.h"
#include "content/public/common/content_switches.h"
const char* appid, const char* pkgid,
const char* pkg_type, void* user_data) {
LOG(INFO) << "loader prelaunch";
+ base::PlatformThread::BlockThreading();
auto* content_main = static_cast<Loader*>(user_data)->content_main_;
content_main->PrelaunchOnLoader(app_path, pkgid);
return 0;
const char* appid, const char* pkgid,
const char* pkg_type, void* user_data) {
LOG(INFO) << "loader launch";
+ base::PlatformThread::UnblockThreading();
return 0;
};
callback.terminate = [](int argc, char** argv, void* user_data) {