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

Unified Diff: remoting/host/chromoting_host.cc

Issue 2431513003: Revert of Don't use barcodes in ProtocolPerfTests (Closed)
Patch Set: Created 4 years, 2 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/chromoting_host.h ('k') | remoting/host/chromoting_host_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/host/chromoting_host.cc
diff --git a/remoting/host/chromoting_host.cc b/remoting/host/chromoting_host.cc
index 8bc93449ad74bce26b534acbc70679a2b7ddb4d7..d2c0232e7144616804cedf2bbbf000774462787d 100644
--- a/remoting/host/chromoting_host.cc
+++ b/remoting/host/chromoting_host.cc
@@ -178,11 +178,10 @@
// Disconnect all other clients. |it| should be advanced before Disconnect()
// is called to avoid it becoming invalid when the client is removed from
// the list.
- ClientSessions::iterator it = clients_.begin();
+ ClientList::iterator it = clients_.begin();
base::WeakPtr<ChromotingHost> self = weak_factory_.GetWeakPtr();
while (it != clients_.end()) {
- ClientSession* other_client = it->get();
- ++it;
+ ClientSession* other_client = *it++;
if (other_client != client) {
other_client->DisconnectSession(protocol::OK);
@@ -221,16 +220,13 @@
void ChromotingHost::OnSessionClosed(ClientSession* client) {
DCHECK(CalledOnValidThread());
- ClientSessions::iterator it =
- std::find_if(clients_.begin(), clients_.end(),
- [client](const std::unique_ptr<ClientSession>& item) {
- return item.get() == client;
- });
+ ClientList::iterator it = std::find(clients_.begin(), clients_.end(), client);
CHECK(it != clients_.end());
bool was_authenticated = client->is_authenticated();
std::string jid = client->client_jid();
clients_.erase(it);
+ delete client;
if (was_authenticated) {
FOR_EACH_OBSERVER(HostStatusObserver, status_observers_,
@@ -280,9 +276,11 @@
}
// Create a ClientSession object.
- clients_.push_back(base::MakeUnique<ClientSession>(
+ ClientSession* client = new ClientSession(
this, std::move(connection), desktop_environment_factory_,
- max_session_duration_, pairing_registry_, extensions_.get()));
+ max_session_duration_, pairing_registry_, extensions_.get());
+
+ clients_.push_back(client);
}
void ChromotingHost::DisconnectAllClients() {
« no previous file with comments | « remoting/host/chromoting_host.h ('k') | remoting/host/chromoting_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698