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

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: Addressed comments from Henrik and enabled logging for newly created render processes. 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 // Should be called from the Browser UI thread.
Henrik Grunell 2016/06/03 07:40:53 Nit: Remove thread comment.
Ivo-OOO until feb 6 2016/06/03 16:07:02 Done.
29 bool StartWebRTCEventLog(const base::FilePath& file_path);
30
31 // Stops recording an RTC event log for each PeerConnection on the render
32 // process. If no recording was in progress, this call will return false.
33 bool StopWebRTCEventLog();
34
35 // This function should be used to notify the WebRTCEventLogHost object that a
36 // PeerConnection was created in the corresponding render process.
37 void PeerConnectionAdded(int peer_connection_local_id);
38
39 // This function should be used to notify the WebRTCEventLogHost object that a
40 // PeerConnection was removed in the corresponding render process.
41 void PeerConnectionRemoved(int peer_connection_local_id);
42
43 private:
44 // Actually start the eventlog for a single PeerConnection using the path
45 // stored in base_file_path_.
46 bool DoStartEventLog(int peer_connection_local_id);
47
48 // Send the platform file to the render process using an IPC message.
49 void SendEventLogFileToRenderer(int peer_connection_local_id,
50 IPC::PlatformFileForTransit file_for_transit);
51
52 // The render process ID that this object is associated with.
53 const int render_process_id_;
54
55 // In case new PeerConnections are created during logging, the path is needed
56 // to enable logging for them.
57 base::FilePath base_file_path_;
58
59 // The local identifiers of all the currently active PeerConnections.
60 std::vector<int> active_peer_connection_local_ids_;
61
62 // Number of active log files that have been opened.
63 static int number_active_log_files_;
64
65 // Track if the RTC event log is currently active.
66 bool rtc_event_logging_enabled_;
67
68 base::WeakPtrFactory<WebRTCEventLogHost> weak_ptr_factory_;
69
70 DISALLOW_COPY_AND_ASSIGN(WebRTCEventLogHost);
71 };
72
73 } // namespace content
74
75 #endif // CONTENT_BROWSER_MEDIA_WEBRTC_WEBRTC_EVENTLOG_HOST_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698