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

Unified Diff: remoting/host/host_service_win.cc

Issue 10048003: The Chromoting service should not start automatically unless it was configured from the webapp to d… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased. Created 8 years, 8 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/host_service_win.h ('k') | remoting/host/installer/chromoting.wxs » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/host_service_win.cc
diff --git a/remoting/host/host_service_win.cc b/remoting/host/host_service_win.cc
index 52cb90986d32249503f298808b95046fd0d8e1b3..6a455df14107e7fdfe604100b3479f33799a3ac0 100644
--- a/remoting/host/host_service_win.cc
+++ b/remoting/host/host_service_win.cc
@@ -112,11 +112,20 @@ HostService::~HostService() {
}
void HostService::AddWtsConsoleObserver(WtsConsoleObserver* observer) {
+ DCHECK(message_loop_->message_loop_proxy()->BelongsToCurrentThread());
+
console_observers_.AddObserver(observer);
}
void HostService::RemoveWtsConsoleObserver(WtsConsoleObserver* observer) {
+ DCHECK(message_loop_->message_loop_proxy()->BelongsToCurrentThread());
+
console_observers_.RemoveObserver(observer);
+
+ // Stop the service if there are no more observers.
+ if (!console_observers_.might_have_observers()) {
+ message_loop_->PostTask(FROM_HERE, MessageLoop::QuitClosure());
+ }
}
void HostService::OnSessionChange() {
@@ -357,12 +366,15 @@ void HostService::RunMessageLoop() {
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";
shutting_down_ = true;
stopped_event_.Signal();
return;
}
- WtsSessionProcessLauncher launcher(this, host_binary_, &io_thread);
+ WtsSessionProcessLauncher launcher(this, host_binary_,
+ message_loop_->message_loop_proxy(),
+ io_thread.message_loop_proxy());
// Run the service.
message_loop_->Run();
« no previous file with comments | « remoting/host/host_service_win.h ('k') | remoting/host/installer/chromoting.wxs » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698