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

Side by Side Diff: content/browser/webrtc/webrtc_internals.h

Issue 2921823002: Rationalize WakeLock naming conventions (Closed)
Patch Set: fix Mac compile error Created 3 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 #ifndef CONTENT_BROWSER_WEBRTC_WEBRTC_INTERNALS_H_ 5 #ifndef CONTENT_BROWSER_WEBRTC_WEBRTC_INTERNALS_H_
6 #define CONTENT_BROWSER_WEBRTC_WEBRTC_INTERNALS_H_ 6 #define CONTENT_BROWSER_WEBRTC_WEBRTC_INTERNALS_H_
7 7
8 #include <memory> 8 #include <memory>
9 #include <queue> 9 #include <queue>
10 #include <string> 10 #include <string>
11 11
12 #include "base/containers/hash_tables.h" 12 #include "base/containers/hash_tables.h"
13 #include "base/gtest_prod_util.h" 13 #include "base/gtest_prod_util.h"
14 #include "base/lazy_instance.h" 14 #include "base/lazy_instance.h"
15 #include "base/memory/weak_ptr.h" 15 #include "base/memory/weak_ptr.h"
16 #include "base/observer_list.h" 16 #include "base/observer_list.h"
17 #include "base/process/process.h" 17 #include "base/process/process.h"
18 #include "base/threading/thread_checker.h" 18 #include "base/threading/thread_checker.h"
19 #include "base/values.h" 19 #include "base/values.h"
20 #include "content/common/content_export.h" 20 #include "content/common/content_export.h"
21 #include "content/public/browser/render_process_host_observer.h" 21 #include "content/public/browser/render_process_host_observer.h"
22 #include "device/wake_lock/public/interfaces/wake_lock_service.mojom.h" 22 #include "device/wake_lock/public/interfaces/wake_lock.mojom.h"
23 #include "media/media_features.h" 23 #include "media/media_features.h"
24 #include "ui/shell_dialogs/select_file_dialog.h" 24 #include "ui/shell_dialogs/select_file_dialog.h"
25 25
26 namespace content { 26 namespace content {
27 27
28 class WebContents; 28 class WebContents;
29 class WebRTCInternalsUIObserver; 29 class WebRTCInternalsUIObserver;
30 30
31 // This is a singleton class running in the browser UI thread. 31 // This is a singleton class running in the browser UI thread.
32 // It collects peer connection infomation from the renderers, 32 // It collects peer connection infomation from the renderers,
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 111
112 protected: 112 protected:
113 // Constructor/Destructor are protected to allow tests to derive from the 113 // Constructor/Destructor are protected to allow tests to derive from the
114 // class and do per-instance testing without having to use the global 114 // class and do per-instance testing without having to use the global
115 // instance. 115 // instance.
116 // The default ctor sets |aggregate_updates_ms| to 500ms. 116 // The default ctor sets |aggregate_updates_ms| to 500ms.
117 WebRTCInternals(); 117 WebRTCInternals();
118 WebRTCInternals(int aggregate_updates_ms, bool should_block_power_saving); 118 WebRTCInternals(int aggregate_updates_ms, bool should_block_power_saving);
119 ~WebRTCInternals() override; 119 ~WebRTCInternals() override;
120 120
121 device::mojom::WakeLockServicePtr wake_lock_service_; 121 device::mojom::WakeLockPtr wake_lock_service_;
122 122
123 private: 123 private:
124 friend struct base::LazyInstanceTraitsBase<WebRTCInternals>; 124 friend struct base::LazyInstanceTraitsBase<WebRTCInternals>;
125 FRIEND_TEST_ALL_PREFIXES(WebRtcAudioDebugRecordingsBrowserTest, 125 FRIEND_TEST_ALL_PREFIXES(WebRtcAudioDebugRecordingsBrowserTest,
126 CallWithAudioDebugRecordings); 126 CallWithAudioDebugRecordings);
127 FRIEND_TEST_ALL_PREFIXES(WebRtcAudioDebugRecordingsBrowserTest, 127 FRIEND_TEST_ALL_PREFIXES(WebRtcAudioDebugRecordingsBrowserTest,
128 CallWithAudioDebugRecordingsEnabledThenDisabled); 128 CallWithAudioDebugRecordingsEnabledThenDisabled);
129 FRIEND_TEST_ALL_PREFIXES(WebRtcAudioDebugRecordingsBrowserTest, 129 FRIEND_TEST_ALL_PREFIXES(WebRtcAudioDebugRecordingsBrowserTest,
130 TwoCallsWithAudioDebugRecordings); 130 TwoCallsWithAudioDebugRecordings);
131 FRIEND_TEST_ALL_PREFIXES(WebRtcInternalsTest, 131 FRIEND_TEST_ALL_PREFIXES(WebRtcInternalsTest,
(...skipping 28 matching lines...) Expand all
160 160
161 // Updates the number of open PeerConnections. Called when a PeerConnection 161 // Updates the number of open PeerConnections. Called when a PeerConnection
162 // is stopped or removed. 162 // is stopped or removed.
163 void MaybeClosePeerConnection(base::DictionaryValue* record); 163 void MaybeClosePeerConnection(base::DictionaryValue* record);
164 164
165 // Called whenever a PeerConnection is created or stopped in order to 165 // Called whenever a PeerConnection is created or stopped in order to
166 // request/cancel a wake lock on suspending the current application for power 166 // request/cancel a wake lock on suspending the current application for power
167 // saving. 167 // saving.
168 void UpdateWakeLock(); 168 void UpdateWakeLock();
169 169
170 device::mojom::WakeLockService* GetWakeLockService(); 170 device::mojom::WakeLock* GetWakeLockService();
blundell 2017/06/05 11:48:11 nit: GetWakeLock()
juncai 2017/06/05 18:58:25 Done.
171 171
172 // Called on a timer to deliver updates to javascript. 172 // Called on a timer to deliver updates to javascript.
173 // We throttle and bulk together updates to avoid DOS like scenarios where 173 // We throttle and bulk together updates to avoid DOS like scenarios where
174 // a page uses a lot of peerconnection instances with many event 174 // a page uses a lot of peerconnection instances with many event
175 // notifications. 175 // notifications.
176 void ProcessPendingUpdates(); 176 void ProcessPendingUpdates();
177 177
178 base::DictionaryValue* FindRecord(base::ProcessId pid, 178 base::DictionaryValue* FindRecord(base::ProcessId pid,
179 int lid, 179 int lid,
180 size_t* index = nullptr); 180 size_t* index = nullptr);
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
254 std::queue<PendingUpdate> pending_updates_; 254 std::queue<PendingUpdate> pending_updates_;
255 const int aggregate_updates_ms_; 255 const int aggregate_updates_ms_;
256 256
257 // Weak factory for this object that we use for bulking up updates. 257 // Weak factory for this object that we use for bulking up updates.
258 base::WeakPtrFactory<WebRTCInternals> weak_factory_; 258 base::WeakPtrFactory<WebRTCInternals> weak_factory_;
259 }; 259 };
260 260
261 } // namespace content 261 } // namespace content
262 262
263 #endif // CONTENT_BROWSER_WEBRTC_WEBRTC_INTERNALS_H_ 263 #endif // CONTENT_BROWSER_WEBRTC_WEBRTC_INTERNALS_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698