summaryrefslogtreecommitdiffstats
path: root/remoting
diff options
context:
space:
mode:
authorjamiewalch@google.com <jamiewalch@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-09 21:45:00 +0000
committerjamiewalch@google.com <jamiewalch@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2012-05-09 21:45:00 +0000
commitd97c842fb8c624ebd6caf909b3635c6f65591510 (patch)
treeaba68203362e8d3ee95133faf86f6fe1242f9de7 /remoting
parent69e8e46dcd8cc286a0cb4a1f0c1a2fefd4af9ca6 (diff)
downloadchromium_src-d97c842fb8c624ebd6caf909b3635c6f65591510.zip
chromium_src-d97c842fb8c624ebd6caf909b3635c6f65591510.tar.gz
chromium_src-d97c842fb8c624ebd6caf909b3635c6f65591510.tar.bz2
Add polling to DoSetConfigAndStart and increased timeout for Stop.
BUG=121749,120903 TEST=Stop or start the host. Ensure that the web-app state synchronizes in a timely manner. Review URL: https://chromiumcodereview.appspot.com/10387041 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@136134 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting')
-rw-r--r--remoting/host/plugin/daemon_controller_mac.cc37
1 files changed, 25 insertions, 12 deletions
diff --git a/remoting/host/plugin/daemon_controller_mac.cc b/remoting/host/plugin/daemon_controller_mac.cc
index a59c164..136eef0 100644
--- a/remoting/host/plugin/daemon_controller_mac.cc
+++ b/remoting/host/plugin/daemon_controller_mac.cc
@@ -49,8 +49,8 @@ const char kStartStopTool[] = kConfigDir kServiceName ".me2me.sh";
// knowledge of which keys belong in which files.
const char kHostConfigFile[] = kConfigDir kServiceName ".json";
-const int kStopWaitRetryLimit = 20;
-const int kStopWaitTimeout = 500;
+const int kPrefPaneWaitRetryLimit = 60;
+const int kPrefPaneWaitTimeout = 1000;
class DaemonControllerMac : public remoting::DaemonController {
public:
@@ -74,9 +74,10 @@ class DaemonControllerMac : public remoting::DaemonController {
void DoUpdateConfig(scoped_ptr<base::DictionaryValue> config,
const CompletionCallback& done_callback);
void DoStop(const CompletionCallback& done_callback);
- void NotifyWhenStopped(const CompletionCallback& done_callback,
- int tries_remaining,
- const base::TimeDelta& sleep);
+ void NotifyOnState(DaemonController::State state,
+ const CompletionCallback& done_callback,
+ int tries_remaining,
+ const base::TimeDelta& sleep);
bool ShowPreferencePane(const std::string& config_data);
base::Thread auth_thread_;
@@ -166,7 +167,15 @@ void DaemonControllerMac::DoSetConfigAndStart(
bool result = ShowPreferencePane(config_data);
- done_callback.Run(result ? RESULT_OK : RESULT_FAILED);
+ if (!result) {
+ done_callback.Run(RESULT_FAILED);
+ }
+
+ // TODO(jamiewalch): Replace this with something a bit more robust
+ NotifyOnState(DaemonController::STATE_STARTED,
+ done_callback,
+ kPrefPaneWaitRetryLimit,
+ base::TimeDelta::FromMilliseconds(kPrefPaneWaitTimeout));
}
void DaemonControllerMac::DoUpdateConfig(
@@ -248,24 +257,28 @@ void DaemonControllerMac::DoStop(const CompletionCallback& done_callback) {
return;
}
- NotifyWhenStopped(done_callback,
- kStopWaitRetryLimit,
- base::TimeDelta::FromMilliseconds(kStopWaitTimeout));
+ // TODO(jamiewalch): Replace this with something a bit more robust
+ NotifyOnState(DaemonController::STATE_STOPPED,
+ done_callback,
+ kPrefPaneWaitRetryLimit,
+ base::TimeDelta::FromMilliseconds(kPrefPaneWaitTimeout));
}
-void DaemonControllerMac::NotifyWhenStopped(
+void DaemonControllerMac::NotifyOnState(
+ DaemonController::State state,
const CompletionCallback& done_callback,
int tries_remaining,
const base::TimeDelta& sleep) {
- if (GetState() == DaemonController::STATE_STOPPED) {
+ if (GetState() == state) {
done_callback.Run(RESULT_OK);
} else if (tries_remaining == 0) {
done_callback.Run(RESULT_FAILED);
} else {
auth_thread_.message_loop_proxy()->PostDelayedTask(
FROM_HERE,
- base::Bind(&DaemonControllerMac::NotifyWhenStopped,
+ base::Bind(&DaemonControllerMac::NotifyOnState,
base::Unretained(this),
+ state,
done_callback,
tries_remaining - 1,
sleep),