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

Unified Diff: content/browser/media/webrtc/webrtc_eventlog_host.h

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: Addressed review comments by ncarter and grunell. 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_host.h
diff --git a/content/browser/media/webrtc/webrtc_eventlog_host.h b/content/browser/media/webrtc/webrtc_eventlog_host.h
new file mode 100644
index 0000000000000000000000000000000000000000..c0b09c32cdc3403c1fd59af5c4601b11dccb8ecf
--- /dev/null
+++ b/content/browser/media/webrtc/webrtc_eventlog_host.h
@@ -0,0 +1,64 @@
+// 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.
+
+#ifndef CONTENT_BROWSER_MEDIA_WEBRTC_WEBRTC_EVENTLOG_HOST_H_
+#define CONTENT_BROWSER_MEDIA_WEBRTC_WEBRTC_EVENTLOG_HOST_H_
+
+#include <set>
+
+#include "base/files/file_path.h"
+#include "base/threading/thread_checker.h"
+
+namespace content {
+
+// This class is used to active and disable WebRTC event logs on each of the
+// peer connections in the render process. To be able to do this, it needs to
+// keep track of all the PeerConnections in the render process.
+class WebRTCEventLogHost {
+ public:
+ explicit WebRTCEventLogHost(int render_process_id);
+ ~WebRTCEventLogHost();
+
+ // Starts an RTC event log for each peerconnection on the render process.
+ // A base file_path can be supplied, which will be extended to include several
+ // identifiers to ensure uniqueness. If a recording was already in progress,
+ // this call will return false and have no other effect.
+ bool StartWebRTCEventLog(const base::FilePath& file_path);
+
+ // Stops recording an RTC event log for each peerconnection on the render
+ // process. If no recording was in progress, this call will return false.
+ bool StopWebRTCEventLog();
+
+ // This function should be used to notify the WebRTCEventLogHost object that a
+ // PeerConnection was created in the corresponding render process.
+ void PeerConnectionAdded(int connection_id);
+
+ // This function should be used to notify the WebRTCEventLogHost object that a
+ // PeerConnection was removed in the corresponding render process.
+ void PeerConnectionRemoved(int connection_id);
+
+ private:
+ // The render process ID that this object is associated with.
+ const int render_process_id_;
+
+ // In case new PeerConnections are created during logging, the path is needed
+ // to enable logging for them.
+ base::FilePath base_file_path_;
+
+ // The local identifiers of all the currently active PeerConnections.
+ std::set<int> active_peer_connection_local_id_;
tommi (sloooow) - chröme 2016/05/25 15:16:20 Can this be a vector or unordered_set instead? se
Ivo-OOO until feb 6 2016/05/30 15:04:14 Since this collection is not very frequently acces
+
+ // Number of active log files that have been opened.
+ int number_active_log_files_;
+
+ bool is_rtc_event_logging_in_progress_;
tommi (sloooow) - chröme 2016/05/25 15:16:21 what does 'in progress' really mean? Would is_rtc
Ivo-OOO until feb 6 2016/05/30 15:04:15 Good point, I decided to remove the "is_" part as
+
+ base::ThreadChecker thread_checker_;
+
+ DISALLOW_COPY_AND_ASSIGN(WebRTCEventLogHost);
+};
+
+} // namespace content
+
+#endif // CONTENT_BROWSER_MEDIA_WEBRTC_WEBRTC_EVENTLOG_HOST_H_

Powered by Google App Engine
This is Rietveld 408576698