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

Side by Side 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: Added unittest for adding more PeerConnections than the maximum limit. Created 4 years, 6 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 unified diff | Download patch
OLDNEW
(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 #ifndef CONTENT_BROWSER_MEDIA_WEBRTC_WEBRTC_EVENTLOG_HOST_H_
6 #define CONTENT_BROWSER_MEDIA_WEBRTC_WEBRTC_EVENTLOG_HOST_H_
7
8 #include <vector>
9
10 #include "base/files/file_path.h"
11 #include "base/memory/weak_ptr.h"
12 #include "ipc/ipc_platform_file.h"
13
14 namespace content {
15
16 // This class is used to enable and disable WebRTC event logs on each of the
17 // PeerConnections in the render process. This class and all its members should
18 // only be accessed from the Browser UI thread.
19 class WebRTCEventLogHost {
20 public:
21 explicit WebRTCEventLogHost(int render_process_id);
22 ~WebRTCEventLogHost();
23
24 // Starts an RTC event log for all current and future PeerConnections on the
25 // render process. A base file_path can be supplied, which will be extended to
26 // include several identifiers to ensure uniqueness. If a recording was
27 // already in progress, this call will return false and have no other effect.
28 bool StartWebRTCEventLog(const base::FilePath& file_path);
29
30 // Stops recording an RTC event log for each PeerConnection on the render
31 // process. If no recording was in progress, this call will return false.
32 bool StopWebRTCEventLog();
33
34 // This function should be used to notify the WebRTCEventLogHost object that a
35 // PeerConnection was created in the corresponding render process.
36 void PeerConnectionAdded(int peer_connection_local_id);
37
38 // This function should be used to notify the WebRTCEventLogHost object that a
39 // PeerConnection was removed in the corresponding render process.
40 void PeerConnectionRemoved(int peer_connection_local_id);
41
42 private:
43 // Actually start the eventlog for a single PeerConnection using the path
44 // stored in base_file_path_.
45 bool StartEventLogForPeerConnection(int peer_connection_local_id);
46
47 // Send the platform file to the render process using an IPC message.
48 void SendEventLogFileToRenderer(int peer_connection_local_id,
49 IPC::PlatformFileForTransit file_for_transit);
50
51 // The render process ID that this object is associated with.
52 const int render_process_id_;
53
54 // In case new PeerConnections are created during logging, the path is needed
55 // to enable logging for them.
56 base::FilePath base_file_path_;
57
58 // The local identifiers of all the currently active PeerConnections.
59 std::vector<int> active_peer_connection_local_ids_;
60
61 // Number of active log files that have been opened.
62 static int number_active_log_files_;
63
64 // Track if the RTC event log is currently active.
65 bool rtc_event_logging_enabled_;
66
67 base::WeakPtrFactory<WebRTCEventLogHost> weak_ptr_factory_;
68
69 DISALLOW_COPY_AND_ASSIGN(WebRTCEventLogHost);
70 };
71
72 } // namespace content
73
74 #endif // CONTENT_BROWSER_MEDIA_WEBRTC_WEBRTC_EVENTLOG_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698