OLD | NEW |
(Empty) | |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "content/browser/media/webrtc/webrtc_callback_interface_impl.h" |
| 6 |
| 7 namespace content { |
| 8 |
| 9 WebRTCCallbackInterfaceImpl::WebRTCCallbackInterfaceImpl() {} |
| 10 |
| 11 WebRTCCallbackInterfaceImpl::~WebRTCCallbackInterfaceImpl() {} |
| 12 |
| 13 void WebRTCCallbackInterfaceImpl::RegisterEventLogHandler( |
| 14 int render_process_id, |
| 15 EventLogStartFunc start_logging_callback, |
| 16 EventLogStopFunc stop_logging_callback) { |
| 17 event_log_callbacks_[render_process_id] = |
| 18 std::make_pair(start_logging_callback, stop_logging_callback); |
| 19 } |
| 20 |
| 21 void WebRTCCallbackInterfaceImpl::RegisterPeerConnectionCallbacks( |
| 22 int render_process_id, |
| 23 PeerConnectionAddedFunc pc_added_callback, |
| 24 PeerConnectionRemovedFunc pc_removed_callback) { |
| 25 peer_connection_callbacks_.insert( |
| 26 std::make_pair(render_process_id, |
| 27 std::make_pair(pc_added_callback, pc_removed_callback))); |
| 28 } |
| 29 |
| 30 void WebRTCCallbackInterfaceImpl::PeerConnectionAdded(int render_process_id, |
| 31 int connection_id) { |
| 32 auto range = peer_connection_callbacks_.equal_range(render_process_id); |
| 33 for (auto i = range.first; i != range.second; ++i) { |
| 34 i->second.first.Run(render_process_id, connection_id); |
| 35 } |
| 36 } |
| 37 |
| 38 void WebRTCCallbackInterfaceImpl::PeerConnectionRemoved(int render_process_id, |
| 39 int connection_id) { |
| 40 auto range = peer_connection_callbacks_.equal_range(render_process_id); |
| 41 for (auto i = range.first; i != range.second; ++i) { |
| 42 i->second.second.Run(render_process_id, connection_id); |
| 43 } |
| 44 } |
| 45 |
| 46 void WebRTCCallbackInterfaceImpl::StartEventLog( |
| 47 int render_process_id, |
| 48 const base::FilePath& file_path) { |
| 49 if (event_log_callbacks_.count(render_process_id)) { |
| 50 event_log_callbacks_[render_process_id].first.Run(file_path); |
| 51 } |
| 52 } |
| 53 |
| 54 void WebRTCCallbackInterfaceImpl::StopEventLog(int render_process_id) { |
| 55 if (event_log_callbacks_.count(render_process_id)) { |
| 56 event_log_callbacks_[render_process_id].second.Run(); |
| 57 } |
| 58 } |
| 59 |
| 60 } // namespace content |
OLD | NEW |