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

Unified Diff: remoting/protocol/jingle_session.cc

Issue 2314833002: Remove some uses of stl_util's STLDeleteContainerPointers. (Closed)
Patch Set: cleanup Created 4 years, 3 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/protocol/jingle_session.h ('k') | ui/message_center/notification_list.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/protocol/jingle_session.cc
diff --git a/remoting/protocol/jingle_session.cc b/remoting/protocol/jingle_session.cc
index 90f7e9e7f42f78bdecbbaebf99dc459959141548..347db864898fe73fea58484a5dfa1dc6df5496c5 100644
--- a/remoting/protocol/jingle_session.cc
+++ b/remoting/protocol/jingle_session.cc
@@ -74,11 +74,6 @@ JingleSession::JingleSession(JingleSessionManager* session_manager)
}
JingleSession::~JingleSession() {
- base::STLDeleteContainerPointers(pending_requests_.begin(),
- pending_requests_.end());
- base::STLDeleteContainerPointers(transport_info_requests_.begin(),
- transport_info_requests_.end());
-
session_manager_->SessionDestroyed(this);
}
@@ -230,7 +225,7 @@ void JingleSession::SendTransportInfo(
base::Unretained(this)));
if (request) {
request->SetTimeout(base::TimeDelta::FromSeconds(kTransportInfoTimeout));
- transport_info_requests_.push_back(request.release());
+ transport_info_requests_.push_back(std::move(request));
} else {
LOG(ERROR) << "Failed to send a transport-info message";
}
@@ -299,7 +294,7 @@ void JingleSession::SendMessage(const JingleMessage& message) {
}
if (request) {
request->SetTimeout(base::TimeDelta::FromSeconds(timeout));
- pending_requests_.insert(request.release());
+ pending_requests_.insert(std::move(request));
} else {
LOG(ERROR) << "Failed to send a "
<< JingleMessage::GetActionName(message.action) << " message";
@@ -313,8 +308,11 @@ void JingleSession::OnMessageResponse(
DCHECK(thread_checker_.CalledOnValidThread());
// Delete the request from the list of pending requests.
- pending_requests_.erase(request);
- delete request;
+ pending_requests_.erase(
+ std::find_if(pending_requests_.begin(), pending_requests_.end(),
+ [request](const std::unique_ptr<IqRequest>& ptr) {
+ return ptr.get() == request;
+ }));
// Ignore all responses after session was closed.
if (state_ == CLOSED || state_ == FAILED)
@@ -349,14 +347,12 @@ void JingleSession::OnTransportInfoResponse(IqRequest* request,
// Consider transport-info requests sent before this one lost and delete
// corresponding IqRequest objects.
- while (transport_info_requests_.front() != request) {
- delete transport_info_requests_.front();
+ while (transport_info_requests_.front().get() != request) {
transport_info_requests_.pop_front();
}
// Delete the |request| itself.
- DCHECK_EQ(request, transport_info_requests_.front());
- delete request;
+ DCHECK_EQ(request, transport_info_requests_.front().get());
transport_info_requests_.pop_front();
// Ignore transport-info timeouts.
« no previous file with comments | « remoting/protocol/jingle_session.h ('k') | ui/message_center/notification_list.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698