summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--chrome/browser/remoting/remoting_options_handler.cc3
-rw-r--r--chrome/browser/service/service_process_control.cc41
-rw-r--r--chrome/browser/service/service_process_control.h4
3 files changed, 39 insertions, 9 deletions
diff --git a/chrome/browser/remoting/remoting_options_handler.cc b/chrome/browser/remoting/remoting_options_handler.cc
index 9c8b735..7d3de1e 100644
--- a/chrome/browser/remoting/remoting_options_handler.cc
+++ b/chrome/browser/remoting/remoting_options_handler.cc
@@ -6,6 +6,7 @@
#include "base/utf_string_conversions.h"
#include "base/values.h"
+#include "chrome/browser/browser_thread.h"
#include "chrome/browser/service/service_process_control_manager.h"
#include "chrome/common/remoting/chromoting_host_info.h"
#include "content/browser/webui/web_ui.h"
@@ -25,6 +26,8 @@ RemotingOptionsHandler::~RemotingOptionsHandler() {
}
void RemotingOptionsHandler::Init(WebUI* web_ui) {
+ DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));
+
web_ui_ = web_ui;
process_control_ =
diff --git a/chrome/browser/service/service_process_control.cc b/chrome/browser/service/service_process_control.cc
index 6866d30..1d48d27 100644
--- a/chrome/browser/service/service_process_control.cc
+++ b/chrome/browser/service/service_process_control.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -55,17 +55,31 @@ void ServiceProcessControl::ConnectInternal() {
}
void ServiceProcessControl::RunConnectDoneTasks() {
- RunAllTasksHelper(&connect_done_tasks_);
- DCHECK(connect_done_tasks_.empty());
+ // The tasks executed here may add more tasks to the vector. So copy
+ // them to the stack before executing them. This way recursion is
+ // avoided.
+ TaskList tasks;
+ tasks.swap(connect_done_tasks_);
+ RunAllTasksHelper(&tasks);
+ DCHECK(tasks.empty());
+
if (is_connected()) {
- RunAllTasksHelper(&connect_success_tasks_);
- DCHECK(connect_success_tasks_.empty());
+ tasks.swap(connect_success_tasks_);
+ RunAllTasksHelper(&tasks);
+ DCHECK(tasks.empty());
+
STLDeleteElements(&connect_failure_tasks_);
} else {
- RunAllTasksHelper(&connect_failure_tasks_);
- DCHECK(connect_failure_tasks_.empty());
+ tasks.swap(connect_failure_tasks_);
+ RunAllTasksHelper(&tasks);
+ DCHECK(tasks.empty());
+
STLDeleteElements(&connect_success_tasks_);
}
+
+ DCHECK(connect_done_tasks_.empty());
+ DCHECK(connect_success_tasks_.empty());
+ DCHECK(connect_failure_tasks_.empty());
}
// static
@@ -263,7 +277,18 @@ bool ServiceProcessControl::DisableRemotingHost() {
}
bool ServiceProcessControl::RequestRemotingHostStatus() {
- return Send(new ServiceMsg_GetRemotingHostInfo);
+ if (CheckServiceProcessReady()) {
+ remoting::ChromotingHostInfo failure_host_info;
+ failure_host_info.enabled = false;
+
+ Launch(NewRunnableMethod(this, &ServiceProcessControl::Send,
+ new ServiceMsg_GetRemotingHostInfo),
+ NewRunnableMethod(this,
+ &ServiceProcessControl::OnRemotingHostInfo,
+ failure_host_info));
+ return true;
+ }
+ return false;
}
void ServiceProcessControl::AddMessageHandler(
diff --git a/chrome/browser/service/service_process_control.h b/chrome/browser/service/service_process_control.h
index dfb5a5b..d8eba21 100644
--- a/chrome/browser/service/service_process_control.h
+++ b/chrome/browser/service/service_process_control.h
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 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.
@@ -116,6 +116,8 @@ class ServiceProcessControl : public IPC::Channel::Sender,
bool DisableRemotingHost();
// Send request for current status of the remoting service.
+ // MessageHandler::OnRemotingHostInfo() will be called when remoting host
+ // status is available.
bool RequestRemotingHostStatus();
// Add a message handler for receiving messages from the service