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

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

Issue 1676043002: Deliver webrtc-internals updates in bulk, every 500ms at most. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix gn build Created 4 years, 10 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_internals.h" 5 #include "content/browser/media/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"
(...skipping 21 matching lines...) Expand all
32 if (!dict->GetList("log", &log)) { 32 if (!dict->GetList("log", &log)) {
33 log = new base::ListValue(); 33 log = new base::ListValue();
34 if (log) 34 if (log)
35 dict->Set("log", log); 35 dict->Set("log", log);
36 } 36 }
37 return log; 37 return log;
38 } 38 }
39 39
40 } // namespace 40 } // namespace
41 41
42 WebRTCInternals::WebRTCInternals() 42 WebRTCInternals::PendingUpdate::PendingUpdate(
43 const std::string& command, scoped_ptr<base::Value> value)
44 : command_(command), value_(std::move(value)) {}
45
46 WebRTCInternals::PendingUpdate::PendingUpdate(PendingUpdate&& other)
47 : command_(std::move(other.command_)),
48 value_(std::move(other.value_)) {}
49
50 WebRTCInternals::PendingUpdate::~PendingUpdate() {}
51
52 WebRTCInternals::WebRTCInternals() : WebRTCInternals(500) {}
53
54 WebRTCInternals::WebRTCInternals(int aggregate_updates_ms)
43 : audio_debug_recordings_(false), 55 : audio_debug_recordings_(false),
44 event_log_recordings_(false), 56 event_log_recordings_(false),
45 selecting_event_log_(false) { 57 selecting_event_log_(false),
58 pending_updates_queued_(false),
59 aggregate_updates_ms_(aggregate_updates_ms),
60 weak_factory_(this) {
46 // TODO(grunell): Shouldn't all the webrtc_internals* files be excluded from the 61 // TODO(grunell): Shouldn't all the webrtc_internals* files be excluded from the
47 // build if WebRTC is disabled? 62 // build if WebRTC is disabled?
48 #if defined(ENABLE_WEBRTC) 63 #if defined(ENABLE_WEBRTC)
49 audio_debug_recordings_file_path_ = 64 audio_debug_recordings_file_path_ =
50 GetContentClient()->browser()->GetDefaultDownloadDirectory(); 65 GetContentClient()->browser()->GetDefaultDownloadDirectory();
51 event_log_recordings_file_path_ = audio_debug_recordings_file_path_; 66 event_log_recordings_file_path_ = audio_debug_recordings_file_path_;
52 67
53 if (audio_debug_recordings_file_path_.empty()) { 68 if (audio_debug_recordings_file_path_.empty()) {
54 // In this case the default path (|audio_debug_recordings_file_path_|) will 69 // In this case the default path (|audio_debug_recordings_file_path_|) will
55 // be empty and the platform default path will be used in the file dialog 70 // be empty and the platform default path will be used in the file dialog
(...skipping 19 matching lines...) Expand all
75 90
76 void WebRTCInternals::OnAddPeerConnection(int render_process_id, 91 void WebRTCInternals::OnAddPeerConnection(int render_process_id,
77 ProcessId pid, 92 ProcessId pid,
78 int lid, 93 int lid,
79 const string& url, 94 const string& url,
80 const string& rtc_configuration, 95 const string& rtc_configuration,
81 const string& constraints) { 96 const string& constraints) {
82 DCHECK_CURRENTLY_ON(BrowserThread::UI); 97 DCHECK_CURRENTLY_ON(BrowserThread::UI);
83 98
84 base::DictionaryValue* dict = new base::DictionaryValue(); 99 base::DictionaryValue* dict = new base::DictionaryValue();
85 if (!dict)
86 return;
87
88 dict->SetInteger("rid", render_process_id); 100 dict->SetInteger("rid", render_process_id);
89 dict->SetInteger("pid", static_cast<int>(pid)); 101 dict->SetInteger("pid", static_cast<int>(pid));
90 dict->SetInteger("lid", lid); 102 dict->SetInteger("lid", lid);
91 dict->SetString("rtcConfiguration", rtc_configuration); 103 dict->SetString("rtcConfiguration", rtc_configuration);
92 dict->SetString("constraints", constraints); 104 dict->SetString("constraints", constraints);
93 dict->SetString("url", url); 105 dict->SetString("url", url);
94 peer_connection_data_.Append(dict); 106 peer_connection_data_.Append(dict);
95 CreateOrReleasePowerSaveBlocker(); 107 CreateOrReleasePowerSaveBlocker();
96 108
97 if (observers_.might_have_observers()) 109 if (observers_.might_have_observers())
98 SendUpdate("addPeerConnection", dict); 110 SendUpdate("addPeerConnection", dict->CreateDeepCopy());
99 111
100 if (render_process_id_set_.insert(render_process_id).second) { 112 if (render_process_id_set_.insert(render_process_id).second) {
101 RenderProcessHost* host = RenderProcessHost::FromID(render_process_id); 113 RenderProcessHost* host = RenderProcessHost::FromID(render_process_id);
102 if (host) 114 if (host)
103 host->AddObserver(this); 115 host->AddObserver(this);
104 } 116 }
105 } 117 }
106 118
107 void WebRTCInternals::OnRemovePeerConnection(ProcessId pid, int lid) { 119 void WebRTCInternals::OnRemovePeerConnection(ProcessId pid, int lid) {
108 DCHECK_CURRENTLY_ON(BrowserThread::UI); 120 DCHECK_CURRENTLY_ON(BrowserThread::UI);
109 for (size_t i = 0; i < peer_connection_data_.GetSize(); ++i) { 121 for (size_t i = 0; i < peer_connection_data_.GetSize(); ++i) {
110 base::DictionaryValue* dict = NULL; 122 base::DictionaryValue* dict = NULL;
111 peer_connection_data_.GetDictionary(i, &dict); 123 peer_connection_data_.GetDictionary(i, &dict);
112 124
113 int this_pid = 0; 125 int this_pid = 0;
114 int this_lid = 0; 126 int this_lid = 0;
115 dict->GetInteger("pid", &this_pid); 127 dict->GetInteger("pid", &this_pid);
116 dict->GetInteger("lid", &this_lid); 128 dict->GetInteger("lid", &this_lid);
117 129
118 if (this_pid != static_cast<int>(pid) || this_lid != lid) 130 if (this_pid != static_cast<int>(pid) || this_lid != lid)
119 continue; 131 continue;
120 132
121 peer_connection_data_.Remove(i, NULL); 133 peer_connection_data_.Remove(i, NULL);
122 CreateOrReleasePowerSaveBlocker(); 134 CreateOrReleasePowerSaveBlocker();
123 135
124 if (observers_.might_have_observers()) { 136 if (observers_.might_have_observers()) {
125 base::DictionaryValue id; 137 scoped_ptr<base::DictionaryValue> id(new base::DictionaryValue());
126 id.SetInteger("pid", static_cast<int>(pid)); 138 id->SetInteger("pid", static_cast<int>(pid));
127 id.SetInteger("lid", lid); 139 id->SetInteger("lid", lid);
128 SendUpdate("removePeerConnection", &id); 140 SendUpdate("removePeerConnection", std::move(id));
129 } 141 }
130 break; 142 break;
131 } 143 }
132 } 144 }
133 145
134 void WebRTCInternals::OnUpdatePeerConnection( 146 void WebRTCInternals::OnUpdatePeerConnection(
135 ProcessId pid, int lid, const string& type, const string& value) { 147 ProcessId pid, int lid, const string& type, const string& value) {
136 DCHECK_CURRENTLY_ON(BrowserThread::UI); 148 DCHECK_CURRENTLY_ON(BrowserThread::UI);
137 149
138 for (size_t i = 0; i < peer_connection_data_.GetSize(); ++i) { 150 for (size_t i = 0; i < peer_connection_data_.GetSize(); ++i) {
(...skipping 17 matching lines...) Expand all
156 return; 168 return;
157 169
158 double epoch_time = base::Time::Now().ToJsTime(); 170 double epoch_time = base::Time::Now().ToJsTime();
159 string time = base::DoubleToString(epoch_time); 171 string time = base::DoubleToString(epoch_time);
160 log_entry->SetString("time", time); 172 log_entry->SetString("time", time);
161 log_entry->SetString("type", type); 173 log_entry->SetString("type", type);
162 log_entry->SetString("value", value); 174 log_entry->SetString("value", value);
163 log->Append(log_entry); 175 log->Append(log_entry);
164 176
165 if (observers_.might_have_observers()) { 177 if (observers_.might_have_observers()) {
166 base::DictionaryValue update; 178 scoped_ptr<base::DictionaryValue> update(new base::DictionaryValue());
167 update.SetInteger("pid", static_cast<int>(pid)); 179 update->SetInteger("pid", static_cast<int>(pid));
168 update.SetInteger("lid", lid); 180 update->SetInteger("lid", lid);
169 update.MergeDictionary(log_entry); 181 update->MergeDictionary(log_entry);
170 182
171 SendUpdate("updatePeerConnection", &update); 183 SendUpdate("updatePeerConnection", std::move(update));
172 } 184 }
173 return; 185 return;
174 } 186 }
175 } 187 }
176 188
177 void WebRTCInternals::OnAddStats(base::ProcessId pid, int lid, 189 void WebRTCInternals::OnAddStats(base::ProcessId pid, int lid,
178 const base::ListValue& value) { 190 const base::ListValue& value) {
179 if (!observers_.might_have_observers()) 191 if (!observers_.might_have_observers())
180 return; 192 return;
181 193
182 base::DictionaryValue dict; 194 scoped_ptr<base::DictionaryValue> dict(new base::DictionaryValue());
183 dict.SetInteger("pid", static_cast<int>(pid)); 195 dict->SetInteger("pid", static_cast<int>(pid));
184 dict.SetInteger("lid", lid); 196 dict->SetInteger("lid", lid);
185 197
186 base::ListValue* list = value.DeepCopy(); 198 dict->Set("reports", value.CreateDeepCopy());
187 if (!list)
188 return;
189 199
190 dict.Set("reports", list); 200 SendUpdate("addStats", std::move(dict));
191
192 SendUpdate("addStats", &dict);
193 } 201 }
194 202
195 void WebRTCInternals::OnGetUserMedia(int rid, 203 void WebRTCInternals::OnGetUserMedia(int rid,
196 base::ProcessId pid, 204 base::ProcessId pid,
197 const std::string& origin, 205 const std::string& origin,
198 bool audio, 206 bool audio,
199 bool video, 207 bool video,
200 const std::string& audio_constraints, 208 const std::string& audio_constraints,
201 const std::string& video_constraints) { 209 const std::string& video_constraints) {
202 DCHECK_CURRENTLY_ON(BrowserThread::UI); 210 DCHECK_CURRENTLY_ON(BrowserThread::UI);
203 211
204 base::DictionaryValue* dict = new base::DictionaryValue(); 212 base::DictionaryValue* dict = new base::DictionaryValue();
205 dict->SetInteger("rid", rid); 213 dict->SetInteger("rid", rid);
206 dict->SetInteger("pid", static_cast<int>(pid)); 214 dict->SetInteger("pid", static_cast<int>(pid));
207 dict->SetString("origin", origin); 215 dict->SetString("origin", origin);
208 if (audio) 216 if (audio)
209 dict->SetString("audio", audio_constraints); 217 dict->SetString("audio", audio_constraints);
210 if (video) 218 if (video)
211 dict->SetString("video", video_constraints); 219 dict->SetString("video", video_constraints);
212 220
213 get_user_media_requests_.Append(dict); 221 get_user_media_requests_.Append(dict);
214 222
215 if (observers_.might_have_observers()) 223 if (observers_.might_have_observers())
216 SendUpdate("addGetUserMedia", dict); 224 SendUpdate("addGetUserMedia", dict->CreateDeepCopy());
217 225
218 if (render_process_id_set_.insert(rid).second) { 226 if (render_process_id_set_.insert(rid).second) {
219 RenderProcessHost* host = RenderProcessHost::FromID(rid); 227 RenderProcessHost* host = RenderProcessHost::FromID(rid);
220 if (host) 228 if (host)
221 host->AddObserver(this); 229 host->AddObserver(this);
222 } 230 }
223 } 231 }
224 232
225 void WebRTCInternals::AddObserver(WebRTCInternalsUIObserver *observer) { 233 void WebRTCInternals::AddObserver(WebRTCInternalsUIObserver* observer) {
226 DCHECK_CURRENTLY_ON(BrowserThread::UI); 234 DCHECK_CURRENTLY_ON(BrowserThread::UI);
227 observers_.AddObserver(observer); 235 observers_.AddObserver(observer);
228 } 236 }
229 237
230 void WebRTCInternals::RemoveObserver(WebRTCInternalsUIObserver *observer) { 238 void WebRTCInternals::RemoveObserver(WebRTCInternalsUIObserver* observer) {
231 DCHECK_CURRENTLY_ON(BrowserThread::UI); 239 DCHECK_CURRENTLY_ON(BrowserThread::UI);
232 observers_.RemoveObserver(observer); 240 observers_.RemoveObserver(observer);
233 241
234 // Disables audio debug recordings if it is enabled and the last 242 // Disables audio debug recordings if it is enabled and the last
235 // webrtc-internals page is going away. 243 // webrtc-internals page is going away.
236 if (audio_debug_recordings_ && !observers_.might_have_observers()) 244 if (audio_debug_recordings_ && !observers_.might_have_observers())
237 DisableAudioDebugRecordings(); 245 DisableAudioDebugRecordings();
238 } 246 }
239 247
240 void WebRTCInternals::UpdateObserver(WebRTCInternalsUIObserver* observer) { 248 void WebRTCInternals::UpdateObserver(WebRTCInternalsUIObserver* observer) {
241 DCHECK_CURRENTLY_ON(BrowserThread::UI); 249 DCHECK_CURRENTLY_ON(BrowserThread::UI);
242 if (peer_connection_data_.GetSize() > 0) 250 if (peer_connection_data_.GetSize() > 0)
243 observer->OnUpdate("updateAllPeerConnections", &peer_connection_data_); 251 observer->OnUpdate("updateAllPeerConnections", &peer_connection_data_);
244 252
245 for (base::ListValue::iterator it = get_user_media_requests_.begin(); 253 for (base::ListValue::iterator it = get_user_media_requests_.begin();
246 it != get_user_media_requests_.end(); 254 it != get_user_media_requests_.end();
247 ++it) { 255 ++it) {
248 observer->OnUpdate("addGetUserMedia", *it); 256 observer->OnUpdate("addGetUserMedia", *it);
249 } 257 }
250 } 258 }
251 259
252 void WebRTCInternals::EnableAudioDebugRecordings( 260 void WebRTCInternals::EnableAudioDebugRecordings(
253 content::WebContents* web_contents) { 261 content::WebContents* web_contents) {
262 DCHECK_CURRENTLY_ON(BrowserThread::UI);
254 #if defined(ENABLE_WEBRTC) 263 #if defined(ENABLE_WEBRTC)
255 DCHECK_CURRENTLY_ON(BrowserThread::UI);
256 #if defined(OS_ANDROID) 264 #if defined(OS_ANDROID)
257 EnableAudioDebugRecordingsOnAllRenderProcessHosts(); 265 EnableAudioDebugRecordingsOnAllRenderProcessHosts();
258 #else 266 #else
259 selecting_event_log_ = false; 267 selecting_event_log_ = false;
260 DCHECK(select_file_dialog_ == nullptr); 268 DCHECK(select_file_dialog_ == nullptr);
261 select_file_dialog_ = ui::SelectFileDialog::Create(this, NULL); 269 select_file_dialog_ = ui::SelectFileDialog::Create(this, NULL);
262 select_file_dialog_->SelectFile( 270 select_file_dialog_->SelectFile(
263 ui::SelectFileDialog::SELECT_SAVEAS_FILE, 271 ui::SelectFileDialog::SELECT_SAVEAS_FILE,
264 base::string16(), 272 base::string16(),
265 audio_debug_recordings_file_path_, 273 audio_debug_recordings_file_path_,
266 NULL, 274 NULL,
267 0, 275 0,
268 FILE_PATH_LITERAL(""), 276 FILE_PATH_LITERAL(""),
269 web_contents->GetTopLevelNativeWindow(), 277 web_contents->GetTopLevelNativeWindow(),
270 NULL); 278 NULL);
271 #endif 279 #endif
272 #endif 280 #endif
273 } 281 }
274 282
275 void WebRTCInternals::DisableAudioDebugRecordings() { 283 void WebRTCInternals::DisableAudioDebugRecordings() {
284 DCHECK_CURRENTLY_ON(BrowserThread::UI);
276 #if defined(ENABLE_WEBRTC) 285 #if defined(ENABLE_WEBRTC)
277 DCHECK_CURRENTLY_ON(BrowserThread::UI);
278 audio_debug_recordings_ = false; 286 audio_debug_recordings_ = false;
279 287
280 // Tear down the dialog since the user has unchecked the audio debug 288 // Tear down the dialog since the user has unchecked the audio debug
281 // recordings box. 289 // recordings box.
282 select_file_dialog_ = NULL; 290 select_file_dialog_ = NULL;
283 291
284 for (RenderProcessHost::iterator i( 292 for (RenderProcessHost::iterator i(
285 content::RenderProcessHost::AllHostsIterator()); 293 content::RenderProcessHost::AllHostsIterator());
286 !i.IsAtEnd(); i.Advance()) { 294 !i.IsAtEnd(); i.Advance()) {
287 i.GetCurrentValue()->DisableAudioDebugRecordings(); 295 i.GetCurrentValue()->DisableAudioDebugRecordings();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 bool WebRTCInternals::IsEventLogRecordingsEnabled() const { 344 bool WebRTCInternals::IsEventLogRecordingsEnabled() const {
337 DCHECK_CURRENTLY_ON(BrowserThread::UI); 345 DCHECK_CURRENTLY_ON(BrowserThread::UI);
338 return event_log_recordings_; 346 return event_log_recordings_;
339 } 347 }
340 348
341 const base::FilePath& WebRTCInternals::GetEventLogRecordingsFilePath() const { 349 const base::FilePath& WebRTCInternals::GetEventLogRecordingsFilePath() const {
342 DCHECK_CURRENTLY_ON(BrowserThread::UI); 350 DCHECK_CURRENTLY_ON(BrowserThread::UI);
343 return event_log_recordings_file_path_; 351 return event_log_recordings_file_path_;
344 } 352 }
345 353
346 void WebRTCInternals::ResetForTesting() { 354 void WebRTCInternals::SendUpdate(const string& command,
355 scoped_ptr<base::Value> value) {
347 DCHECK_CURRENTLY_ON(BrowserThread::UI); 356 DCHECK_CURRENTLY_ON(BrowserThread::UI);
348 observers_.Clear();
349 peer_connection_data_.Clear();
350 CreateOrReleasePowerSaveBlocker();
351 get_user_media_requests_.Clear();
352 audio_debug_recordings_ = false;
353 }
354
355 void WebRTCInternals::SendUpdate(const string& command, base::Value* value) {
356 DCHECK(observers_.might_have_observers()); 357 DCHECK(observers_.might_have_observers());
357 358
358 FOR_EACH_OBSERVER(WebRTCInternalsUIObserver, 359 pending_updates_.push(PendingUpdate(command, std::move(value)));
359 observers_, 360
360 OnUpdate(command, value)); 361 if (!pending_updates_queued_) {
362 BrowserThread::PostDelayedTask(BrowserThread::UI, FROM_HERE,
363 base::Bind(&WebRTCInternals::ProcessPendingUpdates,
364 weak_factory_.GetWeakPtr()),
365 base::TimeDelta::FromMilliseconds(aggregate_updates_ms_));
366 pending_updates_queued_ = true;
367 }
361 } 368 }
362 369
363 void WebRTCInternals::RenderProcessHostDestroyed(RenderProcessHost* host) { 370 void WebRTCInternals::RenderProcessHostDestroyed(RenderProcessHost* host) {
364 DCHECK_CURRENTLY_ON(BrowserThread::UI); 371 DCHECK_CURRENTLY_ON(BrowserThread::UI);
365 OnRendererExit(host->GetID()); 372 OnRendererExit(host->GetID());
366 373
367 render_process_id_set_.erase(host->GetID()); 374 render_process_id_set_.erase(host->GetID());
368 host->RemoveObserver(this); 375 host->RemoveObserver(this);
369 } 376 }
370 377
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
405 412
406 int this_rid = 0; 413 int this_rid = 0;
407 record->GetInteger("rid", &this_rid); 414 record->GetInteger("rid", &this_rid);
408 415
409 if (this_rid == render_process_id) { 416 if (this_rid == render_process_id) {
410 if (observers_.might_have_observers()) { 417 if (observers_.might_have_observers()) {
411 int lid = 0, pid = 0; 418 int lid = 0, pid = 0;
412 record->GetInteger("lid", &lid); 419 record->GetInteger("lid", &lid);
413 record->GetInteger("pid", &pid); 420 record->GetInteger("pid", &pid);
414 421
415 base::DictionaryValue update; 422 scoped_ptr<base::DictionaryValue> update(new base::DictionaryValue());
416 update.SetInteger("lid", lid); 423 update->SetInteger("lid", lid);
417 update.SetInteger("pid", pid); 424 update->SetInteger("pid", pid);
418 SendUpdate("removePeerConnection", &update); 425 SendUpdate("removePeerConnection", std::move(update));
419 } 426 }
420 peer_connection_data_.Remove(i, NULL); 427 peer_connection_data_.Remove(i, NULL);
421 } 428 }
422 } 429 }
423 CreateOrReleasePowerSaveBlocker(); 430 CreateOrReleasePowerSaveBlocker();
424 431
425 bool found_any = false; 432 bool found_any = false;
426 // Iterates from the end of the list to remove the getUserMedia requests 433 // Iterates from the end of the list to remove the getUserMedia requests
427 // created by the exiting renderer. 434 // created by the exiting renderer.
428 for (int i = get_user_media_requests_.GetSize() - 1; i >= 0; --i) { 435 for (int i = get_user_media_requests_.GetSize() - 1; i >= 0; --i) {
429 base::DictionaryValue* record = NULL; 436 base::DictionaryValue* record = NULL;
430 get_user_media_requests_.GetDictionary(i, &record); 437 get_user_media_requests_.GetDictionary(i, &record);
431 438
432 int this_rid = 0; 439 int this_rid = 0;
433 record->GetInteger("rid", &this_rid); 440 record->GetInteger("rid", &this_rid);
434 441
435 if (this_rid == render_process_id) { 442 if (this_rid == render_process_id) {
436 get_user_media_requests_.Remove(i, NULL); 443 get_user_media_requests_.Remove(i, NULL);
437 found_any = true; 444 found_any = true;
438 } 445 }
439 } 446 }
440 447
441 if (found_any && observers_.might_have_observers()) { 448 if (found_any && observers_.might_have_observers()) {
442 base::DictionaryValue update; 449 scoped_ptr<base::DictionaryValue> update(new base::DictionaryValue());
443 update.SetInteger("rid", render_process_id); 450 update->SetInteger("rid", render_process_id);
444 SendUpdate("removeGetUserMediaForRenderer", &update); 451 SendUpdate("removeGetUserMediaForRenderer", std::move(update));
445 } 452 }
446 } 453 }
447 454
448 #if defined(ENABLE_WEBRTC) 455 #if defined(ENABLE_WEBRTC)
449 void WebRTCInternals::EnableAudioDebugRecordingsOnAllRenderProcessHosts() { 456 void WebRTCInternals::EnableAudioDebugRecordingsOnAllRenderProcessHosts() {
450 DCHECK_CURRENTLY_ON(BrowserThread::UI); 457 DCHECK_CURRENTLY_ON(BrowserThread::UI);
451 458
452 audio_debug_recordings_ = true; 459 audio_debug_recordings_ = true;
453 for (RenderProcessHost::iterator i( 460 for (RenderProcessHost::iterator i(
454 content::RenderProcessHost::AllHostsIterator()); 461 content::RenderProcessHost::AllHostsIterator());
(...skipping 25 matching lines...) Expand all
480 power_save_blocker_.reset(); 487 power_save_blocker_.reset();
481 } else if (!peer_connection_data_.empty() && !power_save_blocker_) { 488 } else if (!peer_connection_data_.empty() && !power_save_blocker_) {
482 DVLOG(1) << ("Preventing the application from being suspended while one or " 489 DVLOG(1) << ("Preventing the application from being suspended while one or "
483 "more PeerConnections are active."); 490 "more PeerConnections are active.");
484 power_save_blocker_ = content::PowerSaveBlocker::Create( 491 power_save_blocker_ = content::PowerSaveBlocker::Create(
485 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension, 492 PowerSaveBlocker::kPowerSaveBlockPreventAppSuspension,
486 PowerSaveBlocker::kReasonOther, "WebRTC has active PeerConnections"); 493 PowerSaveBlocker::kReasonOther, "WebRTC has active PeerConnections");
487 } 494 }
488 } 495 }
489 496
497 void WebRTCInternals::ProcessPendingUpdates() {
498 DCHECK_CURRENTLY_ON(BrowserThread::UI);
499 while (!pending_updates_.empty()) {
500 const auto& update = pending_updates_.front();
501 FOR_EACH_OBSERVER(WebRTCInternalsUIObserver,
502 observers_,
503 OnUpdate(update.command(), update.value()));
504 pending_updates_.pop();
505 }
506 pending_updates_queued_ = false;
507 }
508
490 } // namespace content 509 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698