blob: 2a08284eb4dae13847613ae9b7a590961b3e75ee (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
|
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "remoting/host/daemon_process.h"
#include "base/bind.h"
#include "base/bind_helpers.h"
#include "base/single_thread_task_runner.h"
#include "base/threading/thread.h"
namespace {
const char kIpcThreadName[] = "Daemon process IPC";
} // namespace
namespace remoting {
DaemonProcess::~DaemonProcess() {
}
bool DaemonProcess::OnMessageReceived(const IPC::Message& message) {
return true;
}
DaemonProcess::DaemonProcess(
scoped_refptr<base::SingleThreadTaskRunner> main_task_runner,
scoped_refptr<base::SingleThreadTaskRunner> io_task_runner,
const base::Closure& stopped_callback)
: Stoppable(main_task_runner, stopped_callback),
main_task_runner_(main_task_runner),
io_task_runner_(io_task_runner) {
// Initialize on the same thread that will be used for shutting down.
main_task_runner_->PostTask(
FROM_HERE,
base::Bind(&DaemonProcess::Init, base::Unretained(this)));
}
void DaemonProcess::Init() {
DCHECK(main_task_runner_->BelongsToCurrentThread());
if (!LaunchNetworkProcess()) {
LOG(ERROR) << "Failed to launch the networking process.";
Stop();
return;
}
}
void DaemonProcess::DoStop() {
DCHECK(main_task_runner_->BelongsToCurrentThread());
CompleteStopping();
}
} // namespace remoting
|