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