1 // Copyright (c) 2013 Intel Corporation. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
5 #include "xwalk/extensions/extension_process/xwalk_extension_process_main.h"
12 #include "base/debug/stack_trace.h"
13 #include "base/logging.h"
14 #include "base/message_loop/message_loop.h"
15 #include "base/run_loop.h"
16 #include "base/threading/platform_thread.h"
17 #include "xwalk/extensions/extension_process/xwalk_extension_process.h"
19 int XWalkExtensionProcessMain(const content::MainFunctionParams& parameters) {
20 base::PlatformThread::SetName("XWalkExtensionProcess_Main");
22 VLOG(1) << "Extension process running!";
24 // FIXME(jeez): This fixes the zombie-process-on-^C issue that we are facing
25 // on Linux. However, we must find a cleaner way of doing this, perhaps using
26 // something from Chromium and ensuring this process dies when its parent die.
28 prctl(PR_SET_PDEATHSIG, SIGTERM);
31 // On Linux-based platforms, we want the Glib message pump running so we need
32 // a TYPE_UI MessageLoop. For other platforms we will stick with TYPE_DEFAULT
34 base::MessageLoop::Type message_loop_type;
36 message_loop_type = base::MessageLoop::TYPE_UI;
38 message_loop_type = base::MessageLoop::TYPE_DEFAULT;
41 base::MessageLoop main_message_loop(message_loop_type);
42 xwalk::extensions::XWalkExtensionProcess extension_process;
45 // In debug mode, enable to stack dumping in a similar fashion than Renderer
46 // Process. This is helpful to understand crashes in Extension Process.
47 base::debug::EnableInProcessStackDumping();
50 base::RunLoop run_loop;