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

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

Issue 1855193002: Move the call to enable the WebRTC event log from PeerConnectionFactory to PeerConnection. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Added limit to number of log files and the size of the log files. Created 4 years, 8 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 #include "content/renderer/media/peer_connection_tracker.h" 4 #include "content/renderer/media/peer_connection_tracker.h"
5 5
6 #include <stddef.h> 6 #include <stddef.h>
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include "base/strings/string_number_conversions.h" 9 #include "base/strings/string_number_conversions.h"
10 #include "base/strings/utf_string_conversions.h" 10 #include "base/strings/utf_string_conversions.h"
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
336 336
337 PeerConnectionTracker::~PeerConnectionTracker() { 337 PeerConnectionTracker::~PeerConnectionTracker() {
338 } 338 }
339 339
340 bool PeerConnectionTracker::OnControlMessageReceived( 340 bool PeerConnectionTracker::OnControlMessageReceived(
341 const IPC::Message& message) { 341 const IPC::Message& message) {
342 bool handled = true; 342 bool handled = true;
343 IPC_BEGIN_MESSAGE_MAP(PeerConnectionTracker, message) 343 IPC_BEGIN_MESSAGE_MAP(PeerConnectionTracker, message)
344 IPC_MESSAGE_HANDLER(PeerConnectionTracker_GetAllStats, OnGetAllStats) 344 IPC_MESSAGE_HANDLER(PeerConnectionTracker_GetAllStats, OnGetAllStats)
345 IPC_MESSAGE_HANDLER(PeerConnectionTracker_OnSuspend, OnSuspend) 345 IPC_MESSAGE_HANDLER(PeerConnectionTracker_OnSuspend, OnSuspend)
346 IPC_MESSAGE_HANDLER(PeerConnectionTracker_StartEventLog, OnStartEventLog)
347 IPC_MESSAGE_HANDLER(PeerConnectionTracker_StopEventLog, OnStopEventLog)
346 IPC_MESSAGE_UNHANDLED(handled = false) 348 IPC_MESSAGE_UNHANDLED(handled = false)
347 IPC_END_MESSAGE_MAP() 349 IPC_END_MESSAGE_MAP()
348 return handled; 350 return handled;
349 } 351 }
350 352
351 void PeerConnectionTracker::OnGetAllStats() { 353 void PeerConnectionTracker::OnGetAllStats() {
352 DCHECK(main_thread_.CalledOnValidThread()); 354 DCHECK(main_thread_.CalledOnValidThread());
353 355
354 const std::string empty_track_id; 356 const std::string empty_track_id;
355 for (PeerConnectionIdMap::iterator it = peer_connection_id_map_.begin(); 357 for (PeerConnectionIdMap::iterator it = peer_connection_id_map_.begin();
(...skipping 17 matching lines...) Expand all
373 } 375 }
374 376
375 void PeerConnectionTracker::OnSuspend() { 377 void PeerConnectionTracker::OnSuspend() {
376 DCHECK(main_thread_.CalledOnValidThread()); 378 DCHECK(main_thread_.CalledOnValidThread());
377 for (PeerConnectionIdMap::iterator it = peer_connection_id_map_.begin(); 379 for (PeerConnectionIdMap::iterator it = peer_connection_id_map_.begin();
378 it != peer_connection_id_map_.end(); ++it) { 380 it != peer_connection_id_map_.end(); ++it) {
379 it->first->CloseClientPeerConnection(); 381 it->first->CloseClientPeerConnection();
380 } 382 }
381 } 383 }
382 384
385 void PeerConnectionTracker::OnStartEventLog(int local_id,
386 IPC::PlatformFileForTransit file,
387 int64_t max_file_size_bytes) {
388 DCHECK(main_thread_.CalledOnValidThread());
389 for (PeerConnectionIdMap::iterator it = peer_connection_id_map_.begin();
dcheng 2016/04/04 21:44:57 Consider using for (auto& kv : map_) syntax here a
Ivo-OOO until feb 6 2016/04/05 08:59:27 Thanks, looks better.
390 it != peer_connection_id_map_.end(); ++it) {
391 if (it->second == local_id) {
392 it->first->StartEventLog(file, max_file_size_bytes);
393 return;
394 }
395 }
396 }
397
398 void PeerConnectionTracker::OnStopEventLog(int local_id) {
399 DCHECK(main_thread_.CalledOnValidThread());
400 for (PeerConnectionIdMap::iterator it = peer_connection_id_map_.begin();
401 it != peer_connection_id_map_.end(); ++it) {
402 if (it->second == local_id) {
403 it->first->StopEventLog();
404 return;
405 }
406 }
407 }
408
383 void PeerConnectionTracker::RegisterPeerConnection( 409 void PeerConnectionTracker::RegisterPeerConnection(
384 RTCPeerConnectionHandler* pc_handler, 410 RTCPeerConnectionHandler* pc_handler,
385 const webrtc::PeerConnectionInterface::RTCConfiguration& config, 411 const webrtc::PeerConnectionInterface::RTCConfiguration& config,
386 const blink::WebMediaConstraints& constraints, 412 const blink::WebMediaConstraints& constraints,
387 const blink::WebFrame* frame) { 413 const blink::WebFrame* frame) {
388 DCHECK(main_thread_.CalledOnValidThread()); 414 DCHECK(main_thread_.CalledOnValidThread());
389 DCHECK_EQ(GetLocalIDForHandler(pc_handler), -1); 415 DCHECK_EQ(GetLocalIDForHandler(pc_handler), -1);
390 DVLOG(1) << "PeerConnectionTracker::RegisterPeerConnection()"; 416 DVLOG(1) << "PeerConnectionTracker::RegisterPeerConnection()";
391 PeerConnectionInfo info; 417 PeerConnectionInfo info;
392 418
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
706 DCHECK(main_thread_.CalledOnValidThread()); 732 DCHECK(main_thread_.CalledOnValidThread());
707 SendTarget()->Send(new PeerConnectionTrackerHost_UpdatePeerConnection( 733 SendTarget()->Send(new PeerConnectionTrackerHost_UpdatePeerConnection(
708 local_id, std::string(callback_type), value)); 734 local_id, std::string(callback_type), value));
709 } 735 }
710 736
711 void PeerConnectionTracker::OverrideSendTargetForTesting(RenderThread* target) { 737 void PeerConnectionTracker::OverrideSendTargetForTesting(RenderThread* target) {
712 send_target_for_test_ = target; 738 send_target_for_test_ = target;
713 } 739 }
714 740
715 } // namespace content 741 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698