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 "chrome/browser/media/webrtc_event_log_handler.h" | |
Henrik Grunell
2016/05/10 08:44:56
Not allowed.
Chrome has to implement a public con
Ivo-OOO until feb 6
2016/05/12 13:23:24
Oops, good point. I will add callbacks to do this.
| |
7 #include "content/browser/media/webrtc/webrtc_internals.h" | 8 #include "content/browser/media/webrtc/webrtc_internals.h" |
8 #include "content/common/media/peer_connection_tracker_messages.h" | 9 #include "content/common/media/peer_connection_tracker_messages.h" |
9 #include "content/public/browser/render_process_host.h" | 10 #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 } |
(...skipping 47 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 scoped_refptr<WebRtcEventLogHandler> webrtc_event_log_handler( | |
78 base::UserDataAdapter<WebRtcEventLogHandler>::Get( | |
79 host, WebRtcEventLogHandler::kWebRtcEventLogHandlerKey)); | |
80 webrtc_event_log_handler->OnPeerConnectionAdded(render_process_id_, | |
81 info.lid); | |
82 } | |
74 } | 83 } |
75 | 84 |
76 void PeerConnectionTrackerHost::OnRemovePeerConnection(int lid) { | 85 void PeerConnectionTrackerHost::OnRemovePeerConnection(int lid) { |
77 WebRTCInternals::GetInstance()->OnRemovePeerConnection(peer_pid(), lid); | 86 WebRTCInternals::GetInstance()->OnRemovePeerConnection(peer_pid(), lid); |
87 RenderProcessHost* host = RenderProcessHost::FromID(render_process_id_); | |
88 if (host) { | |
89 scoped_refptr<WebRtcEventLogHandler> webrtc_event_log_handler( | |
90 base::UserDataAdapter<WebRtcEventLogHandler>::Get( | |
91 host, WebRtcEventLogHandler::kWebRtcEventLogHandlerKey)); | |
92 webrtc_event_log_handler->OnPeerConnectionRemoved(render_process_id_, lid); | |
93 } | |
78 } | 94 } |
79 | 95 |
80 void PeerConnectionTrackerHost::OnUpdatePeerConnection( | 96 void PeerConnectionTrackerHost::OnUpdatePeerConnection( |
81 int lid, const std::string& type, const std::string& value) { | 97 int lid, const std::string& type, const std::string& value) { |
82 WebRTCInternals::GetInstance()->OnUpdatePeerConnection( | 98 WebRTCInternals::GetInstance()->OnUpdatePeerConnection( |
83 peer_pid(), | 99 peer_pid(), |
84 lid, | 100 lid, |
85 type, | 101 type, |
86 value); | 102 value); |
87 } | 103 } |
(...skipping 25 matching lines...) Expand all Loading... | |
113 | 129 |
114 void PeerConnectionTrackerHost::SendOnSuspendOnUIThread() { | 130 void PeerConnectionTrackerHost::SendOnSuspendOnUIThread() { |
115 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 131 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
116 content::RenderProcessHost* host = | 132 content::RenderProcessHost* host = |
117 content::RenderProcessHost::FromID(render_process_id_); | 133 content::RenderProcessHost::FromID(render_process_id_); |
118 if (host) | 134 if (host) |
119 host->Send(new PeerConnectionTracker_OnSuspend()); | 135 host->Send(new PeerConnectionTracker_OnSuspend()); |
120 } | 136 } |
121 | 137 |
122 } // namespace content | 138 } // namespace content |
OLD | NEW |