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

Side by Side Diff: content/browser/media/webrtc/webrtc_internals.cc

Issue 2073353002: Merge PowerSaveBlockerImpl and PowerSaveBlocker (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@remove-power-factory
Patch Set: android Created 4 years, 6 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 unified diff | Download patch
OLDNEW
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 482 matching lines...) Expand 10 before | Expand all | Expand 10 after
493 void WebRTCInternals::CreateOrReleasePowerSaveBlocker() { 493 void WebRTCInternals::CreateOrReleasePowerSaveBlocker() {
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_ = device::PowerSaveBlocker::CreateWithTaskRunners( 503 power_save_blocker_.reset(new device::PowerSaveBlocker(
504 device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, 504 device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension,
505 device::PowerSaveBlocker::kReasonOther, 505 device::PowerSaveBlocker::kReasonOther,
506 "WebRTC has active PeerConnections", 506 "WebRTC has active PeerConnections",
507 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI), 507 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::UI),
508 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)); 508 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE)));
509 } 509 }
510 } 510 }
511 511
512 void WebRTCInternals::ProcessPendingUpdates() { 512 void WebRTCInternals::ProcessPendingUpdates() {
513 DCHECK_CURRENTLY_ON(BrowserThread::UI); 513 DCHECK_CURRENTLY_ON(BrowserThread::UI);
514 while (!pending_updates_.empty()) { 514 while (!pending_updates_.empty()) {
515 const auto& update = pending_updates_.front(); 515 const auto& update = pending_updates_.front();
516 FOR_EACH_OBSERVER(WebRTCInternalsUIObserver, 516 FOR_EACH_OBSERVER(WebRTCInternalsUIObserver,
517 observers_, 517 observers_,
518 OnUpdate(update.command(), update.value())); 518 OnUpdate(update.command(), update.value()));
519 pending_updates_.pop(); 519 pending_updates_.pop();
520 } 520 }
521 } 521 }
522 522
523 } // namespace content 523 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/media_web_contents_observer.cc ('k') | content/browser/renderer_host/render_widget_host_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698