summaryrefslogtreecommitdiffstats
path: root/chrome/browser/service
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-02 01:36:11 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-03-02 01:36:11 +0000
commitf4f917dcbddb1c0e13bc1ec5e83f92f8000de65b (patch)
tree082a1ff1be4a16050c160a380c65f9bbb1a68bf3 /chrome/browser/service
parent005d5485371fe12b6abbe82604f997df400fbf97 (diff)
downloadchromium_src-f4f917dcbddb1c0e13bc1ec5e83f92f8000de65b.zip
chromium_src-f4f917dcbddb1c0e13bc1ec5e83f92f8000de65b.tar.gz
chromium_src-f4f917dcbddb1c0e13bc1ec5e83f92f8000de65b.tar.bz2
Report chromoting host status connect after browser is restarted
When checking chromoting host status first check if service process is alive then connects to it and send the status request. This also requires the fix to cleanup connect done, success, failure tasks correctly. Otherwise there will an infinite loop and eventually exhaust stack memory. BUG=74443 TEST=Enable chromoting host, close browser and check the status. Review URL: http://codereview.chromium.org/6592045 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@76494 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/service')
-rw-r--r--chrome/browser/service/service_process_control.cc41
-rw-r--r--chrome/browser/service/service_process_control.h4
2 files changed, 36 insertions, 9 deletions
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