| 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 | 4 |
| 5 #include "content/browser/media/webrtc_internals.h" | 5 #include "content/browser/media/webrtc_internals.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include "base/strings/string_number_conversions.h" | 9 #include "base/strings/string_number_conversions.h" |
| 10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
| (...skipping 463 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 474 void WebRTCInternals::CreateOrReleasePowerSaveBlocker() { | 474 void WebRTCInternals::CreateOrReleasePowerSaveBlocker() { |
| 475 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 475 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 476 | 476 |
| 477 if (peer_connection_data_.empty() && power_save_blocker_) { | 477 if (peer_connection_data_.empty() && power_save_blocker_) { |
| 478 DVLOG(1) << ("Releasing the block on application suspension since no " | 478 DVLOG(1) << ("Releasing the block on application suspension since no " |
| 479 "PeerConnections are active anymore."); | 479 "PeerConnections are active anymore."); |
| 480 power_save_blocker_.reset(); | 480 power_save_blocker_.reset(); |
| 481 } else if (!peer_connection_data_.empty() && !power_save_blocker_) { | 481 } else if (!peer_connection_data_.empty() && !power_save_blocker_) { |
| 482 DVLOG(1) << ("Preventing the application from being suspended while one or " | 482 DVLOG(1) << ("Preventing the application from being suspended while one or " |
| 483 "more PeerConnections are active."); | 483 "more PeerConnections are active."); |
| 484 power_save_blocker_ = | 484 power_save_blocker_ = content::PowerSaveBlocker::Create( |
| 485 content::PowerSaveBlocker::Create( | 485 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, |
| 486 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, | 486 PowerSaveBlocker::kReasonOther, "WebRTC has active PeerConnections"); |
| 487 PowerSaveBlocker::kReasonOther, | |
| 488 "WebRTC has active PeerConnections").Pass(); | |
| 489 } | 487 } |
| 490 } | 488 } |
| 491 | 489 |
| 492 } // namespace content | 490 } // namespace content |
| OLD | NEW |