Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(374)

Unified Diff: chrome/browser/media/cast_transport_host_filter.cc

Issue 448953002: Impose PowerSaveBlock while remoting content via Cast or WebRTC. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/media/cast_transport_host_filter.h ('k') | content/browser/media/webrtc_internals.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/media/cast_transport_host_filter.cc
diff --git a/chrome/browser/media/cast_transport_host_filter.cc b/chrome/browser/media/cast_transport_host_filter.cc
index 0d8309a268ddcaf2c66f615453e48c0566565d11..f56bef7ad3c457f3998ea93ef2822bbb767f2a8b 100644
--- a/chrome/browser/media/cast_transport_host_filter.cc
+++ b/chrome/browser/media/cast_transport_host_filter.cc
@@ -6,6 +6,7 @@
#include "chrome/browser/browser_process.h"
#include "chrome/browser/net/chrome_net_log.h"
+#include "content/public/browser/power_save_blocker.h"
#include "media/cast/net/cast_transport_sender.h"
namespace {
@@ -83,6 +84,14 @@ void CastTransportHostFilter::SendCastMessage(
void CastTransportHostFilter::OnNew(
int32 channel_id,
const net::IPEndPoint& remote_end_point) {
+ if (!power_save_blocker_) {
+ DVLOG(1) << ("Preventing the application from being suspended while one or "
+ "more transports are active for Cast Streaming.");
+ power_save_blocker_ = content::PowerSaveBlocker::Create(
+ content::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension,
+ "Cast is streaming content to a remote receiver.").Pass();
+ }
+
if (id_map_.Lookup(channel_id)) {
id_map_.Remove(channel_id);
}
@@ -112,6 +121,13 @@ void CastTransportHostFilter::OnDelete(int32 channel_id) {
DVLOG(1) << "CastTransportHostFilter::Delete called "
<< "on non-existing channel";
}
+
+ if (id_map_.IsEmpty()) {
+ DVLOG_IF(1, power_save_blocker_) <<
+ ("Releasing the block on application suspension since no transports "
+ "are active anymore for Cast Streaming.");
+ power_save_blocker_.reset();
+ }
}
void CastTransportHostFilter::OnInitializeAudio(
« no previous file with comments | « chrome/browser/media/cast_transport_host_filter.h ('k') | content/browser/media/webrtc_internals.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698