| OLD | NEW |
| 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 Loading... |
| 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 Loading... |
| 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 (auto& it : peer_connection_id_map_) { |
| 390 if (it.second == local_id) { |
| 391 it.first->StartEventLog(file, max_file_size_bytes); |
| 392 return; |
| 393 } |
| 394 } |
| 395 } |
| 396 |
| 397 void PeerConnectionTracker::OnStopEventLog(int local_id) { |
| 398 DCHECK(main_thread_.CalledOnValidThread()); |
| 399 for (auto& it : peer_connection_id_map_) { |
| 400 if (it.second == local_id) { |
| 401 it.first->StopEventLog(); |
| 402 return; |
| 403 } |
| 404 } |
| 405 } |
| 406 |
| 383 void PeerConnectionTracker::RegisterPeerConnection( | 407 void PeerConnectionTracker::RegisterPeerConnection( |
| 384 RTCPeerConnectionHandler* pc_handler, | 408 RTCPeerConnectionHandler* pc_handler, |
| 385 const webrtc::PeerConnectionInterface::RTCConfiguration& config, | 409 const webrtc::PeerConnectionInterface::RTCConfiguration& config, |
| 386 const blink::WebMediaConstraints& constraints, | 410 const blink::WebMediaConstraints& constraints, |
| 387 const blink::WebFrame* frame) { | 411 const blink::WebFrame* frame) { |
| 388 DCHECK(main_thread_.CalledOnValidThread()); | 412 DCHECK(main_thread_.CalledOnValidThread()); |
| 389 DCHECK_EQ(GetLocalIDForHandler(pc_handler), -1); | 413 DCHECK_EQ(GetLocalIDForHandler(pc_handler), -1); |
| 390 DVLOG(1) << "PeerConnectionTracker::RegisterPeerConnection()"; | 414 DVLOG(1) << "PeerConnectionTracker::RegisterPeerConnection()"; |
| 391 PeerConnectionInfo info; | 415 PeerConnectionInfo info; |
| 392 | 416 |
| (...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 706 DCHECK(main_thread_.CalledOnValidThread()); | 730 DCHECK(main_thread_.CalledOnValidThread()); |
| 707 SendTarget()->Send(new PeerConnectionTrackerHost_UpdatePeerConnection( | 731 SendTarget()->Send(new PeerConnectionTrackerHost_UpdatePeerConnection( |
| 708 local_id, std::string(callback_type), value)); | 732 local_id, std::string(callback_type), value)); |
| 709 } | 733 } |
| 710 | 734 |
| 711 void PeerConnectionTracker::OverrideSendTargetForTesting(RenderThread* target) { | 735 void PeerConnectionTracker::OverrideSendTargetForTesting(RenderThread* target) { |
| 712 send_target_for_test_ = target; | 736 send_target_for_test_ = target; |
| 713 } | 737 } |
| 714 | 738 |
| 715 } // namespace content | 739 } // namespace content |
| OLD | NEW |