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

Unified Diff: content/browser/renderer_host/websocket_dispatcher_host.cc

Issue 390773002: [WebSocket] Send a close frame when the renderer process is gone. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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: content/browser/renderer_host/websocket_dispatcher_host.cc
diff --git a/content/browser/renderer_host/websocket_dispatcher_host.cc b/content/browser/renderer_host/websocket_dispatcher_host.cc
index 2af2f0814c80a10755b4c0f318e88ac872666444..d49199a7cb8f44e08ea03435a58905f63b618fc5 100644
--- a/content/browser/renderer_host/websocket_dispatcher_host.cc
+++ b/content/browser/renderer_host/websocket_dispatcher_host.cc
@@ -5,6 +5,7 @@
#include "content/browser/renderer_host/websocket_dispatcher_host.h"
#include <string>
+#include <vector>
#include "base/callback.h"
#include "base/logging.h"
@@ -178,6 +179,21 @@ WebSocketHostState WebSocketDispatcherHost::DoDropChannel(
}
WebSocketDispatcherHost::~WebSocketDispatcherHost() {
+ std::vector<WebSocketHost*> hosts;
+ for (base::hash_map<int, WebSocketHost*>::const_iterator i = hosts_.begin();
+ i != hosts_.end(); ++i) {
+ // In order to avoid changing the container while iterating, we copy
+ // the hosts.
+ hosts.push_back(i->second);
+ }
+
+ for (size_t i = 0; i < hosts.size(); ++i) {
+ // Note that some calls to GoAway could fail. In that case hosts[i] will be
+ // deleted and removed from |hosts_| in |DoDropChannel|.
+ hosts[i]->GoAway();
+ hosts[i] = NULL;
+ }
+
STLDeleteContainerPairSecondPointers(hosts_.begin(), hosts_.end());
}
« no previous file with comments | « chrome/browser/net/websocket_browsertest.cc ('k') | content/browser/renderer_host/websocket_dispatcher_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698