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

Side by Side Diff: content/renderer/media/peer_connection_tracker.cc

Issue 503183002: Revert, causing browser crashes due to race (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: merge Created 6 years, 3 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/renderer/media/peer_connection_tracker.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 #include "content/renderer/media/peer_connection_tracker.h" 4 #include "content/renderer/media/peer_connection_tracker.h"
5 5
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "content/common/media/peer_connection_tracker_messages.h" 7 #include "content/common/media/peer_connection_tracker_messages.h"
8 #include "content/renderer/media/rtc_media_constraints.h" 8 #include "content/renderer/media/rtc_media_constraints.h"
9 #include "content/renderer/media/rtc_peer_connection_handler.h" 9 #include "content/renderer/media/rtc_peer_connection_handler.h"
10 #include "content/renderer/render_thread_impl.h" 10 #include "content/renderer/render_thread_impl.h"
(...skipping 260 matching lines...) Expand 10 before | Expand all | Expand 10 after
271 } 271 }
272 272
273 PeerConnectionTracker::~PeerConnectionTracker() { 273 PeerConnectionTracker::~PeerConnectionTracker() {
274 } 274 }
275 275
276 bool PeerConnectionTracker::OnControlMessageReceived( 276 bool PeerConnectionTracker::OnControlMessageReceived(
277 const IPC::Message& message) { 277 const IPC::Message& message) {
278 bool handled = true; 278 bool handled = true;
279 IPC_BEGIN_MESSAGE_MAP(PeerConnectionTracker, message) 279 IPC_BEGIN_MESSAGE_MAP(PeerConnectionTracker, message)
280 IPC_MESSAGE_HANDLER(PeerConnectionTracker_GetAllStats, OnGetAllStats) 280 IPC_MESSAGE_HANDLER(PeerConnectionTracker_GetAllStats, OnGetAllStats)
281 IPC_MESSAGE_HANDLER(PeerConnectionTracker_OnSuspend, OnSuspend)
282 IPC_MESSAGE_UNHANDLED(handled = false) 281 IPC_MESSAGE_UNHANDLED(handled = false)
283 IPC_END_MESSAGE_MAP() 282 IPC_END_MESSAGE_MAP()
284 return handled; 283 return handled;
285 } 284 }
286 285
287 void PeerConnectionTracker::OnGetAllStats() { 286 void PeerConnectionTracker::OnGetAllStats() {
288 for (PeerConnectionIdMap::iterator it = peer_connection_id_map_.begin(); 287 for (PeerConnectionIdMap::iterator it = peer_connection_id_map_.begin();
289 it != peer_connection_id_map_.end(); ++it) { 288 it != peer_connection_id_map_.end(); ++it) {
290 289
291 rtc::scoped_refptr<InternalStatsObserver> observer( 290 rtc::scoped_refptr<InternalStatsObserver> observer(
292 new rtc::RefCountedObject<InternalStatsObserver>(it->second)); 291 new rtc::RefCountedObject<InternalStatsObserver>(it->second));
293 292
294 it->first->GetStats( 293 it->first->GetStats(
295 observer, 294 observer,
296 NULL, 295 NULL,
297 webrtc::PeerConnectionInterface::kStatsOutputLevelDebug); 296 webrtc::PeerConnectionInterface::kStatsOutputLevelDebug);
298 } 297 }
299 } 298 }
300 299
301 void PeerConnectionTracker::OnSuspend() {
302 for (PeerConnectionIdMap::iterator it = peer_connection_id_map_.begin();
303 it != peer_connection_id_map_.end(); ++it) {
304 it->first->stop();
305 }
306 }
307
308 void PeerConnectionTracker::RegisterPeerConnection( 300 void PeerConnectionTracker::RegisterPeerConnection(
309 RTCPeerConnectionHandler* pc_handler, 301 RTCPeerConnectionHandler* pc_handler,
310 const webrtc::PeerConnectionInterface::RTCConfiguration& config, 302 const webrtc::PeerConnectionInterface::RTCConfiguration& config,
311 const RTCMediaConstraints& constraints, 303 const RTCMediaConstraints& constraints,
312 const blink::WebFrame* frame) { 304 const blink::WebFrame* frame) {
313 DVLOG(1) << "PeerConnectionTracker::RegisterPeerConnection()"; 305 DVLOG(1) << "PeerConnectionTracker::RegisterPeerConnection()";
314 PeerConnectionInfo info; 306 PeerConnectionInfo info;
315 307
316 info.lid = GetNextLocalID(); 308 info.lid = GetNextLocalID();
317 info.rtc_configuration = 309 info.rtc_configuration =
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
526 const std::string& value) { 518 const std::string& value) {
527 if (peer_connection_id_map_.find(pc_handler) == peer_connection_id_map_.end()) 519 if (peer_connection_id_map_.find(pc_handler) == peer_connection_id_map_.end())
528 return; 520 return;
529 521
530 RenderThreadImpl::current()->Send( 522 RenderThreadImpl::current()->Send(
531 new PeerConnectionTrackerHost_UpdatePeerConnection( 523 new PeerConnectionTrackerHost_UpdatePeerConnection(
532 peer_connection_id_map_[pc_handler], type, value)); 524 peer_connection_id_map_[pc_handler], type, value));
533 } 525 }
534 526
535 } // namespace content 527 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/peer_connection_tracker.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698