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

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

Issue 2886603003: Convert //content/browser/webrtc to be clients of WakeLock mojo service. (Closed)
Patch Set: Addressed chfremer@'s review comments Created 3 years, 7 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 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 cc5324fd3a9e00c6f6890ae11be145c2610504d4..c6dbb32142722aa82d0b3195f804dfe3a84677b8 100644
--- a/content/browser/webrtc/webrtc_internals.h
+++ b/content/browser/webrtc/webrtc_internals.h
@@ -19,13 +19,10 @@
#include "base/values.h"
#include "content/common/content_export.h"
#include "content/public/browser/render_process_host_observer.h"
+#include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h"
#include "media/media_features.h"
#include "ui/shell_dialogs/select_file_dialog.h"
-namespace device {
-class PowerSaveBlocker;
-} // namespace device
-
namespace content {
class WebContents;
@@ -111,7 +108,6 @@ class CONTENT_EXPORT WebRTCInternals : public RenderProcessHostObserver,
const base::FilePath& GetEventLogFilePath() const;
int num_open_connections() const { return num_open_connections_; }
- bool IsPowerSavingBlocked() const { return !!power_save_blocker_; }
protected:
// Constructor/Destructor are protected to allow tests to derive from the
@@ -122,6 +118,8 @@ class CONTENT_EXPORT WebRTCInternals : public RenderProcessHostObserver,
WebRTCInternals(int aggregate_updates_ms, bool should_block_power_saving);
~WebRTCInternals() override;
+ device::mojom::WakeLockServicePtr wake_lock_service_;
+
private:
friend struct base::LazyInstanceTraitsBase<WebRTCInternals>;
FRIEND_TEST_ALL_PREFIXES(WebRtcAudioDebugRecordingsBrowserTest,
@@ -165,9 +163,11 @@ class CONTENT_EXPORT WebRTCInternals : public RenderProcessHostObserver,
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
+ // request/cancel a wake lock on suspending the current application for power
// saving.
- void CreateOrReleasePowerSaveBlocker();
+ void UpdateWakeLock();
+
+ device::mojom::WakeLockService* GetWakeLockService();
// Called on a timer to deliver updates to javascript.
// We throttle and bulk together updates to avoid DOS like scenarios where
@@ -218,11 +218,9 @@ class CONTENT_EXPORT WebRTCInternals : public RenderProcessHostObserver,
bool selecting_event_log_;
base::FilePath event_log_recordings_file_path_;
- // While |num_open_connections_| is greater than zero, hold an instance of
- // PowerSaveBlocker. This prevents the application from being suspended while
- // remoting.
+ // While |num_open_connections_| is greater than zero, request a wake lock
+ // service. 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_;
// Set of render process hosts that |this| is registered as an observer on.
« 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