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

Unified Diff: content/browser/media/webrtc/webrtc_callback_interface_impl.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: Introduced WebRTCCallbackInterface. 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_callback_interface_impl.cc
diff --git a/content/browser/media/webrtc/webrtc_callback_interface_impl.cc b/content/browser/media/webrtc/webrtc_callback_interface_impl.cc
new file mode 100644
index 0000000000000000000000000000000000000000..9647aa01f98da8ca6825d35465871875d7702bff
--- /dev/null
+++ b/content/browser/media/webrtc/webrtc_callback_interface_impl.cc
@@ -0,0 +1,60 @@
+// Copyright (c) 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_callback_interface_impl.h"
+
+namespace content {
+
+WebRTCCallbackInterfaceImpl::WebRTCCallbackInterfaceImpl() {}
+
+WebRTCCallbackInterfaceImpl::~WebRTCCallbackInterfaceImpl() {}
+
+void WebRTCCallbackInterfaceImpl::RegisterEventLogHandler(
+ int render_process_id,
+ EventLogStartFunc start_logging_callback,
+ EventLogStopFunc stop_logging_callback) {
+ event_log_callbacks_[render_process_id] =
+ std::make_pair(start_logging_callback, stop_logging_callback);
+}
+
+void WebRTCCallbackInterfaceImpl::RegisterPeerConnectionCallbacks(
+ int render_process_id,
+ PeerConnectionAddedFunc pc_added_callback,
+ PeerConnectionRemovedFunc pc_removed_callback) {
+ peer_connection_callbacks_.insert(
+ std::make_pair(render_process_id,
+ std::make_pair(pc_added_callback, pc_removed_callback)));
+}
+
+void WebRTCCallbackInterfaceImpl::PeerConnectionAdded(int render_process_id,
+ int connection_id) {
+ auto range = peer_connection_callbacks_.equal_range(render_process_id);
+ for (auto i = range.first; i != range.second; ++i) {
+ i->second.first.Run(render_process_id, connection_id);
+ }
+}
+
+void WebRTCCallbackInterfaceImpl::PeerConnectionRemoved(int render_process_id,
+ int connection_id) {
+ auto range = peer_connection_callbacks_.equal_range(render_process_id);
+ for (auto i = range.first; i != range.second; ++i) {
+ i->second.second.Run(render_process_id, connection_id);
+ }
+}
+
+void WebRTCCallbackInterfaceImpl::StartEventLog(
+ int render_process_id,
+ const base::FilePath& file_path) {
+ if (event_log_callbacks_.count(render_process_id)) {
+ event_log_callbacks_[render_process_id].first.Run(file_path);
+ }
+}
+
+void WebRTCCallbackInterfaceImpl::StopEventLog(int render_process_id) {
+ if (event_log_callbacks_.count(render_process_id)) {
+ event_log_callbacks_[render_process_id].second.Run();
+ }
+}
+
+} // namespace content

Powered by Google App Engine
This is Rietveld 408576698