| 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/webrtc_internals.h" | 5 #include "content/browser/media/webrtc/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 483 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 494 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 494 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 495 | 495 |
| 496 if (peer_connection_data_.empty() && power_save_blocker_) { | 496 if (peer_connection_data_.empty() && power_save_blocker_) { |
| 497 DVLOG(1) << ("Releasing the block on application suspension since no " | 497 DVLOG(1) << ("Releasing the block on application suspension since no " |
| 498 "PeerConnections are active anymore."); | 498 "PeerConnections are active anymore."); |
| 499 power_save_blocker_.reset(); | 499 power_save_blocker_.reset(); |
| 500 } else if (!peer_connection_data_.empty() && !power_save_blocker_) { | 500 } else if (!peer_connection_data_.empty() && !power_save_blocker_) { |
| 501 DVLOG(1) << ("Preventing the application from being suspended while one or " | 501 DVLOG(1) << ("Preventing the application from being suspended while one or " |
| 502 "more PeerConnections are active."); | 502 "more PeerConnections are active."); |
| 503 power_save_blocker_ = content::CreatePowerSaveBlocker( | 503 power_save_blocker_ = content::CreatePowerSaveBlocker( |
| 504 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, | 504 device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, |
| 505 PowerSaveBlocker::kReasonOther, "WebRTC has active PeerConnections"); | 505 device::PowerSaveBlocker::kReasonOther, |
| 506 "WebRTC has active PeerConnections"); |
| 506 } | 507 } |
| 507 } | 508 } |
| 508 | 509 |
| 509 void WebRTCInternals::ProcessPendingUpdates() { | 510 void WebRTCInternals::ProcessPendingUpdates() { |
| 510 DCHECK_CURRENTLY_ON(BrowserThread::UI); | 511 DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| 511 while (!pending_updates_.empty()) { | 512 while (!pending_updates_.empty()) { |
| 512 const auto& update = pending_updates_.front(); | 513 const auto& update = pending_updates_.front(); |
| 513 FOR_EACH_OBSERVER(WebRTCInternalsUIObserver, | 514 FOR_EACH_OBSERVER(WebRTCInternalsUIObserver, |
| 514 observers_, | 515 observers_, |
| 515 OnUpdate(update.command(), update.value())); | 516 OnUpdate(update.command(), update.value())); |
| 516 pending_updates_.pop(); | 517 pending_updates_.pop(); |
| 517 } | 518 } |
| 518 } | 519 } |
| 519 | 520 |
| 520 } // namespace content | 521 } // namespace content |
| OLD | NEW |