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

Unified Diff: remoting/host/remoting_me2me_host.cc

Issue 886913002: Always run PolicyWatcher on UI thread in It2Me host. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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/policy_watcher_unittest.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/remoting_me2me_host.cc
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc
index 07f41c519f6d19c488d8aa00b2eef7b16b829597..aa0bf6f83b1d6b0f9f64324d0ff6fbb9e37f9f19 100644
--- a/remoting/host/remoting_me2me_host.cc
+++ b/remoting/host/remoting_me2me_host.cc
@@ -277,8 +277,6 @@ class HostProcess : public ConfigWatcher::Delegate,
void ShutdownOnNetworkThread();
- void OnPolicyWatcherShutdown();
-
#if defined(OS_WIN)
// Initializes the pairing registry on Windows. This should be invoked on the
// network thread.
@@ -555,7 +553,7 @@ void HostProcess::OnConfigUpdated(
// loading from policy verifications and move |policy_watcher_|
// initialization to StartOnNetworkThread().
policy_watcher_ =
- PolicyWatcher::Create(nullptr, context_->network_task_runner());
+ PolicyWatcher::Create(nullptr, context_->file_task_runner());
policy_watcher_->StartWatching(
base::Bind(&HostProcess::OnPolicyUpdate, base::Unretained(this)),
base::Bind(&HostProcess::OnPolicyError, base::Unretained(this)));
@@ -958,11 +956,7 @@ bool HostProcess::ApplyConfig(const base::DictionaryValue& config) {
}
void HostProcess::OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies) {
- if (!context_->network_task_runner()->BelongsToCurrentThread()) {
- context_->network_task_runner()->PostTask(FROM_HERE, base::Bind(
- &HostProcess::OnPolicyUpdate, this, base::Passed(&policies)));
- return;
- }
+ DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
bool restart_required = false;
restart_required |= OnHostDomainPolicyUpdate(policies.get());
@@ -985,12 +979,9 @@ void HostProcess::OnPolicyUpdate(scoped_ptr<base::DictionaryValue> policies) {
}
void HostProcess::OnPolicyError() {
- context_->network_task_runner()->PostTask(
- FROM_HERE,
- base::Bind(
- &HostProcess::ShutdownHost,
- this,
- kInvalidHostConfigurationExitCode));
+ DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
+
+ ShutdownHost(kInvalidHostConfigurationExitCode);
}
void HostProcess::ApplyHostDomainPolicy() {
@@ -1448,27 +1439,17 @@ void HostProcess::ShutdownOnNetworkThread() {
shutdown_watchdog_->Arm();
config_watcher_.reset();
+ policy_watcher_.reset();
- if (policy_watcher_.get()) {
- policy_watcher_->StopWatching(
- base::Bind(&HostProcess::OnPolicyWatcherShutdown, this));
- } else {
- OnPolicyWatcherShutdown();
- }
+ // Complete the rest of shutdown on the main thread.
+ context_->ui_task_runner()->PostTask(
+ FROM_HERE, base::Bind(&HostProcess::ShutdownOnUiThread, this));
} else {
// This method is only called in STOPPING_TO_RESTART and STOPPING states.
NOTREACHED();
}
}
-void HostProcess::OnPolicyWatcherShutdown() {
- policy_watcher_.reset();
-
- // Complete the rest of shutdown on the main thread.
- context_->ui_task_runner()->PostTask(
- FROM_HERE, base::Bind(&HostProcess::ShutdownOnUiThread, this));
-}
-
void HostProcess::OnCrash(const std::string& function_name,
const std::string& file_name,
const int& line_number) {
« no previous file with comments | « remoting/host/policy_watcher_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698