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_eventlog_callback_handler.h" |
7 #include "content/browser/media/webrtc/webrtc_internals.h" | 8 #include "content/browser/media/webrtc/webrtc_internals.h" |
| 9 #include "content/browser/renderer_host/render_process_host_impl.h" |
8 #include "content/common/media/peer_connection_tracker_messages.h" | 10 #include "content/common/media/peer_connection_tracker_messages.h" |
9 #include "content/public/browser/render_process_host.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 RenderProcessHostImpl* host = static_cast<RenderProcessHostImpl*>( |
| 76 RenderProcessHost::FromID(render_process_id_)); |
| 77 if (host) |
| 78 host->SignalPeerConnectionAdded(info.lid); |
74 } | 79 } |
75 | 80 |
76 void PeerConnectionTrackerHost::OnRemovePeerConnection(int lid) { | 81 void PeerConnectionTrackerHost::OnRemovePeerConnection(int lid) { |
77 WebRTCInternals::GetInstance()->OnRemovePeerConnection(peer_pid(), lid); | 82 WebRTCInternals::GetInstance()->OnRemovePeerConnection(peer_pid(), lid); |
| 83 RenderProcessHostImpl* host = static_cast<RenderProcessHostImpl*>( |
| 84 RenderProcessHost::FromID(render_process_id_)); |
| 85 if (host) |
| 86 host->SignalPeerConnectionRemoved(lid); |
78 } | 87 } |
79 | 88 |
80 void PeerConnectionTrackerHost::OnUpdatePeerConnection( | 89 void PeerConnectionTrackerHost::OnUpdatePeerConnection( |
81 int lid, const std::string& type, const std::string& value) { | 90 int lid, const std::string& type, const std::string& value) { |
82 WebRTCInternals::GetInstance()->OnUpdatePeerConnection( | 91 WebRTCInternals::GetInstance()->OnUpdatePeerConnection( |
83 peer_pid(), | 92 peer_pid(), |
84 lid, | 93 lid, |
85 type, | 94 type, |
86 value); | 95 value); |
87 } | 96 } |
(...skipping 25 matching lines...) Expand all Loading... |
113 | 122 |
114 void PeerConnectionTrackerHost::SendOnSuspendOnUIThread() { | 123 void PeerConnectionTrackerHost::SendOnSuspendOnUIThread() { |
115 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 124 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
116 content::RenderProcessHost* host = | 125 content::RenderProcessHost* host = |
117 content::RenderProcessHost::FromID(render_process_id_); | 126 content::RenderProcessHost::FromID(render_process_id_); |
118 if (host) | 127 if (host) |
119 host->Send(new PeerConnectionTracker_OnSuspend()); | 128 host->Send(new PeerConnectionTracker_OnSuspend()); |
120 } | 129 } |
121 | 130 |
122 } // namespace content | 131 } // namespace content |
OLD | NEW |