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

Unified Diff: remoting/host/remoting_me2me_host.cc

Issue 13466014: Made the ChromotingHost class not ref-counted. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: CR feedback #2 Created 7 years, 8 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
Index: remoting/host/remoting_me2me_host.cc
diff --git a/remoting/host/remoting_me2me_host.cc b/remoting/host/remoting_me2me_host.cc
index 3e358a8b3dcc6c35ab7bbfc3d0b8e225286b9dee..44e0737bf76426537f26d062bc7a27934355fefd 100644
--- a/remoting/host/remoting_me2me_host.cc
+++ b/remoting/host/remoting_me2me_host.cc
@@ -275,7 +275,7 @@ class HostProcess
scoped_ptr<LogToServer> log_to_server_;
scoped_ptr<HostEventLogger> host_event_logger_;
- scoped_refptr<ChromotingHost> host_;
+ scoped_ptr<ChromotingHost> host_;
// Used to keep this HostProcess alive until it is shutdown.
scoped_refptr<HostProcess> self_;
@@ -883,7 +883,7 @@ void HostProcess::StartHost() {
network_settings.max_port = NetworkSettings::kDefaultMaxPort;
}
- host_ = new ChromotingHost(
+ host_.reset(new ChromotingHost(
signal_strategy_.get(),
desktop_environment_factory_.get(),
CreateHostSessionManager(network_settings,
@@ -893,7 +893,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)
@@ -974,7 +974,7 @@ void HostProcess::RestartHost() {
DCHECK_EQ(state_, HOST_STARTED);
state_ = HOST_STOPPING_TO_RESTART;
- host_->Shutdown(base::Bind(&HostProcess::ShutdownOnNetworkThread, this));
+ ShutdownOnNetworkThread();
}
void HostProcess::ShutdownHost(int exit_code) {
@@ -984,13 +984,9 @@ void HostProcess::ShutdownHost(int exit_code) {
switch (state_) {
case HOST_INITIALIZING:
- state_ = HOST_STOPPING;
- ShutdownOnNetworkThread();
- break;
-
case HOST_STARTED:
state_ = HOST_STOPPING;
- host_->Shutdown(base::Bind(&HostProcess::ShutdownOnNetworkThread, this));
+ ShutdownOnNetworkThread();
break;
case HOST_STOPPING_TO_RESTART:
@@ -1007,7 +1003,7 @@ void HostProcess::ShutdownHost(int exit_code) {
void HostProcess::ShutdownOnNetworkThread() {
DCHECK(context_->network_task_runner()->BelongsToCurrentThread());
- host_ = NULL;
+ host_.reset();
curtaining_host_observer_.reset();
host_event_logger_.reset();
log_to_server_.reset();
@@ -1036,8 +1032,7 @@ void HostProcess::ShutdownOnNetworkThread() {
FROM_HERE,
base::Bind(&HostProcess::ShutdownOnUiThread, this));
} else {
- // This method is used as a callback for ChromotingHost::Shutdown() which is
- // called only in STOPPING_TO_RESTART and STOPPING states.
+ // This method is only called in STOPPING_TO_RESTART and STOPPING states.
NOTREACHED();
}
}
« remoting/host/chromoting_host.h ('K') | « remoting/host/plugin/host_script_object.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698