OLD | NEW |
(Empty) | |
| 1 // Copyright 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_eventlog_callback_handler.h" |
| 6 |
| 7 namespace content { |
| 8 |
| 9 WebRTCEventLogCallbackHandler::WebRTCEventLogCallbackHandler() {} |
| 10 |
| 11 WebRTCEventLogCallbackHandler::~WebRTCEventLogCallbackHandler() {} |
| 12 |
| 13 void WebRTCEventLogCallbackHandler::RegisterEventLogHandler( |
| 14 const EventLogStartFunc& start_logging_callback, |
| 15 const EventLogStopFunc& stop_logging_callback) { |
| 16 eventlog_start_fn_ = start_logging_callback; |
| 17 eventlog_stop_fn_ = stop_logging_callback; |
| 18 } |
| 19 |
| 20 void WebRTCEventLogCallbackHandler::RegisterPeerConnectionCallbacks( |
| 21 const PeerConnectionAddedFunc& pc_added_callback, |
| 22 const PeerConnectionRemovedFunc& pc_removed_callback) { |
| 23 peerconnection_added_fn_.push_back(pc_added_callback); |
| 24 peerconnection_removed_fn_.push_back(pc_removed_callback); |
| 25 } |
| 26 |
| 27 void WebRTCEventLogCallbackHandler::PeerConnectionAdded(int connection_id) { |
| 28 for (auto& pc_added : peerconnection_added_fn_) { |
| 29 pc_added.Run(connection_id); |
| 30 } |
| 31 } |
| 32 |
| 33 void WebRTCEventLogCallbackHandler::PeerConnectionRemoved(int connection_id) { |
| 34 for (auto& pc_removed : peerconnection_removed_fn_) { |
| 35 pc_removed.Run(connection_id); |
| 36 } |
| 37 } |
| 38 |
| 39 void WebRTCEventLogCallbackHandler::StartEventLog( |
| 40 const base::FilePath& file_path) { |
| 41 if (eventlog_start_fn_) { |
| 42 eventlog_start_fn_.value().Run(file_path); |
| 43 } |
| 44 } |
| 45 |
| 46 void WebRTCEventLogCallbackHandler::StopEventLog() { |
| 47 if (eventlog_stop_fn_) { |
| 48 eventlog_stop_fn_.value().Run(); |
| 49 } |
| 50 } |
| 51 |
| 52 } // namespace content |
OLD | NEW |