summaryrefslogtreecommitdiffstats
path: root/remoting/host/chromoting_host.h
diff options
context:
space:
mode:
authorsergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-11 01:27:23 +0000
committersergeyu@chromium.org <sergeyu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-11-11 01:27:23 +0000
commita46bcef82b29d30836a0f26226e3d4aca4fa9612 (patch)
tree297ff3b78e05b2fb83971d3dee51e0d12ebcf181 /remoting/host/chromoting_host.h
parente7cd8dc6e9199cade000dc48da230f9ada0ccf28 (diff)
downloadchromium_src-a46bcef82b29d30836a0f26226e3d4aca4fa9612.zip
chromium_src-a46bcef82b29d30836a0f26226e3d4aca4fa9612.tar.gz
chromium_src-a46bcef82b29d30836a0f26226e3d4aca4fa9612.tar.bz2
Access ChromotingHost::clients_ only on network thread.
Previously ChromotingHost was doing some work on the main thread and some on the network thread. |clients_| and some other members were accessed without lock on both of these threads. Moved most of the ChromotingHost activity to the network thread to avoid possible race conditions. BUG=96325 TEST=Chromoting works Review URL: http://codereview.chromium.org/8495024 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@109556 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'remoting/host/chromoting_host.h')
-rw-r--r--remoting/host/chromoting_host.h37
1 files changed, 14 insertions, 23 deletions
diff --git a/remoting/host/chromoting_host.h b/remoting/host/chromoting_host.h
index 160f5dc..08ad9b4 100644
--- a/remoting/host/chromoting_host.h
+++ b/remoting/host/chromoting_host.h
@@ -163,9 +163,6 @@ class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>,
bool allow_nat_traversal);
virtual ~ChromotingHost();
- // This method is called if a client is disconnected from the host.
- void OnClientDisconnected(ClientSession* client);
-
// Creates encoder for the specified configuration.
Encoder* CreateEncoder(const protocol::SessionConfig& config);
@@ -182,11 +179,12 @@ class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>,
void StopScreenRecorder();
void OnScreenRecorderStopped();
- // The following methods are called during shutdown.
- void ShutdownNetwork();
- void ShutdownRecorder();
+ // Called from Shutdown() or OnScreenRecorderStopped() to finish shutdown.
void ShutdownFinish();
+ // Unless specified otherwise all members of this class must be
+ // used on the network thread only.
+
// Parameters specified when the host was created.
ChromotingHostContext* context_;
DesktopEnvironment* desktop_environment_;
@@ -199,6 +197,7 @@ class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>,
std::string local_jid_;
scoped_ptr<protocol::SessionManager> session_manager_;
+ // StatusObserverList is thread-safe and can be used on any thread.
StatusObserverList status_observers_;
// The connections to remote clients.
@@ -207,35 +206,27 @@ class ChromotingHost : public base::RefCountedThreadSafe<ChromotingHost>,
// Session manager for the host process.
scoped_refptr<ScreenRecorder> recorder_;
- // Tracks the internal state of the host.
- // This variable is written on the main thread of ChromotingHostContext
- // and read by jingle thread.
- State state_;
-
// Number of screen recorders that are currently being
// stopped. Normally set to 0 or 1, but in some cases it may be
// greater than 1, particularly if when second client can connect
- // immidiately after previous one disconnected.
+ // immediately after previous one disconnected.
int stopping_recorders_;
- // Lock is to lock the access to |state_|.
- base::Lock lock_;
+ // Tracks the internal state of the host.
+ State state_;
// Configuration of the protocol.
scoped_ptr<protocol::CandidateSessionConfig> protocol_config_;
- bool is_curtained_;
-
- // Whether or not the host is running in "IT2Me" mode, in which connections
- // are pre-authenticated, and hence the local login challenge can be bypassed.
- bool is_it2me_;
-
- std::string access_code_;
-
- // Stores list of closures that should be executed when we finish
+ // Stores list of tasks that should be executed when we finish
// shutdown. Used only while |state_| is set to kStopping.
std::vector<base::Closure> shutdown_tasks_;
+ // TODO(sergeyu): The following members do not belong to
+ // ChromotingHost and should be moved elsewhere.
+ bool is_curtained_;
+ bool is_it2me_;
+ std::string access_code_;
UiStrings ui_strings_;
DISALLOW_COPY_AND_ASSIGN(ChromotingHost);