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

Unified Diff: content/browser/media/webrtc/webrtc_eventlog_callback_handler.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: Removed content/public/ interface, used RenderProcessHost instead. Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: content/browser/media/webrtc/webrtc_eventlog_callback_handler.cc
diff --git a/content/browser/media/webrtc/webrtc_eventlog_callback_handler.cc b/content/browser/media/webrtc/webrtc_eventlog_callback_handler.cc
new file mode 100644
index 0000000000000000000000000000000000000000..1875130fab30528d4dc9e8f1347b3b4ec65854c9
--- /dev/null
+++ b/content/browser/media/webrtc/webrtc_eventlog_callback_handler.cc
@@ -0,0 +1,52 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "content/browser/media/webrtc/webrtc_eventlog_callback_handler.h"
+
+namespace content {
+
+WebRTCEventLogCallbackHandler::WebRTCEventLogCallbackHandler() {}
+
+WebRTCEventLogCallbackHandler::~WebRTCEventLogCallbackHandler() {}
+
+void WebRTCEventLogCallbackHandler::RegisterEventLogHandler(
+ const EventLogStartFunc& start_logging_callback,
+ const EventLogStopFunc& stop_logging_callback) {
+ eventlog_start_fn_ = start_logging_callback;
+ eventlog_stop_fn_ = stop_logging_callback;
+}
+
+void WebRTCEventLogCallbackHandler::RegisterPeerConnectionCallbacks(
+ const PeerConnectionAddedFunc& pc_added_callback,
+ const PeerConnectionRemovedFunc& pc_removed_callback) {
+ peerconnection_added_fn_.push_back(pc_added_callback);
+ peerconnection_removed_fn_.push_back(pc_removed_callback);
+}
+
+void WebRTCEventLogCallbackHandler::PeerConnectionAdded(int connection_id) {
+ for (auto& pc_added : peerconnection_added_fn_) {
+ pc_added.Run(connection_id);
+ }
+}
+
+void WebRTCEventLogCallbackHandler::PeerConnectionRemoved(int connection_id) {
+ for (auto& pc_removed : peerconnection_removed_fn_) {
+ pc_removed.Run(connection_id);
+ }
+}
+
+void WebRTCEventLogCallbackHandler::StartEventLog(
+ const base::FilePath& file_path) {
+ if (eventlog_start_fn_) {
+ eventlog_start_fn_.value().Run(file_path);
+ }
+}
+
+void WebRTCEventLogCallbackHandler::StopEventLog() {
+ if (eventlog_stop_fn_) {
+ eventlog_stop_fn_.value().Run();
+ }
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698