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

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

Issue 2693263003: Release RTCPeerConnection PowerSaveBlock on process exit. (Closed)
Patch Set: Created 3 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
« no previous file with comments | « content/browser/webrtc/webrtc_internals.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/webrtc/webrtc_internals.h" 5 #include "content/browser/webrtc/webrtc_internals.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after
393 pending_updates_.push(PendingUpdate(command, std::move(value))); 393 pending_updates_.push(PendingUpdate(command, std::move(value)));
394 394
395 if (queue_was_empty) { 395 if (queue_was_empty) {
396 BrowserThread::PostDelayedTask(BrowserThread::UI, FROM_HERE, 396 BrowserThread::PostDelayedTask(BrowserThread::UI, FROM_HERE,
397 base::Bind(&WebRTCInternals::ProcessPendingUpdates, 397 base::Bind(&WebRTCInternals::ProcessPendingUpdates,
398 weak_factory_.GetWeakPtr()), 398 weak_factory_.GetWeakPtr()),
399 base::TimeDelta::FromMilliseconds(aggregate_updates_ms_)); 399 base::TimeDelta::FromMilliseconds(aggregate_updates_ms_));
400 } 400 }
401 } 401 }
402 402
403 void WebRTCInternals::RenderProcessHostDestroyed(RenderProcessHost* host) { 403 void WebRTCInternals::RenderProcessExited(RenderProcessHost* host,
404 base::TerminationStatus status,
405 int exit_code) {
404 DCHECK_CURRENTLY_ON(BrowserThread::UI); 406 DCHECK_CURRENTLY_ON(BrowserThread::UI);
405 OnRendererExit(host->GetID()); 407 OnRendererExit(host->GetID());
406
407 render_process_id_set_.erase(host->GetID()); 408 render_process_id_set_.erase(host->GetID());
408 host->RemoveObserver(this); 409 host->RemoveObserver(this);
409 } 410 }
410 411
411 void WebRTCInternals::FileSelected(const base::FilePath& path, 412 void WebRTCInternals::FileSelected(const base::FilePath& path,
412 int /* unused_index */, 413 int /* unused_index */,
413 void* /*unused_params */) { 414 void* /*unused_params */) {
414 #if BUILDFLAG(ENABLE_WEBRTC) 415 #if BUILDFLAG(ENABLE_WEBRTC)
415 DCHECK_CURRENTLY_ON(BrowserThread::UI); 416 DCHECK_CURRENTLY_ON(BrowserThread::UI);
416 if (selecting_event_log_) { 417 if (selecting_event_log_) {
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
451 int lid = 0, pid = 0; 452 int lid = 0, pid = 0;
452 record->GetInteger("lid", &lid); 453 record->GetInteger("lid", &lid);
453 record->GetInteger("pid", &pid); 454 record->GetInteger("pid", &pid);
454 455
455 std::unique_ptr<base::DictionaryValue> update( 456 std::unique_ptr<base::DictionaryValue> update(
456 new base::DictionaryValue()); 457 new base::DictionaryValue());
457 update->SetInteger("lid", lid); 458 update->SetInteger("lid", lid);
458 update->SetInteger("pid", pid); 459 update->SetInteger("pid", pid);
459 SendUpdate("removePeerConnection", std::move(update)); 460 SendUpdate("removePeerConnection", std::move(update));
460 } 461 }
462 MaybeClosePeerConnection(record);
461 peer_connection_data_.Remove(i, NULL); 463 peer_connection_data_.Remove(i, NULL);
462 } 464 }
463 } 465 }
464 CreateOrReleasePowerSaveBlocker(); 466 CreateOrReleasePowerSaveBlocker();
465 467
466 bool found_any = false; 468 bool found_any = false;
467 // Iterates from the end of the list to remove the getUserMedia requests 469 // Iterates from the end of the list to remove the getUserMedia requests
468 // created by the exiting renderer. 470 // created by the exiting renderer.
469 for (int i = get_user_media_requests_.GetSize() - 1; i >= 0; --i) { 471 for (int i = get_user_media_requests_.GetSize() - 1; i >= 0; --i) {
470 base::DictionaryValue* record = NULL; 472 base::DictionaryValue* record = NULL;
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 DCHECK_CURRENTLY_ON(BrowserThread::UI); 550 DCHECK_CURRENTLY_ON(BrowserThread::UI);
549 while (!pending_updates_.empty()) { 551 while (!pending_updates_.empty()) {
550 const auto& update = pending_updates_.front(); 552 const auto& update = pending_updates_.front();
551 for (auto& observer : observers_) 553 for (auto& observer : observers_)
552 observer.OnUpdate(update.command(), update.value()); 554 observer.OnUpdate(update.command(), update.value());
553 pending_updates_.pop(); 555 pending_updates_.pop();
554 } 556 }
555 } 557 }
556 558
557 } // namespace content 559 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/webrtc/webrtc_internals.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698