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

Unified Diff: net/spdy/spdy_session_pool.cc

Issue 305823003: Re-land: Defer SpdySession destruction to support closing writes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Regression tests and fix for crbug.com/379469 Created 6 years, 7 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 | « net/spdy/spdy_session.cc ('k') | net/spdy/spdy_session_pool_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/spdy/spdy_session_pool.cc
diff --git a/net/spdy/spdy_session_pool.cc b/net/spdy/spdy_session_pool.cc
index 4747f0595039e57a99203dece4302d321d9d2104..66d907dbda439918c8228675b6659d1489cb0792 100644
--- a/net/spdy/spdy_session_pool.cc
+++ b/net/spdy/spdy_session_pool.cc
@@ -71,6 +71,12 @@ SpdySessionPool::SpdySessionPool(
SpdySessionPool::~SpdySessionPool() {
CloseAllSessions();
+ while (!sessions_.empty()) {
+ // Destroy sessions to enforce that lifetime is scoped to SpdySessionPool.
+ // Write callbacks queued upon session drain are not invoked.
+ RemoveUnavailableSession((*sessions_.begin())->GetWeakPtr());
+ }
+
if (ssl_config_service_.get())
ssl_config_service_->RemoveObserver(this);
NetworkChangeNotifier::RemoveIPAddressObserver(this);
@@ -244,7 +250,7 @@ void SpdySessionPool::CloseCurrentIdleSessions() {
}
void SpdySessionPool::CloseAllSessions() {
- while (!sessions_.empty()) {
+ while (!available_sessions_.empty()) {
CloseCurrentSessionsHelper(ERR_ABORTED, "Closing all sessions.",
false /* idle_only */);
}
@@ -280,7 +286,7 @@ void SpdySessionPool::OnIPAddressChanged() {
#else
(*it)->CloseSessionOnError(ERR_NETWORK_CHANGED,
"Closing current sessions.");
- DCHECK(!*it);
+ DCHECK((*it)->IsDraining());
#endif // defined(OS_ANDROID) || defined(OS_WIN) || defined(OS_IOS)
DCHECK(!IsSessionAvailable(*it));
}
@@ -389,7 +395,6 @@ void SpdySessionPool::CloseCurrentSessionsHelper(
(*it)->CloseSessionOnError(error, description);
DCHECK(!IsSessionAvailable(*it));
- DCHECK(!*it);
}
}
« no previous file with comments | « net/spdy/spdy_session.cc ('k') | net/spdy/spdy_session_pool_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698