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_callback_handler.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: Removed content/public/ interface, used RenderProcessHost instead. 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 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_CALLBACK_HANDLER_H_
6 #define CONTENT_BROWSER_MEDIA_WEBRTC_WEBRTC_EVENTLOG_CALLBACK_HANDLER_H_
7
8 #include <vector>
9
10 #include "base/callback.h"
11 #include "base/files/file_path.h"
12 #include "base/optional.h"
13
14 namespace content {
15
16 // This is a singleton class that is used to register callbacks that are used
17 // for the WebRTC event log. The callbacks are used to signal when the eventlog
18 // should be started and stopped, and other callbacks are used to signal when
19 // PeerConnections are added or removed.
20 class WebRTCEventLogCallbackHandler {
21 public:
22 WebRTCEventLogCallbackHandler();
23 ~WebRTCEventLogCallbackHandler();
24
25 // Register functions to handle starting and stopping the WebRTC event log
26 // functionality from the chrome://webrtc-internals page. Only one handler can
27 // be registered per render process.
28 using EventLogStartFunc = base::Callback<void(const base::FilePath&)>;
29 using EventLogStopFunc = base::Callback<void()>;
30 void RegisterEventLogHandler(const EventLogStartFunc& start_logging_callback,
31 const EventLogStopFunc& stop_logging_callback);
32
33 // Register callback functions to receive calls when PeerConnections are
34 // added or removed. Multiple callbacks can be registered for each render
35 // process.
36 using PeerConnectionAddedFunc = base::Callback<void(int)>;
37 using PeerConnectionRemovedFunc = base::Callback<void(int)>;
38 void RegisterPeerConnectionCallbacks(
39 const PeerConnectionAddedFunc& pc_added_callback,
40 const PeerConnectionRemovedFunc& pc_removed_callback);
41
42 void StartEventLog(const base::FilePath& file_path);
43 void StopEventLog();
44
45 void PeerConnectionAdded(int connection_id);
46 void PeerConnectionRemoved(int connection_id);
47
48 private:
49 base::Optional<EventLogStartFunc> eventlog_start_fn_;
50 base::Optional<EventLogStopFunc> eventlog_stop_fn_;
51
52 std::vector<PeerConnectionAddedFunc> peerconnection_added_fn_;
53 std::vector<PeerConnectionRemovedFunc> peerconnection_removed_fn_;
54 };
55
56 } // namespace content
57
58 #endif // CONTENT_BROWSER_MEDIA_WEBRTC_WEBRTC_EVENTLOG_CALLBACK_HANDLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698