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"
11 #include "base/message_loop/message_pump_glib.h"
14 #include "base/debug/stack_trace.h"
15 #include "base/logging.h"
16 #include "base/message_loop/message_loop.h"
17 #include "base/run_loop.h"
18 #include "base/threading/platform_thread.h"
19 #include "xwalk/extensions/extension_process/xwalk_extension_process.h"
21 int XWalkExtensionProcessMain(const content::MainFunctionParams& parameters) {
22 base::PlatformThread::SetName("XWalkExtensionProcess_Main");
24 VLOG(1) << "Extension process running!";
27 // FIXME(jeez): This fixes the zombie-process-on-^C issue that we are facing
28 // on Linux. However, we must find a cleaner way of doing this, perhaps using
29 // something from Chromium and ensuring this process dies when its parent die.
30 prctl(PR_SET_PDEATHSIG, SIGTERM);
32 // On Linux-based platforms, we want the Glib message pump running so we force
33 // it by declaring it explicitly. For other platforms we will stick with
34 // TYPE_DEFAULT for now.
35 base::MessageLoop main_message_loop(
36 make_scoped_ptr<base::MessagePump>(new base::MessagePumpGlib()));
38 base::MessageLoop main_message_loop(base::MessageLoop::TYPE_DEFAULT);
41 xwalk::extensions::XWalkExtensionProcess extension_process;
44 // In debug mode, enable to stack dumping in a similar fashion than Renderer
45 // Process. This is helpful to understand crashes in Extension Process.
46 base::debug::EnableInProcessStackDumping();
49 base::RunLoop run_loop;