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 #ifndef CONTENT_BROWSER_MEDIA_WEBRTC_WEBRTC_EVENTLOG_HOST_H_ | |
6 #define CONTENT_BROWSER_MEDIA_WEBRTC_WEBRTC_EVENTLOG_HOST_H_ | |
7 | |
8 #include <set> | |
9 | |
10 #include "base/files/file_path.h" | |
11 #include "base/threading/thread_checker.h" | |
12 | |
13 namespace content { | |
14 | |
15 // This class is used to active and disable WebRTC event logs on each of the | |
16 // peer connections in the render process. To be able to do this, it needs to | |
17 // keep track of all the PeerConnections in the render process. | |
18 class WebRTCEventLogHost { | |
19 public: | |
20 explicit WebRTCEventLogHost(int render_process_id); | |
21 ~WebRTCEventLogHost(); | |
22 | |
23 // Starts an RTC event log for each peerconnection on the render process. | |
24 // A base file_path can be supplied, which will be extended to include several | |
25 // identifiers to ensure uniqueness. If a recording was already in progress, | |
26 // this call will return false and have no other effect. | |
27 bool StartWebRTCEventLog(const base::FilePath& file_path); | |
28 | |
29 // Stops recording an RTC event log for each peerconnection on the render | |
30 // process. If no recording was in progress, this call will return false. | |
31 bool StopWebRTCEventLog(); | |
32 | |
33 // This function should be used to notify the WebRTCEventLogHost object that a | |
34 // PeerConnection was created in the corresponding render process. | |
35 void PeerConnectionAdded(int connection_id); | |
36 | |
37 // This function should be used to notify the WebRTCEventLogHost object that a | |
38 // PeerConnection was removed in the corresponding render process. | |
39 void PeerConnectionRemoved(int connection_id); | |
40 | |
41 private: | |
42 // The render process ID that this object is associated with. | |
43 const int render_process_id_; | |
44 | |
45 // In case new PeerConnections are created during logging, the path is needed | |
46 // to enable logging for them. | |
47 base::FilePath base_file_path_; | |
48 | |
49 // The local identifiers of all the currently active PeerConnections. | |
50 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
| |
51 | |
52 // Number of active log files that have been opened. | |
53 int number_active_log_files_; | |
54 | |
55 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
| |
56 | |
57 base::ThreadChecker thread_checker_; | |
58 | |
59 DISALLOW_COPY_AND_ASSIGN(WebRTCEventLogHost); | |
60 }; | |
61 | |
62 } // namespace content | |
63 | |
64 #endif // CONTENT_BROWSER_MEDIA_WEBRTC_WEBRTC_EVENTLOG_HOST_H_ | |
OLD | NEW |