OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "content/browser/renderer_host/p2p_sockets_host.h" | 5 #include "content/browser/renderer_host/p2p_sockets_host.h" |
6 | 6 |
7 #include "content/browser/renderer_host/p2p_socket_host.h" | 7 #include "content/browser/renderer_host/p2p_socket_host.h" |
8 #include "content/common/p2p_messages.h" | 8 #include "content/common/p2p_messages.h" |
9 | 9 |
10 P2PSocketsHost::P2PSocketsHost() { | 10 P2PSocketsHost::P2PSocketsHost() { |
11 } | 11 } |
12 | 12 |
13 P2PSocketsHost::~P2PSocketsHost() { | 13 P2PSocketsHost::~P2PSocketsHost() { |
14 } | 14 } |
15 | 15 |
16 void P2PSocketsHost::OnChannelClosing() { | 16 void P2PSocketsHost::OnChannelClosing() { |
17 BrowserMessageFilter::OnChannelClosing(); | 17 BrowserMessageFilter::OnChannelClosing(); |
18 | 18 |
19 // Since the IPC channel is gone, close pending connections. | 19 // Since the IPC channel is gone, close pending connections. |
20 for (IDMap<P2PSocketHost>::iterator i(&sockets_); !i.IsAtEnd(); i.Advance()) { | 20 for (IDMap<P2PSocketHost, IDMapOwnPointer>::iterator i(&sockets_); |
| 21 !i.IsAtEnd(); i.Advance()) { |
21 sockets_.Remove(i.GetCurrentKey()); | 22 sockets_.Remove(i.GetCurrentKey()); |
22 } | 23 } |
23 } | 24 } |
24 | 25 |
25 void P2PSocketsHost::OnDestruct() const { | 26 void P2PSocketsHost::OnDestruct() const { |
26 BrowserThread::DeleteOnIOThread::Destruct(this); | 27 BrowserThread::DeleteOnIOThread::Destruct(this); |
27 } | 28 } |
28 | 29 |
29 bool P2PSocketsHost::OnMessageReceived(const IPC::Message& message, | 30 bool P2PSocketsHost::OnMessageReceived(const IPC::Message& message, |
30 bool* message_was_ok) { | 31 bool* message_was_ok) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 if (!socket) { | 73 if (!socket) { |
73 LOG(ERROR) << "Received P2PHostMsg_Send for invalid socket_id."; | 74 LOG(ERROR) << "Received P2PHostMsg_Send for invalid socket_id."; |
74 return; | 75 return; |
75 } | 76 } |
76 socket->Send(socket_address, data); | 77 socket->Send(socket_address, data); |
77 } | 78 } |
78 | 79 |
79 void P2PSocketsHost::OnDestroySocket(const IPC::Message& msg, int socket_id) { | 80 void P2PSocketsHost::OnDestroySocket(const IPC::Message& msg, int socket_id) { |
80 sockets_.Remove(socket_id); | 81 sockets_.Remove(socket_id); |
81 } | 82 } |
OLD | NEW |