| Index: content/browser/renderer_host/media/peer_connection_tracker_host.cc
|
| diff --git a/content/browser/renderer_host/media/peer_connection_tracker_host.cc b/content/browser/renderer_host/media/peer_connection_tracker_host.cc
|
| index ac863e7eb898e825ed504abcb11b8dc7a83adb9a..b1e286949bdac2294c2b0651c58073cbcfed417d 100644
|
| --- a/content/browser/renderer_host/media/peer_connection_tracker_host.cc
|
| +++ b/content/browser/renderer_host/media/peer_connection_tracker_host.cc
|
| @@ -3,14 +3,20 @@
|
| // found in the LICENSE file.
|
| #include "content/browser/renderer_host/media/peer_connection_tracker_host.h"
|
|
|
| +#include "base/power_monitor/power_monitor.h"
|
| #include "content/browser/media/webrtc_internals.h"
|
| #include "content/common/media/peer_connection_tracker_messages.h"
|
| +#include "content/public/browser/render_process_host.h"
|
|
|
| namespace content {
|
|
|
| PeerConnectionTrackerHost::PeerConnectionTrackerHost(int render_process_id)
|
| : BrowserMessageFilter(PeerConnectionTrackerMsgStart),
|
| - render_process_id_(render_process_id) {}
|
| + render_process_id_(render_process_id) {
|
| + base::PowerMonitor* power_monitor = base::PowerMonitor::Get();
|
| + if (power_monitor)
|
| + power_monitor->AddObserver(this);
|
| +}
|
|
|
| bool PeerConnectionTrackerHost::OnMessageReceived(const IPC::Message& message) {
|
| bool handled = true;
|
| @@ -36,6 +42,9 @@ void PeerConnectionTrackerHost::OverrideThreadForMessage(
|
| }
|
|
|
| PeerConnectionTrackerHost::~PeerConnectionTrackerHost() {
|
| + base::PowerMonitor* power_monitor = base::PowerMonitor::Get();
|
| + if (power_monitor)
|
| + power_monitor->RemoveObserver(this);
|
| }
|
|
|
| void PeerConnectionTrackerHost::OnAddPeerConnection(
|
| @@ -82,4 +91,11 @@ void PeerConnectionTrackerHost::OnGetUserMedia(
|
| video_constraints);
|
| }
|
|
|
| +void PeerConnectionTrackerHost::OnSuspend() {
|
| + content::RenderProcessHost* host =
|
| + content::RenderProcessHost::FromID(render_process_id_);
|
| + if (host)
|
| + host->Send(new PeerConnectionTracker_OnSuspend());
|
| +}
|
| +
|
| } // namespace content
|
|
|