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

Side by Side Diff: chrome/browser/renderer_host/socket_stream_dispatcher_host.cc

Issue 342052: Implement websocket throttling. (Closed)
Patch Set: Fix tyoshino's comment Created 11 years, 1 month 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 unified diff | Download patch
« no previous file with comments | « no previous file | net/net.gyp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "chrome/browser/renderer_host/socket_stream_dispatcher_host.h" 5 #include "chrome/browser/renderer_host/socket_stream_dispatcher_host.h"
6 6
7 #include "base/logging.h" 7 #include "base/logging.h"
8 #include "chrome/browser/renderer_host/socket_stream_host.h" 8 #include "chrome/browser/renderer_host/socket_stream_host.h"
9 #include "chrome/common/render_messages.h" 9 #include "chrome/common/render_messages.h"
10 #include "chrome/common/net/socket_stream.h" 10 #include "chrome/common/net/socket_stream.h"
11 #include "ipc/ipc_message.h" 11 #include "ipc/ipc_message.h"
12 #include "net/websockets/websocket_throttle.h"
12 13
13 SocketStreamDispatcherHost::SocketStreamDispatcherHost() 14 SocketStreamDispatcherHost::SocketStreamDispatcherHost()
14 : sender_(NULL) { 15 : sender_(NULL) {
16 net::WebSocketThrottle::Init();
15 } 17 }
16 18
17 SocketStreamDispatcherHost::~SocketStreamDispatcherHost() { 19 SocketStreamDispatcherHost::~SocketStreamDispatcherHost() {
18 // TODO(ukai): Implement IDMap::RemoveAll(). 20 // TODO(ukai): Implement IDMap::RemoveAll().
19 for (IDMap<SocketStreamHost>::const_iterator iter(&hosts_); 21 for (IDMap<SocketStreamHost>::const_iterator iter(&hosts_);
20 !iter.IsAtEnd(); 22 !iter.IsAtEnd();
21 iter.Advance()) { 23 iter.Advance()) {
22 int socket_id = iter.GetCurrentKey(); 24 int socket_id = iter.GetCurrentKey();
23 const SocketStreamHost* socket_stream_host = iter.GetCurrentValue(); 25 const SocketStreamHost* socket_stream_host = iter.GetCurrentValue();
24 delete socket_stream_host; 26 delete socket_stream_host;
(...skipping 127 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 154
153 void SocketStreamDispatcherHost::DeleteSocketStreamHost(int socket_id) { 155 void SocketStreamDispatcherHost::DeleteSocketStreamHost(int socket_id) {
154 SocketStreamHost* socket_stream_host = hosts_.Lookup(socket_id); 156 SocketStreamHost* socket_stream_host = hosts_.Lookup(socket_id);
155 DCHECK(socket_stream_host); 157 DCHECK(socket_stream_host);
156 delete socket_stream_host; 158 delete socket_stream_host;
157 hosts_.Remove(socket_id); 159 hosts_.Remove(socket_id);
158 if (!sender_->Send(new ViewMsg_SocketStream_Closed(socket_id))) { 160 if (!sender_->Send(new ViewMsg_SocketStream_Closed(socket_id))) {
159 LOG(ERROR) << "ViewMsg_SocketStream_Closed failed."; 161 LOG(ERROR) << "ViewMsg_SocketStream_Closed failed.";
160 } 162 }
161 } 163 }
OLDNEW
« no previous file with comments | « no previous file | net/net.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698