diff options
author | alexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-25 23:06:43 +0000 |
---|---|---|
committer | alexeypa@chromium.org <alexeypa@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-04-25 23:06:43 +0000 |
commit | c5319f5037c78dba10813ecd132c2246e2fb575f (patch) | |
tree | a24db893ca6a21c10388388f9ea226267bc9399e /remoting/host/remoting_me2me_host.cc | |
parent | e0e9e44a8ce72002baaa6c5cebe6fb626703f1e8 (diff) | |
download | chromium_src-c5319f5037c78dba10813ecd132c2246e2fb575f.zip chromium_src-c5319f5037c78dba10813ecd132c2246e2fb575f.tar.gz chromium_src-c5319f5037c78dba10813ecd132c2246e2fb575f.tar.bz2 |
Revert 196343 "Made the ChromotingHost class not ref-counted."
r196343 broke ChromotingHost shutdown when connecting to an it2me host:
> [0425/154053:FATAL:observer_list.h(197)] Check failed: ObserverListBase<ObserverType>::size() == 0U (2 vs. 0)
> Made the ChromotingHost class not ref-counted.
>
> ChromotingHost becomes a non thread-safe class should should live on the network thread. The CL removes ChromotingHost::Shutdown() allowing ChromotingHost to be destroyed synchronously closing all existing connections. It also updates HostStatusObserver::OnShutdown() handler to not destroy the host since it is the host's owner responsibility now.
>
> Review URL: https://chromiumcodereview.appspot.com/13466014
TBR=alexeypa@chromium.org
Review URL: https://codereview.chromium.org/14499006
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@196526 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/remoting_me2me_host.cc')
-rw-r--r-- | remoting/host/remoting_me2me_host.cc | 19 |
1 files changed, 12 insertions, 7 deletions
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc index 4e31ea8..217eb57 100644 --- a/remoting/host/remoting_me2me_host.cc +++ b/remoting/host/remoting_me2me_host.cc @@ -282,7 +282,7 @@ class HostProcess scoped_ptr<LogToServer> log_to_server_; scoped_ptr<HostEventLogger> host_event_logger_; - scoped_ptr<ChromotingHost> host_; + scoped_refptr<ChromotingHost> host_; // Used to keep this HostProcess alive until it is shutdown. scoped_refptr<HostProcess> self_; @@ -950,7 +950,7 @@ void HostProcess::StartHost() { network_settings.max_port = NetworkSettings::kDefaultMaxPort; } - host_.reset(new ChromotingHost( + host_ = new ChromotingHost( signal_strategy_.get(), desktop_environment_factory_.get(), CreateHostSessionManager(network_settings, @@ -960,7 +960,7 @@ void HostProcess::StartHost() { context_->video_capture_task_runner(), context_->video_encode_task_runner(), context_->network_task_runner(), - context_->ui_task_runner())); + context_->ui_task_runner()); // TODO(simonmorris): Get the maximum session duration from a policy. #if defined(OS_LINUX) @@ -1041,7 +1041,7 @@ void HostProcess::RestartHost() { DCHECK_EQ(state_, HOST_STARTED); state_ = HOST_STOPPING_TO_RESTART; - ShutdownOnNetworkThread(); + host_->Shutdown(base::Bind(&HostProcess::ShutdownOnNetworkThread, this)); } void HostProcess::ShutdownHost(int exit_code) { @@ -1051,11 +1051,15 @@ void HostProcess::ShutdownHost(int exit_code) { switch (state_) { case HOST_INITIALIZING: - case HOST_STARTED: state_ = HOST_STOPPING; ShutdownOnNetworkThread(); break; + case HOST_STARTED: + state_ = HOST_STOPPING; + host_->Shutdown(base::Bind(&HostProcess::ShutdownOnNetworkThread, this)); + break; + case HOST_STOPPING_TO_RESTART: state_ = HOST_STOPPING; break; @@ -1070,7 +1074,7 @@ void HostProcess::ShutdownHost(int exit_code) { void HostProcess::ShutdownOnNetworkThread() { DCHECK(context_->network_task_runner()->BelongsToCurrentThread()); - host_.reset(); + host_ = NULL; curtaining_host_observer_.reset(); host_event_logger_.reset(); log_to_server_.reset(); @@ -1099,7 +1103,8 @@ void HostProcess::ShutdownOnNetworkThread() { FROM_HERE, base::Bind(&HostProcess::ShutdownOnUiThread, this)); } else { - // This method is only called in STOPPING_TO_RESTART and STOPPING states. + // This method is used as a callback for ChromotingHost::Shutdown() which is + // called only in STOPPING_TO_RESTART and STOPPING states. NOTREACHED(); } } |