Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(379)

Unified Diff: remoting/host/win/host_service.cc

Issue 10823062: Introducing the DaemonProcess class that will implements core of the daemon process functionality. … (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased Created 8 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/host/win/host_service.h ('k') | remoting/host/win/wts_session_process_launcher.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/win/host_service.cc
diff --git a/remoting/host/win/host_service.cc b/remoting/host/win/host_service.cc
index 00fb718ec6b24cf9ba0a505832761286cabd8db5..3523921d5d5721d30ef173aaea3b53ac1a8ca911 100644
--- a/remoting/host/win/host_service.cc
+++ b/remoting/host/win/host_service.cc
@@ -27,15 +27,26 @@
#include "remoting/base/scoped_sc_handle_win.h"
#include "remoting/base/stoppable.h"
#include "remoting/host/branding.h"
+
+#if defined(REMOTING_MULTI_PROCESS)
+#include "remoting/host/daemon_process.h"
+#endif // defined(REMOTING_MULTI_PROCESS)
+
#include "remoting/host/usage_stats_consent.h"
#include "remoting/host/win/host_service_resource.h"
#include "remoting/host/win/wts_console_observer.h"
+
+#if !defined(REMOTING_MULTI_PROCESS)
#include "remoting/host/win/wts_session_process_launcher.h"
+#endif // !defined(REMOTING_MULTI_PROCESS)
using base::StringPrintf;
namespace {
+// Session id that does not represent any session.
+const uint32 kInvalidSessionId = 0xffffffffu;
+
const char kIoThreadName[] = "I/O thread";
// A window class for the session change notifications window.
@@ -100,8 +111,8 @@ void HostService::RemoveWtsConsoleObserver(WtsConsoleObserver* observer) {
console_observers_.RemoveObserver(observer);
}
-void HostService::OnLauncherShutdown() {
- launcher_.reset(NULL);
+void HostService::OnChildStopped() {
+ child_.reset(NULL);
main_task_runner_->PostTask(FROM_HERE, MessageLoop::QuitClosure());
}
@@ -138,8 +149,7 @@ BOOL WINAPI HostService::ConsoleControlHandler(DWORD event) {
case CTRL_LOGOFF_EVENT:
case CTRL_SHUTDOWN_EVENT:
self->main_task_runner_->PostTask(FROM_HERE, base::Bind(
- &WtsSessionProcessLauncher::Stop,
- base::Unretained(self->launcher_.get())));
+ &Stoppable::Stop, base::Unretained(self->child_.get())));
self->stopped_event_.Wait();
return TRUE;
@@ -182,22 +192,33 @@ int HostService::Run() {
}
void HostService::RunMessageLoop(MessageLoop* message_loop) {
+#if defined(REMOTING_MULTI_PROCESS)
+
+ child_ = DaemonProcess::Create(
+ main_task_runner_,
+ base::Bind(&HostService::OnChildStopped,
+ base::Unretained(this))).PassAs<Stoppable>();
+
+#else // !defined(REMOTING_MULTI_PROCESS)
+
// Launch the I/O thread.
base::Thread io_thread(kIoThreadName);
base::Thread::Options io_thread_options(MessageLoop::TYPE_IO, 0);
if (!io_thread.StartWithOptions(io_thread_options)) {
- LOG(FATAL) << "Failed to start the I/O thread";
+ LOG(ERROR) << "Failed to start the I/O thread";
stopped_event_.Signal();
return;
}
// Create the session process launcher.
- launcher_.reset(new WtsSessionProcessLauncher(
- base::Bind(&HostService::OnLauncherShutdown, base::Unretained(this)),
+ child_.reset(new WtsSessionProcessLauncher(
+ base::Bind(&HostService::OnChildStopped, base::Unretained(this)),
this,
main_task_runner_,
io_thread.message_loop_proxy()));
+#endif // !defined(REMOTING_MULTI_PROCESS)
+
// Run the service.
message_loop->Run();
@@ -304,8 +325,7 @@ DWORD WINAPI HostService::ServiceControlHandler(DWORD control,
case SERVICE_CONTROL_SHUTDOWN:
case SERVICE_CONTROL_STOP:
self->main_task_runner_->PostTask(FROM_HERE, base::Bind(
- &WtsSessionProcessLauncher::Stop,
- base::Unretained(self->launcher_.get())));
+ &Stoppable::Stop, base::Unretained(self->child_.get())));
self->stopped_event_.Wait();
return NO_ERROR;
« no previous file with comments | « remoting/host/win/host_service.h ('k') | remoting/host/win/wts_session_process_launcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698