Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "content/browser/renderer_host/media/peer_connection_tracker_host.h" | 4 #include "content/browser/renderer_host/media/peer_connection_tracker_host.h" |
| 5 | 5 |
| 6 #include "base/process_util.h" | 6 #include "base/process_util.h" |
| 7 #include "content/browser/media/webrtc_internals.h" | |
| 8 #include "content/common/media/peer_connection_tracker_messages.h" | 7 #include "content/common/media/peer_connection_tracker_messages.h" |
| 9 #include "content/public/browser/content_browser_client.h" | 8 #include "content/public/browser/content_browser_client.h" |
| 9 #include "content/public/browser/webrtc_internals.h" | |
| 10 | 10 |
| 11 namespace content { | 11 namespace content { |
| 12 | 12 |
| 13 PeerConnectionTrackerHost::PeerConnectionTrackerHost() { | 13 PeerConnectionTrackerHost::PeerConnectionTrackerHost() { |
| 14 } | 14 } |
| 15 | 15 |
| 16 bool PeerConnectionTrackerHost::OnMessageReceived(const IPC::Message& message, | 16 bool PeerConnectionTrackerHost::OnMessageReceived(const IPC::Message& message, |
| 17 bool* message_was_ok) { | 17 bool* message_was_ok) { |
| 18 bool handled = true; | 18 bool handled = true; |
| 19 IPC_BEGIN_MESSAGE_MAP_EX(PeerConnectionTrackerHost, message, *message_was_ok) | 19 IPC_BEGIN_MESSAGE_MAP_EX(PeerConnectionTrackerHost, message, *message_was_ok) |
| 20 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_AddPeerConnection, | 20 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_AddPeerConnection, |
| 21 OnAddPeerConnection) | 21 OnAddPeerConnection) |
| 22 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_RemovePeerConnection, | 22 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_RemovePeerConnection, |
| 23 OnRemovePeerConnection) | 23 OnRemovePeerConnection) |
| 24 IPC_MESSAGE_UNHANDLED(handled = false) | 24 IPC_MESSAGE_UNHANDLED(handled = false) |
| 25 IPC_END_MESSAGE_MAP_EX() | 25 IPC_END_MESSAGE_MAP_EX() |
| 26 return handled; | 26 return handled; |
| 27 } | 27 } |
| 28 | 28 |
| 29 void PeerConnectionTrackerHost::OverrideThreadForMessage( | |
| 30 const IPC::Message& message, BrowserThread::ID* thread) { | |
| 31 if (message.type() == PeerConnectionTrackerHost_AddPeerConnection::ID || | |
|
jam
2013/01/18 22:23:45
since you're doing this for all PeerConnection mes
jiayl
2013/01/18 22:39:51
Done.
| |
| 32 message.type() == PeerConnectionTrackerHost_RemovePeerConnection::ID) | |
| 33 *thread = BrowserThread::UI; | |
| 34 } | |
| 35 | |
| 29 PeerConnectionTrackerHost::~PeerConnectionTrackerHost() { | 36 PeerConnectionTrackerHost::~PeerConnectionTrackerHost() { |
| 30 } | 37 } |
| 31 | 38 |
| 32 void PeerConnectionTrackerHost::OnAddPeerConnection( | 39 void PeerConnectionTrackerHost::OnAddPeerConnection( |
| 33 const PeerConnectionInfo& info) { | 40 const PeerConnectionInfo& info) { |
| 34 WebRTCInternals::GetInstance()->AddPeerConnection( | 41 GetContentClient()->browser()->GetWebRTCInternals()-> |
| 35 base::GetProcId(peer_handle()), info); | 42 AddPeerConnection(base::GetProcId(peer_handle()), |
| 43 info.lid, | |
| 44 info.url, | |
| 45 info.servers, | |
| 46 info.constraints); | |
| 36 } | 47 } |
| 37 | 48 |
| 38 void PeerConnectionTrackerHost::OnRemovePeerConnection(int lid) { | 49 void PeerConnectionTrackerHost::OnRemovePeerConnection(int lid) { |
| 39 WebRTCInternals::GetInstance()->RemovePeerConnection( | 50 GetContentClient()->browser()->GetWebRTCInternals()-> |
| 40 base::GetProcId(peer_handle()), lid); | 51 RemovePeerConnection(base::GetProcId(peer_handle()), lid); |
| 41 } | 52 } |
| 42 | 53 |
| 43 } // namespace content | 54 } // namespace content |
| OLD | NEW |