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

Unified Diff: content/browser/webrtc/webrtc_internals.h

Issue 2502413002: Release PowerSaveBlock on PeerConnection stop instead of removal (Closed)
Patch Set: Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | content/browser/webrtc/webrtc_internals.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/webrtc/webrtc_internals.h
diff --git a/content/browser/webrtc/webrtc_internals.h b/content/browser/webrtc/webrtc_internals.h
index b98088a2e1174cbe328cb56785c06c5523e1923a..66f8cd1c4a15705e4737ef27901f052fa14df5e6 100644
--- a/content/browser/webrtc/webrtc_internals.h
+++ b/content/browser/webrtc/webrtc_internals.h
@@ -7,6 +7,7 @@
#include <memory>
#include <queue>
+#include <string>
#include "base/containers/hash_tables.h"
#include "base/gtest_prod_util.h"
@@ -108,6 +109,9 @@ class CONTENT_EXPORT WebRTCInternals : public RenderProcessHostObserver,
bool IsEventLogRecordingsEnabled() const;
const base::FilePath& GetEventLogFilePath() const;
+ int num_open_connections() { return num_open_connections_; }
tommi (sloooow) - chröme 2016/11/17 18:27:04 Make these const?
+ bool IsPowerSavingBlocked() { return !!power_save_blocker_; }
+
protected:
// Constructor/Destructor are protected to allow tests to derive from the
// class and do per-instance testing without having to use the global
@@ -153,9 +157,13 @@ class CONTENT_EXPORT WebRTCInternals : public RenderProcessHostObserver,
void EnableEventLogRecordingsOnAllRenderProcessHosts();
#endif
- // Called whenever an element is added to or removed from
- // |peer_connection_data_| to impose/release a block on suspending the current
- // application for power-saving.
+ // Updates the number of open PeerConnections. Called when a PeerConnection
+ // is stopped or removed.
+ void MaybeClosePeerConnection(base::DictionaryValue* record);
+
+ // Called whenever a PeerConnection is created or stopped in order to
+ // impose/release a block on suspending the current application for power
+ // saving.
void CreateOrReleasePowerSaveBlocker();
// Called on a timer to deliver updates to javascript.
@@ -203,9 +211,10 @@ class CONTENT_EXPORT WebRTCInternals : public RenderProcessHostObserver,
bool selecting_event_log_;
base::FilePath event_log_recordings_file_path_;
- // While |peer_connection_data_| is non-empty, hold an instance of
+ // While |num_open_connections_| is greater than zero, hold an instance of
// PowerSaveBlocker. This prevents the application from being suspended while
// remoting.
+ int num_open_connections_;
std::unique_ptr<device::PowerSaveBlocker> power_save_blocker_;
const bool should_block_power_saving_;
« no previous file with comments | « no previous file | content/browser/webrtc/webrtc_internals.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698