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

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

Issue 2072403002: Remove content/browser/power_save_blocker_factory.* (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: gyp 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"
11 #include "content/browser/media/webrtc/webrtc_internals_ui_observer.h" 11 #include "content/browser/media/webrtc/webrtc_internals_ui_observer.h"
12 #include "content/browser/power_save_blocker_factory.h"
13 #include "content/browser/web_contents/web_contents_view.h" 12 #include "content/browser/web_contents/web_contents_view.h"
14 #include "content/public/browser/browser_thread.h" 13 #include "content/public/browser/browser_thread.h"
15 #include "content/public/browser/content_browser_client.h" 14 #include "content/public/browser/content_browser_client.h"
16 #include "content/public/browser/render_process_host.h" 15 #include "content/public/browser/render_process_host.h"
17 #include "content/public/browser/web_contents.h" 16 #include "content/public/browser/web_contents.h"
17 #include "device/power_save_blocker/power_save_blocker.h"
18 18
19 using base::ProcessId; 19 using base::ProcessId;
20 using std::string; 20 using std::string;
21 21
22 namespace content { 22 namespace content {
23 23
24 namespace { 24 namespace {
25 25
26 static base::LazyInstance<WebRTCInternals>::Leaky g_webrtc_internals = 26 static base::LazyInstance<WebRTCInternals>::Leaky g_webrtc_internals =
27 LAZY_INSTANCE_INITIALIZER; 27 LAZY_INSTANCE_INITIALIZER;
(...skipping 465 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_ = content::CreatePowerSaveBlocker( 503 power_save_blocker_ = device::PowerSaveBlocker::CreateWithTaskRunners(
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),
508 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::FILE));
507 } 509 }
508 } 510 }
509 511
510 void WebRTCInternals::ProcessPendingUpdates() { 512 void WebRTCInternals::ProcessPendingUpdates() {
511 DCHECK_CURRENTLY_ON(BrowserThread::UI); 513 DCHECK_CURRENTLY_ON(BrowserThread::UI);
512 while (!pending_updates_.empty()) { 514 while (!pending_updates_.empty()) {
513 const auto& update = pending_updates_.front(); 515 const auto& update = pending_updates_.front();
514 FOR_EACH_OBSERVER(WebRTCInternalsUIObserver, 516 FOR_EACH_OBSERVER(WebRTCInternalsUIObserver,
515 observers_, 517 observers_,
516 OnUpdate(update.command(), update.value())); 518 OnUpdate(update.command(), update.value()));
517 pending_updates_.pop(); 519 pending_updates_.pop();
518 } 520 }
519 } 521 }
520 522
521 } // namespace content 523 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/media_web_contents_observer.cc ('k') | content/browser/power_save_blocker_factory.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698