Commit bf77513a authored by gab's avatar gab Committed by Commit Bot

Deprecate NonThreadSafe in remoting in favor of SequenceChecker.

Note to crash team: This CL is a refactor and has no intended behavior change.

This change was scripted by https://crbug.com/676387#c8.

Note-worthy for the reviewer:
 * SequenceChecker enforces thread-safety but not thread-affinity!
   If the classes that were updated are thread-affine (use thread local
   storage or a third-party API that does) they should be migrated to
   ThreadChecker instead.
 * ~NonThreadSafe() used to implcitly check in its destructor
   ~Sequence/ThreadChecker() doesn't by design. To keep this CL a
   no-op, an explicit check was added to the destructor of migrated
   classes.
 * NonThreadSafe used to provide access to subclasses, as such
   the |sequence_checker_| member was made protected rather than
   private where necessary.

BUG=676387
This CL was uploaded by git cl split.

R=sergeyu@chromium.org

Review-Url: https://codereview.chromium.org/2911893003
Cr-Commit-Position: refs/heads/master@{#476279}
parent de524948
...@@ -56,12 +56,14 @@ OAuthTokenGetterImpl::OAuthTokenGetterImpl( ...@@ -56,12 +56,14 @@ OAuthTokenGetterImpl::OAuthTokenGetterImpl(
} }
} }
OAuthTokenGetterImpl::~OAuthTokenGetterImpl() {} OAuthTokenGetterImpl::~OAuthTokenGetterImpl() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
}
void OAuthTokenGetterImpl::OnGetTokensResponse(const std::string& refresh_token, void OAuthTokenGetterImpl::OnGetTokensResponse(const std::string& refresh_token,
const std::string& access_token, const std::string& access_token,
int expires_seconds) { int expires_seconds) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(intermediate_credentials_); DCHECK(intermediate_credentials_);
VLOG(1) << "Received OAuth tokens."; VLOG(1) << "Received OAuth tokens.";
...@@ -85,7 +87,7 @@ void OAuthTokenGetterImpl::OnGetTokensResponse(const std::string& refresh_token, ...@@ -85,7 +87,7 @@ void OAuthTokenGetterImpl::OnGetTokensResponse(const std::string& refresh_token,
void OAuthTokenGetterImpl::OnRefreshTokenResponse( void OAuthTokenGetterImpl::OnRefreshTokenResponse(
const std::string& access_token, const std::string& access_token,
int expires_seconds) { int expires_seconds) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(authorization_credentials_); DCHECK(authorization_credentials_);
VLOG(1) << "Received OAuth token."; VLOG(1) << "Received OAuth token.";
...@@ -104,7 +106,7 @@ void OAuthTokenGetterImpl::OnRefreshTokenResponse( ...@@ -104,7 +106,7 @@ void OAuthTokenGetterImpl::OnRefreshTokenResponse(
void OAuthTokenGetterImpl::OnGetUserEmailResponse( void OAuthTokenGetterImpl::OnGetUserEmailResponse(
const std::string& user_email) { const std::string& user_email) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(authorization_credentials_); DCHECK(authorization_credentials_);
VLOG(1) << "Received user info."; VLOG(1) << "Received user info.";
...@@ -148,7 +150,7 @@ void OAuthTokenGetterImpl::NotifyTokenCallbacks( ...@@ -148,7 +150,7 @@ void OAuthTokenGetterImpl::NotifyTokenCallbacks(
Status status, Status status,
const std::string& user_email, const std::string& user_email,
const std::string& access_token) { const std::string& access_token) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
std::queue<TokenCallback> callbacks(pending_callbacks_); std::queue<TokenCallback> callbacks(pending_callbacks_);
pending_callbacks_ = std::queue<TokenCallback>(); pending_callbacks_ = std::queue<TokenCallback>();
...@@ -161,14 +163,14 @@ void OAuthTokenGetterImpl::NotifyTokenCallbacks( ...@@ -161,14 +163,14 @@ void OAuthTokenGetterImpl::NotifyTokenCallbacks(
void OAuthTokenGetterImpl::NotifyUpdatedCallbacks( void OAuthTokenGetterImpl::NotifyUpdatedCallbacks(
const std::string& user_email, const std::string& user_email,
const std::string& refresh_token) { const std::string& refresh_token) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (credentials_updated_callback_) { if (credentials_updated_callback_) {
credentials_updated_callback_.Run(user_email, refresh_token); credentials_updated_callback_.Run(user_email, refresh_token);
} }
} }
void OAuthTokenGetterImpl::OnOAuthError() { void OAuthTokenGetterImpl::OnOAuthError() {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
LOG(ERROR) << "OAuth: invalid credentials."; LOG(ERROR) << "OAuth: invalid credentials.";
response_pending_ = false; response_pending_ = false;
...@@ -182,7 +184,7 @@ void OAuthTokenGetterImpl::OnOAuthError() { ...@@ -182,7 +184,7 @@ void OAuthTokenGetterImpl::OnOAuthError() {
} }
void OAuthTokenGetterImpl::OnNetworkError(int response_code) { void OAuthTokenGetterImpl::OnNetworkError(int response_code) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
LOG(ERROR) << "Network error when trying to update OAuth token: " LOG(ERROR) << "Network error when trying to update OAuth token: "
<< response_code; << response_code;
response_pending_ = false; response_pending_ = false;
...@@ -191,7 +193,7 @@ void OAuthTokenGetterImpl::OnNetworkError(int response_code) { ...@@ -191,7 +193,7 @@ void OAuthTokenGetterImpl::OnNetworkError(int response_code) {
} }
void OAuthTokenGetterImpl::CallWithToken(const TokenCallback& on_access_token) { void OAuthTokenGetterImpl::CallWithToken(const TokenCallback& on_access_token) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (intermediate_credentials_) { if (intermediate_credentials_) {
pending_callbacks_.push(on_access_token); pending_callbacks_.push(on_access_token);
if (!response_pending_) { if (!response_pending_) {
...@@ -216,12 +218,12 @@ void OAuthTokenGetterImpl::CallWithToken(const TokenCallback& on_access_token) { ...@@ -216,12 +218,12 @@ void OAuthTokenGetterImpl::CallWithToken(const TokenCallback& on_access_token) {
} }
void OAuthTokenGetterImpl::InvalidateCache() { void OAuthTokenGetterImpl::InvalidateCache() {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
access_token_expiry_time_ = base::Time(); access_token_expiry_time_ = base::Time();
} }
void OAuthTokenGetterImpl::GetOauthTokensFromAuthCode() { void OAuthTokenGetterImpl::GetOauthTokensFromAuthCode() {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
VLOG(1) << "Fetching OAuth token from Auth Code."; VLOG(1) << "Fetching OAuth token from Auth Code.";
DCHECK(!response_pending_); DCHECK(!response_pending_);
...@@ -254,7 +256,7 @@ void OAuthTokenGetterImpl::GetOauthTokensFromAuthCode() { ...@@ -254,7 +256,7 @@ void OAuthTokenGetterImpl::GetOauthTokensFromAuthCode() {
} }
void OAuthTokenGetterImpl::RefreshAccessToken() { void OAuthTokenGetterImpl::RefreshAccessToken() {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
VLOG(1) << "Refreshing OAuth Access token."; VLOG(1) << "Refreshing OAuth Access token.";
DCHECK(!response_pending_); DCHECK(!response_pending_);
......
...@@ -8,7 +8,7 @@ ...@@ -8,7 +8,7 @@
#include <queue> #include <queue>
#include "base/callback.h" #include "base/callback.h"
#include "base/threading/non_thread_safe.h" #include "base/sequence_checker.h"
#include "base/time/time.h" #include "base/time/time.h"
#include "base/timer/timer.h" #include "base/timer/timer.h"
#include "google_apis/gaia/gaia_oauth_client.h" #include "google_apis/gaia/gaia_oauth_client.h"
...@@ -29,7 +29,6 @@ namespace remoting { ...@@ -29,7 +29,6 @@ namespace remoting {
// On first usage it is likely an application will only have an auth code, // On first usage it is likely an application will only have an auth code,
// from this you can get a refresh token which can be reused next app launch. // from this you can get a refresh token which can be reused next app launch.
class OAuthTokenGetterImpl : public OAuthTokenGetter, class OAuthTokenGetterImpl : public OAuthTokenGetter,
public base::NonThreadSafe,
public gaia::GaiaOAuthClient::Delegate { public gaia::GaiaOAuthClient::Delegate {
public: public:
OAuthTokenGetterImpl( OAuthTokenGetterImpl(
...@@ -83,6 +82,8 @@ class OAuthTokenGetterImpl : public OAuthTokenGetter, ...@@ -83,6 +82,8 @@ class OAuthTokenGetterImpl : public OAuthTokenGetter,
base::Time access_token_expiry_time_; base::Time access_token_expiry_time_;
std::queue<OAuthTokenGetter::TokenCallback> pending_callbacks_; std::queue<OAuthTokenGetter::TokenCallback> pending_callbacks_;
std::unique_ptr<base::OneShotTimer> refresh_timer_; std::unique_ptr<base::OneShotTimer> refresh_timer_;
SEQUENCE_CHECKER(sequence_checker_);
}; };
} // namespace remoting } // namespace remoting
......
...@@ -13,10 +13,12 @@ RateCounter::RateCounter(base::TimeDelta time_window) ...@@ -13,10 +13,12 @@ RateCounter::RateCounter(base::TimeDelta time_window)
DCHECK_GT(time_window, base::TimeDelta()); DCHECK_GT(time_window, base::TimeDelta());
} }
RateCounter::~RateCounter() {} RateCounter::~RateCounter() {
DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
}
void RateCounter::Record(int64_t value) { void RateCounter::Record(int64_t value) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
base::TimeTicks now = tick_clock_->NowTicks(); base::TimeTicks now = tick_clock_->NowTicks();
EvictOldDataPoints(now); EvictOldDataPoints(now);
...@@ -25,7 +27,7 @@ void RateCounter::Record(int64_t value) { ...@@ -25,7 +27,7 @@ void RateCounter::Record(int64_t value) {
} }
double RateCounter::Rate() { double RateCounter::Rate() {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
EvictOldDataPoints(tick_clock_->NowTicks()); EvictOldDataPoints(tick_clock_->NowTicks());
return sum_ / time_window_.InSecondsF(); return sum_ / time_window_.InSecondsF();
......
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
#include <utility> #include <utility>
#include "base/macros.h" #include "base/macros.h"
#include "base/threading/non_thread_safe.h" #include "base/sequence_checker.h"
#include "base/time/default_tick_clock.h" #include "base/time/default_tick_clock.h"
#include "base/time/tick_clock.h" #include "base/time/tick_clock.h"
#include "base/time/time.h" #include "base/time/time.h"
...@@ -21,7 +21,7 @@ namespace remoting { ...@@ -21,7 +21,7 @@ namespace remoting {
// Measures average rate per second of a sequence of point rate samples // Measures average rate per second of a sequence of point rate samples
// over a specified time window. This can be used to measure bandwidth, frame // over a specified time window. This can be used to measure bandwidth, frame
// rates, etc. // rates, etc.
class RateCounter : public base::NonThreadSafe { class RateCounter {
public: public:
// Constructs a rate counter over the specified |time_window|. // Constructs a rate counter over the specified |time_window|.
explicit RateCounter(base::TimeDelta time_window); explicit RateCounter(base::TimeDelta time_window);
...@@ -57,6 +57,8 @@ class RateCounter : public base::NonThreadSafe { ...@@ -57,6 +57,8 @@ class RateCounter : public base::NonThreadSafe {
base::DefaultTickClock default_tick_clock_; base::DefaultTickClock default_tick_clock_;
base::TickClock* tick_clock_ = &default_tick_clock_; base::TickClock* tick_clock_ = &default_tick_clock_;
SEQUENCE_CHECKER(sequence_checker_);
DISALLOW_COPY_AND_ASSIGN(RateCounter); DISALLOW_COPY_AND_ASSIGN(RateCounter);
}; };
......
...@@ -174,6 +174,7 @@ static_library("host") { ...@@ -174,6 +174,7 @@ static_library("host") {
"host_status_logger.h", "host_status_logger.h",
"host_status_monitor.h", "host_status_monitor.h",
"host_status_observer.h", "host_status_observer.h",
"host_window.cc",
"host_window.h", "host_window.h",
"host_window_proxy.cc", "host_window_proxy.cc",
"host_window_proxy.h", "host_window_proxy.h",
......
...@@ -83,7 +83,7 @@ ChromotingHost::ChromotingHost( ...@@ -83,7 +83,7 @@ ChromotingHost::ChromotingHost(
} }
ChromotingHost::~ChromotingHost() { ChromotingHost::~ChromotingHost() {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// Disconnect all of the clients. // Disconnect all of the clients.
while (!clients_.empty()) { while (!clients_.empty()) {
...@@ -102,7 +102,7 @@ ChromotingHost::~ChromotingHost() { ...@@ -102,7 +102,7 @@ ChromotingHost::~ChromotingHost() {
} }
void ChromotingHost::Start(const std::string& host_owner_email) { void ChromotingHost::Start(const std::string& host_owner_email) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(!started_); DCHECK(!started_);
HOST_LOG << "Starting host"; HOST_LOG << "Starting host";
...@@ -115,12 +115,12 @@ void ChromotingHost::Start(const std::string& host_owner_email) { ...@@ -115,12 +115,12 @@ void ChromotingHost::Start(const std::string& host_owner_email) {
} }
void ChromotingHost::AddStatusObserver(HostStatusObserver* observer) { void ChromotingHost::AddStatusObserver(HostStatusObserver* observer) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
status_observers_.AddObserver(observer); status_observers_.AddObserver(observer);
} }
void ChromotingHost::RemoveStatusObserver(HostStatusObserver* observer) { void ChromotingHost::RemoveStatusObserver(HostStatusObserver* observer) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
status_observers_.RemoveObserver(observer); status_observers_.RemoveObserver(observer);
} }
...@@ -130,7 +130,7 @@ void ChromotingHost::AddExtension(std::unique_ptr<HostExtension> extension) { ...@@ -130,7 +130,7 @@ void ChromotingHost::AddExtension(std::unique_ptr<HostExtension> extension) {
void ChromotingHost::SetAuthenticatorFactory( void ChromotingHost::SetAuthenticatorFactory(
std::unique_ptr<protocol::AuthenticatorFactory> authenticator_factory) { std::unique_ptr<protocol::AuthenticatorFactory> authenticator_factory) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
session_manager_->set_authenticator_factory(std::move(authenticator_factory)); session_manager_->set_authenticator_factory(std::move(authenticator_factory));
} }
...@@ -156,7 +156,7 @@ void ChromotingHost::OnSessionAuthenticating(ClientSession* client) { ...@@ -156,7 +156,7 @@ void ChromotingHost::OnSessionAuthenticating(ClientSession* client) {
} }
void ChromotingHost::OnSessionAuthenticated(ClientSession* client) { void ChromotingHost::OnSessionAuthenticated(ClientSession* client) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
login_backoff_.Reset(); login_backoff_.Reset();
...@@ -181,7 +181,7 @@ void ChromotingHost::OnSessionAuthenticated(ClientSession* client) { ...@@ -181,7 +181,7 @@ void ChromotingHost::OnSessionAuthenticated(ClientSession* client) {
} }
void ChromotingHost::OnSessionChannelsConnected(ClientSession* client) { void ChromotingHost::OnSessionChannelsConnected(ClientSession* client) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// Notify observers. // Notify observers.
for (auto& observer : status_observers_) for (auto& observer : status_observers_)
...@@ -189,7 +189,7 @@ void ChromotingHost::OnSessionChannelsConnected(ClientSession* client) { ...@@ -189,7 +189,7 @@ void ChromotingHost::OnSessionChannelsConnected(ClientSession* client) {
} }
void ChromotingHost::OnSessionAuthenticationFailed(ClientSession* client) { void ChromotingHost::OnSessionAuthenticationFailed(ClientSession* client) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// Notify observers. // Notify observers.
for (auto& observer : status_observers_) for (auto& observer : status_observers_)
...@@ -197,7 +197,7 @@ void ChromotingHost::OnSessionAuthenticationFailed(ClientSession* client) { ...@@ -197,7 +197,7 @@ void ChromotingHost::OnSessionAuthenticationFailed(ClientSession* client) {
} }
void ChromotingHost::OnSessionClosed(ClientSession* client) { void ChromotingHost::OnSessionClosed(ClientSession* client) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
ClientSessions::iterator it = ClientSessions::iterator it =
std::find_if(clients_.begin(), clients_.end(), std::find_if(clients_.begin(), clients_.end(),
...@@ -220,7 +220,7 @@ void ChromotingHost::OnSessionRouteChange( ...@@ -220,7 +220,7 @@ void ChromotingHost::OnSessionRouteChange(
ClientSession* session, ClientSession* session,
const std::string& channel_name, const std::string& channel_name,
const protocol::TransportRoute& route) { const protocol::TransportRoute& route) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
for (auto& observer : status_observers_) for (auto& observer : status_observers_)
observer.OnClientRouteChange(session->client_jid(), channel_name, route); observer.OnClientRouteChange(session->client_jid(), channel_name, route);
} }
...@@ -228,7 +228,7 @@ void ChromotingHost::OnSessionRouteChange( ...@@ -228,7 +228,7 @@ void ChromotingHost::OnSessionRouteChange(
void ChromotingHost::OnIncomingSession( void ChromotingHost::OnIncomingSession(
protocol::Session* session, protocol::Session* session,
protocol::SessionManager::IncomingSessionResponse* response) { protocol::SessionManager::IncomingSessionResponse* response) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(started_); DCHECK(started_);
if (login_backoff_.ShouldRejectRequest()) { if (login_backoff_.ShouldRejectRequest()) {
......
...@@ -13,7 +13,7 @@ ...@@ -13,7 +13,7 @@
#include "base/memory/ref_counted.h" #include "base/memory/ref_counted.h"
#include "base/memory/weak_ptr.h" #include "base/memory/weak_ptr.h"
#include "base/observer_list.h" #include "base/observer_list.h"
#include "base/threading/non_thread_safe.h" #include "base/sequence_checker.h"
#include "base/threading/thread.h" #include "base/threading/thread.h"
#include "net/base/backoff_entry.h" #include "net/base/backoff_entry.h"
#include "remoting/host/client_session.h" #include "remoting/host/client_session.h"
...@@ -62,8 +62,7 @@ class DesktopEnvironmentFactory; ...@@ -62,8 +62,7 @@ class DesktopEnvironmentFactory;
// all pending tasks to complete. After all of that completed we // all pending tasks to complete. After all of that completed we
// return to the idle state. We then go to step (2) if there a new // return to the idle state. We then go to step (2) if there a new
// incoming connection. // incoming connection.
class ChromotingHost : public base::NonThreadSafe, class ChromotingHost : public ClientSession::EventHandler,
public ClientSession::EventHandler,
public HostStatusMonitor { public HostStatusMonitor {
public: public:
typedef std::vector<std::unique_ptr<ClientSession>> ClientSessions; typedef std::vector<std::unique_ptr<ClientSession>> ClientSessions;
...@@ -179,6 +178,8 @@ class ChromotingHost : public base::NonThreadSafe, ...@@ -179,6 +178,8 @@ class ChromotingHost : public base::NonThreadSafe,
// List of host extensions. // List of host extensions.
std::vector<std::unique_ptr<HostExtension>> extensions_; std::vector<std::unique_ptr<HostExtension>> extensions_;
SEQUENCE_CHECKER(sequence_checker_);
base::WeakPtrFactory<ChromotingHost> weak_factory_; base::WeakPtrFactory<ChromotingHost> weak_factory_;
DISALLOW_COPY_AND_ASSIGN(ChromotingHost); DISALLOW_COPY_AND_ASSIGN(ChromotingHost);
......
...@@ -82,7 +82,7 @@ ClientSession::ClientSession( ...@@ -82,7 +82,7 @@ ClientSession::ClientSession(
} }
ClientSession::~ClientSession() { ClientSession::~ClientSession() {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(!audio_stream_); DCHECK(!audio_stream_);
DCHECK(!desktop_environment_); DCHECK(!desktop_environment_);
DCHECK(!input_injector_); DCHECK(!input_injector_);
...@@ -94,7 +94,7 @@ ClientSession::~ClientSession() { ...@@ -94,7 +94,7 @@ ClientSession::~ClientSession() {
void ClientSession::NotifyClientResolution( void ClientSession::NotifyClientResolution(
const protocol::ClientResolution& resolution) { const protocol::ClientResolution& resolution) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(resolution.dips_width() > 0 && resolution.dips_height() > 0); DCHECK(resolution.dips_width() > 0 && resolution.dips_height() > 0);
VLOG(1) << "Received ClientResolution (dips_width=" VLOG(1) << "Received ClientResolution (dips_width="
...@@ -124,7 +124,7 @@ void ClientSession::NotifyClientResolution( ...@@ -124,7 +124,7 @@ void ClientSession::NotifyClientResolution(
} }
void ClientSession::ControlVideo(const protocol::VideoControl& video_control) { void ClientSession::ControlVideo(const protocol::VideoControl& video_control) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// Note that |video_stream_| may be null, depending upon whether // Note that |video_stream_| may be null, depending upon whether
// extensions choose to wrap or "steal" the video capturer or encoder. // extensions choose to wrap or "steal" the video capturer or encoder.
...@@ -152,7 +152,7 @@ void ClientSession::ControlVideo(const protocol::VideoControl& video_control) { ...@@ -152,7 +152,7 @@ void ClientSession::ControlVideo(const protocol::VideoControl& video_control) {
} }
void ClientSession::ControlAudio(const protocol::AudioControl& audio_control) { void ClientSession::ControlAudio(const protocol::AudioControl& audio_control) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
if (audio_control.has_enable()) { if (audio_control.has_enable()) {
VLOG(1) << "Received AudioControl (enable=" VLOG(1) << "Received AudioControl (enable="
...@@ -164,7 +164,7 @@ void ClientSession::ControlAudio(const protocol::AudioControl& audio_control) { ...@@ -164,7 +164,7 @@ void ClientSession::ControlAudio(const protocol::AudioControl& audio_control) {
void ClientSession::SetCapabilities( void ClientSession::SetCapabilities(
const protocol::Capabilities& capabilities) { const protocol::Capabilities& capabilities) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// Ignore all the messages but the 1st one. // Ignore all the messages but the 1st one.
if (client_capabilities_) { if (client_capabilities_) {
...@@ -223,7 +223,7 @@ void ClientSession::OnConnectionAuthenticating() { ...@@ -223,7 +223,7 @@ void ClientSession::OnConnectionAuthenticating() {
} }
void ClientSession::OnConnectionAuthenticated() { void ClientSession::OnConnectionAuthenticated() {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(!audio_stream_); DCHECK(!audio_stream_);
DCHECK(!desktop_environment_); DCHECK(!desktop_environment_);
DCHECK(!input_injector_); DCHECK(!input_injector_);
...@@ -280,7 +280,7 @@ void ClientSession::OnConnectionAuthenticated() { ...@@ -280,7 +280,7 @@ void ClientSession::OnConnectionAuthenticated() {
} }
void ClientSession::CreateMediaStreams() { void ClientSession::CreateMediaStreams() {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
// Create a VideoStream to pump frames from the capturer to the client. // Create a VideoStream to pump frames from the capturer to the client.
video_stream_ = connection_->StartVideoStream( video_stream_ = connection_->StartVideoStream(
...@@ -307,7 +307,7 @@ void ClientSession::CreateMediaStreams() { ...@@ -307,7 +307,7 @@ void ClientSession::CreateMediaStreams() {
} }
void ClientSession::OnConnectionChannelsConnected() { void ClientSession::OnConnectionChannelsConnected() {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(!channels_connected_); DCHECK(!channels_connected_);
channels_connected_ = true; channels_connected_ = true;
...@@ -337,7 +337,7 @@ void ClientSession::OnConnectionChannelsConnected() { ...@@ -337,7 +337,7 @@ void ClientSession::OnConnectionChannelsConnected() {
} }
void ClientSession::OnConnectionClosed(protocol::ErrorCode error) { void ClientSession::OnConnectionClosed(protocol::ErrorCode error) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
HOST_LOG << "Client disconnected: " << client_jid_ << "; error = " << error; HOST_LOG << "Client disconnected: " << client_jid_ << "; error = " << error;
...@@ -368,7 +368,7 @@ void ClientSession::OnConnectionClosed(protocol::ErrorCode error) { ...@@ -368,7 +368,7 @@ void ClientSession::OnConnectionClosed(protocol::ErrorCode error) {
void ClientSession::OnRouteChange( void ClientSession::OnRouteChange(
const std::string& channel_name, const std::string& channel_name,
const protocol::TransportRoute& route) { const protocol::TransportRoute& route) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
event_handler_->OnSessionRouteChange(this, channel_name, route); event_handler_->OnSessionRouteChange(this, channel_name, route);
} }
...@@ -377,7 +377,7 @@ const std::string& ClientSession::client_jid() const { ...@@ -377,7 +377,7 @@ const std::string& ClientSession::client_jid() const {
} }
void ClientSession::DisconnectSession(protocol::ErrorCode error) { void ClientSession::DisconnectSession(protocol::ErrorCode error) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
DCHECK(connection_.get()); DCHECK(connection_.get());
max_duration_timer_.Stop(); max_duration_timer_.Stop();
...@@ -388,12 +388,12 @@ void ClientSession::DisconnectSession(protocol::ErrorCode error) { ...@@ -388,12 +388,12 @@ void ClientSession::DisconnectSession(protocol::ErrorCode error) {
} }
void ClientSession::OnLocalMouseMoved(const webrtc::DesktopVector& position) { void ClientSession::OnLocalMouseMoved(const webrtc::DesktopVector& position) {
DCHECK(CalledOnValidThread()); DCHECK_CALLED_ON_VALID_SEQUENCE(sequence_checker_);
remote_input_filter_.LocalMouseMoved(position); remote_input_filter_.LocalMouseMoved(position);
} }