| 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_host.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( |
| 15 int render_process_id, |
| 16 WebRTCEventLogHost* event_log_host) |
| 14 : BrowserMessageFilter(PeerConnectionTrackerMsgStart), | 17 : BrowserMessageFilter(PeerConnectionTrackerMsgStart), |
| 15 render_process_id_(render_process_id) { | 18 render_process_id_(render_process_id), |
| 16 } | 19 event_log_host_(event_log_host) {} |
| 17 | 20 |
| 18 bool PeerConnectionTrackerHost::OnMessageReceived(const IPC::Message& message) { | 21 bool PeerConnectionTrackerHost::OnMessageReceived(const IPC::Message& message) { |
| 19 bool handled = true; | 22 bool handled = true; |
| 20 | 23 |
| 21 IPC_BEGIN_MESSAGE_MAP(PeerConnectionTrackerHost, message) | 24 IPC_BEGIN_MESSAGE_MAP(PeerConnectionTrackerHost, message) |
| 22 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_AddPeerConnection, | 25 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_AddPeerConnection, |
| 23 OnAddPeerConnection) | 26 OnAddPeerConnection) |
| 24 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_RemovePeerConnection, | 27 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_RemovePeerConnection, |
| 25 OnRemovePeerConnection) | 28 OnRemovePeerConnection) |
| 26 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_UpdatePeerConnection, | 29 IPC_MESSAGE_HANDLER(PeerConnectionTrackerHost_UpdatePeerConnection, |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 64 | 67 |
| 65 void PeerConnectionTrackerHost::OnAddPeerConnection( | 68 void PeerConnectionTrackerHost::OnAddPeerConnection( |
| 66 const PeerConnectionInfo& info) { | 69 const PeerConnectionInfo& info) { |
| 67 WebRTCInternals::GetInstance()->OnAddPeerConnection( | 70 WebRTCInternals::GetInstance()->OnAddPeerConnection( |
| 68 render_process_id_, | 71 render_process_id_, |
| 69 peer_pid(), | 72 peer_pid(), |
| 70 info.lid, | 73 info.lid, |
| 71 info.url, | 74 info.url, |
| 72 info.rtc_configuration, | 75 info.rtc_configuration, |
| 73 info.constraints); | 76 info.constraints); |
| 77 event_log_host_->PeerConnectionAdded(info.lid); |
| 74 } | 78 } |
| 75 | 79 |
| 76 void PeerConnectionTrackerHost::OnRemovePeerConnection(int lid) { | 80 void PeerConnectionTrackerHost::OnRemovePeerConnection(int lid) { |
| 77 WebRTCInternals::GetInstance()->OnRemovePeerConnection(peer_pid(), lid); | 81 WebRTCInternals::GetInstance()->OnRemovePeerConnection(peer_pid(), lid); |
| 82 event_log_host_->PeerConnectionRemoved(lid); |
| 78 } | 83 } |
| 79 | 84 |
| 80 void PeerConnectionTrackerHost::OnUpdatePeerConnection( | 85 void PeerConnectionTrackerHost::OnUpdatePeerConnection( |
| 81 int lid, const std::string& type, const std::string& value) { | 86 int lid, const std::string& type, const std::string& value) { |
| 82 WebRTCInternals::GetInstance()->OnUpdatePeerConnection( | 87 WebRTCInternals::GetInstance()->OnUpdatePeerConnection( |
| 83 peer_pid(), | 88 peer_pid(), |
| 84 lid, | 89 lid, |
| 85 type, | 90 type, |
| 86 value); | 91 value); |
| 87 } | 92 } |
| (...skipping 25 matching lines...) Expand all Loading... |
| 113 | 118 |
| 114 void PeerConnectionTrackerHost::SendOnSuspendOnUIThread() { | 119 void PeerConnectionTrackerHost::SendOnSuspendOnUIThread() { |
| 115 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 120 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 116 content::RenderProcessHost* host = | 121 content::RenderProcessHost* host = |
| 117 content::RenderProcessHost::FromID(render_process_id_); | 122 content::RenderProcessHost::FromID(render_process_id_); |
| 118 if (host) | 123 if (host) |
| 119 host->Send(new PeerConnectionTracker_OnSuspend()); | 124 host->Send(new PeerConnectionTracker_OnSuspend()); |
| 120 } | 125 } |
| 121 | 126 |
| 122 } // namespace content | 127 } // namespace content |
| OLD | NEW |