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

Unified Diff: net/socket/client_socket_pool.cc

Issue 9861032: Close idle connections / SPDY sessions when needed (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Address eroman's comments. Created 8 years, 9 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
Index: net/socket/client_socket_pool.cc
diff --git a/net/socket/client_socket_pool.cc b/net/socket/client_socket_pool.cc
index a1967efdbab2b12a340ad7cb37e8af1596d82f45..b76fddec8d6d33b4f8db4f466fc6d618ac8fea32 100644
--- a/net/socket/client_socket_pool.cc
+++ b/net/socket/client_socket_pool.cc
@@ -4,6 +4,7 @@
#include "net/socket/client_socket_pool.h"
+#include "base/debug/alias.h"
#include "base/logging.h"
namespace {
@@ -21,6 +22,27 @@ int g_used_idle_socket_timeout_s = 300; // 5 minutes
namespace net {
+LayeredPool::LayeredPool() {
+ magic_value_ = ALIVE;
eroman 2012/03/28 18:25:59 nit: i suggest putting this in initializer list (i
Ryan Hamilton 2012/03/28 18:35:28 Duh! Good point.
+}
+
+LayeredPool::~LayeredPool() {
eroman 2012/03/28 18:25:59 I suggest calling CrashIfFreed() first. Double-fre
Ryan Hamilton 2012/03/28 18:35:28 Done.
+ magic_value_ = DEAD;
+ stack_trace_ = base::debug::StackTrace();
+}
+
+void LayeredPool::CrashIfFreed() {
+ if (magic_value_ != ALIVE) {
+ MagicValue magic_value = magic_value_;
+ base::debug::StackTrace deletion_callstack = stack_trace_;
+
+ base::debug::Alias(&magic_value);
+ base::debug::Alias(&deletion_callstack);
+
+ CHECK(false);
+ }
+}
+
// static
base::TimeDelta ClientSocketPool::unused_idle_socket_timeout() {
return base::TimeDelta::FromSeconds(g_unused_idle_socket_timeout_s);

Powered by Google App Engine
This is Rietveld 408576698