| 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/power_monitor/power_monitor.h" | 6 #include "base/power_monitor/power_monitor.h" |
| 7 #include "content/browser/media/webrtc/webrtc_internals.h" | 7 #include "content/browser/media/webrtc/webrtc_internals.h" |
| 8 #include "content/common/media/peer_connection_tracker_messages.h" | 8 #include "content/common/media/peer_connection_tracker_messages.h" |
| 9 #include "content/public/browser/render_process_host.h" | 9 #include "content/public/browser/render_process_host.h" |
| 10 #include "content/public/browser/webrtc_callback_interface.h" |
| 10 | 11 |
| 11 namespace content { | 12 namespace content { |
| 12 | 13 |
| 13 PeerConnectionTrackerHost::PeerConnectionTrackerHost(int render_process_id) | 14 PeerConnectionTrackerHost::PeerConnectionTrackerHost(int render_process_id) |
| 14 : BrowserMessageFilter(PeerConnectionTrackerMsgStart), | 15 : BrowserMessageFilter(PeerConnectionTrackerMsgStart), |
| 15 render_process_id_(render_process_id) { | 16 render_process_id_(render_process_id) { |
| 16 } | 17 } |
| 17 | 18 |
| 18 bool PeerConnectionTrackerHost::OnMessageReceived(const IPC::Message& message) { | 19 bool PeerConnectionTrackerHost::OnMessageReceived(const IPC::Message& message) { |
| 19 bool handled = true; | 20 bool handled = true; |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 65 |
| 65 void PeerConnectionTrackerHost::OnAddPeerConnection( | 66 void PeerConnectionTrackerHost::OnAddPeerConnection( |
| 66 const PeerConnectionInfo& info) { | 67 const PeerConnectionInfo& info) { |
| 67 WebRTCInternals::GetInstance()->OnAddPeerConnection( | 68 WebRTCInternals::GetInstance()->OnAddPeerConnection( |
| 68 render_process_id_, | 69 render_process_id_, |
| 69 peer_pid(), | 70 peer_pid(), |
| 70 info.lid, | 71 info.lid, |
| 71 info.url, | 72 info.url, |
| 72 info.rtc_configuration, | 73 info.rtc_configuration, |
| 73 info.constraints); | 74 info.constraints); |
| 75 RenderProcessHost* host = RenderProcessHost::FromID(render_process_id_); |
| 76 if (host) { |
| 77 WebRTCCallbackInterface::GetInstance()->PeerConnectionAdded( |
| 78 render_process_id_, info.lid); |
| 79 } |
| 74 } | 80 } |
| 75 | 81 |
| 76 void PeerConnectionTrackerHost::OnRemovePeerConnection(int lid) { | 82 void PeerConnectionTrackerHost::OnRemovePeerConnection(int lid) { |
| 77 WebRTCInternals::GetInstance()->OnRemovePeerConnection(peer_pid(), lid); | 83 WebRTCInternals::GetInstance()->OnRemovePeerConnection(peer_pid(), lid); |
| 84 RenderProcessHost* host = RenderProcessHost::FromID(render_process_id_); |
| 85 if (host) { |
| 86 WebRTCCallbackInterface::GetInstance()->PeerConnectionRemoved( |
| 87 render_process_id_, lid); |
| 88 } |
| 78 } | 89 } |
| 79 | 90 |
| 80 void PeerConnectionTrackerHost::OnUpdatePeerConnection( | 91 void PeerConnectionTrackerHost::OnUpdatePeerConnection( |
| 81 int lid, const std::string& type, const std::string& value) { | 92 int lid, const std::string& type, const std::string& value) { |
| 82 WebRTCInternals::GetInstance()->OnUpdatePeerConnection( | 93 WebRTCInternals::GetInstance()->OnUpdatePeerConnection( |
| 83 peer_pid(), | 94 peer_pid(), |
| 84 lid, | 95 lid, |
| 85 type, | 96 type, |
| 86 value); | 97 value); |
| 87 } | 98 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 113 | 124 |
| 114 void PeerConnectionTrackerHost::SendOnSuspendOnUIThread() { | 125 void PeerConnectionTrackerHost::SendOnSuspendOnUIThread() { |
| 115 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 126 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 116 content::RenderProcessHost* host = | 127 content::RenderProcessHost* host = |
| 117 content::RenderProcessHost::FromID(render_process_id_); | 128 content::RenderProcessHost::FromID(render_process_id_); |
| 118 if (host) | 129 if (host) |
| 119 host->Send(new PeerConnectionTracker_OnSuspend()); | 130 host->Send(new PeerConnectionTracker_OnSuspend()); |
| 120 } | 131 } |
| 121 | 132 |
| 122 } // namespace content | 133 } // namespace content |
| OLD | NEW |