| 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" | 
| 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" | 
|  | 15 #include "content/public/browser/power_save_blocker_factory.h" | 
| 16 #include "content/public/browser/render_process_host.h" | 16 #include "content/public/browser/render_process_host.h" | 
| 17 #include "content/public/browser/web_contents.h" | 17 #include "content/public/browser/web_contents.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 | 
| (...skipping 468 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         device::PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, | 504         PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, | 
| 505         device::PowerSaveBlocker::kReasonOther, | 505         PowerSaveBlocker::kReasonOther, "WebRTC has active PeerConnections"); | 
| 506         "WebRTC has active PeerConnections"); |  | 
| 507   } | 506   } | 
| 508 } | 507 } | 
| 509 | 508 | 
| 510 void WebRTCInternals::ProcessPendingUpdates() { | 509 void WebRTCInternals::ProcessPendingUpdates() { | 
| 511   DCHECK_CURRENTLY_ON(BrowserThread::UI); | 510   DCHECK_CURRENTLY_ON(BrowserThread::UI); | 
| 512   while (!pending_updates_.empty()) { | 511   while (!pending_updates_.empty()) { | 
| 513     const auto& update = pending_updates_.front(); | 512     const auto& update = pending_updates_.front(); | 
| 514     FOR_EACH_OBSERVER(WebRTCInternalsUIObserver, | 513     FOR_EACH_OBSERVER(WebRTCInternalsUIObserver, | 
| 515                       observers_, | 514                       observers_, | 
| 516                       OnUpdate(update.command(), update.value())); | 515                       OnUpdate(update.command(), update.value())); | 
| 517     pending_updates_.pop(); | 516     pending_updates_.pop(); | 
| 518   } | 517   } | 
| 519 } | 518 } | 
| 520 | 519 | 
| 521 }  // namespace content | 520 }  // namespace content | 
| OLD | NEW | 
|---|