1 // Copyright (c) 2014 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 "base/message_loop/message_loop.h"
6 #include "xwalk/application/tools/linux/xwalk_extension_process_launcher.h"
7 #include "xwalk/extensions/extension_process/xwalk_extension_process.h"
9 XWalkExtensionProcessLauncher::XWalkExtensionProcessLauncher()
10 : base::Thread("LauncherExtensionService"),
12 base::Thread::Options thread_options;
13 thread_options.message_loop_type = base::MessageLoop::TYPE_DEFAULT;
14 StartWithOptions(thread_options);
17 XWalkExtensionProcessLauncher::~XWalkExtensionProcessLauncher() {
21 void XWalkExtensionProcessLauncher::Launch(
22 const std::string& channel_id, int channel_fd) {
24 message_loop()->PostTask(
26 base::Bind(&XWalkExtensionProcessLauncher::StartExtensionProcess,
27 base::Unretained(this), channel_id, channel_fd));
30 void XWalkExtensionProcessLauncher::StartExtensionProcess(
31 const std::string& channel_id, int channel_fd) {
32 extension_process_.reset(new xwalk::extensions::XWalkExtensionProcess(
33 IPC::ChannelHandle(channel_id, base::FileDescriptor(channel_fd, true))));