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

Unified Diff: content/browser/renderer_host/render_process_host_impl.cc

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 side-by-side diff with in-line comments
Download patch
Index: content/browser/renderer_host/render_process_host_impl.cc
diff --git a/content/browser/renderer_host/render_process_host_impl.cc b/content/browser/renderer_host/render_process_host_impl.cc
index 4061947e26511f2455ba2c8e414f46e0862b9dea..52dddf48145e6264fa8f64449c7e9d67c69c131f 100644
--- a/content/browser/renderer_host/render_process_host_impl.cc
+++ b/content/browser/renderer_host/render_process_host_impl.cc
@@ -246,8 +246,6 @@ const char kSiteProcessMapKeyName[] = "content_site_process_map";
#ifdef ENABLE_WEBRTC
const base::FilePath::CharType kAecDumpFileNameAddition[] =
FILE_PATH_LITERAL("aec_dump");
-const base::FilePath::CharType kEventLogFileNameAddition[] =
- FILE_PATH_LITERAL("event_log");
#endif
void CacheShaderInfo(int32_t id, base::FilePath path) {
@@ -1735,12 +1733,8 @@ bool RenderProcessHostImpl::OnMessageReceived(const IPC::Message& msg) {
#if defined(ENABLE_WEBRTC)
IPC_MESSAGE_HANDLER(AecDumpMsg_RegisterAecDumpConsumer,
OnRegisterAecDumpConsumer)
- IPC_MESSAGE_HANDLER(WebRTCEventLogMsg_RegisterEventLogConsumer,
- OnRegisterEventLogConsumer)
IPC_MESSAGE_HANDLER(AecDumpMsg_UnregisterAecDumpConsumer,
OnUnregisterAecDumpConsumer)
- IPC_MESSAGE_HANDLER(WebRTCEventLogMsg_UnregisterEventLogConsumer,
- OnUnregisterEventLogConsumer)
#endif
// Adding single handlers for your service here is fine, but once your
// service needs more than one handler, please extract them into a new
@@ -2006,28 +2000,6 @@ void RenderProcessHostImpl::DisableAudioDebugRecordings() {
}
}
-void RenderProcessHostImpl::EnableEventLogRecordings(
- const base::FilePath& file) {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
-
- // Enable Event log for each registered consumer.
- base::FilePath file_with_extensions = GetEventLogFilePathWithExtensions(file);
- for (int id : aec_dump_consumers_)
- EnableEventLogForId(file_with_extensions, id);
-}
-
-void RenderProcessHostImpl::DisableEventLogRecordings() {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
-
- // Posting on the FILE thread and then replying back on the UI thread is only
- // for avoiding races between enable and disable. Nothing is done on the FILE
- // thread.
- BrowserThread::PostTaskAndReply(
- BrowserThread::FILE, FROM_HERE, base::Bind(&base::DoNothing),
- base::Bind(&RenderProcessHostImpl::SendDisableEventLogToRenderer,
- weak_factory_.GetWeakPtr()));
-}
-
void RenderProcessHostImpl::SetWebRtcLogMessageCallback(
base::Callback<void(const std::string&)> callback) {
#if defined(ENABLE_WEBRTC)
@@ -2064,6 +2036,38 @@ RenderProcessHostImpl::StartRtpDump(
}
return stop_rtp_dump_callback_;
}
+
+void RenderProcessHostImpl::RegisterEventLogHandler(
+ const RenderProcessHost::EventLogStartFunc& start_logging_callback,
+ const RenderProcessHost::EventLogStopFunc& stop_logging_callback) {
+ eventlog_callback_handler_.RegisterEventLogHandler(start_logging_callback,
+ stop_logging_callback);
+}
+
+void RenderProcessHostImpl::RegisterPeerConnectionCallbacks(
+ const RenderProcessHost::PeerConnectionAddedFunc& pc_added_callback,
+ const RenderProcessHost::PeerConnectionRemovedFunc& pc_removed_callback) {
+ eventlog_callback_handler_.RegisterPeerConnectionCallbacks(
+ pc_added_callback, pc_removed_callback);
+}
+
+void RenderProcessHostImpl::SignalStartEventLog(
+ const base::FilePath& file_path) {
+ eventlog_callback_handler_.StartEventLog(file_path);
+}
+
+void RenderProcessHostImpl::SignalStopEventLog() {
+ eventlog_callback_handler_.StopEventLog();
+}
+
+void RenderProcessHostImpl::SignalPeerConnectionAdded(int connection_id) {
+ eventlog_callback_handler_.PeerConnectionAdded(connection_id);
+}
+
+void RenderProcessHostImpl::SignalPeerConnectionRemoved(int connection_id) {
+ eventlog_callback_handler_.PeerConnectionRemoved(connection_id);
+}
+
#endif
IPC::ChannelProxy* RenderProcessHostImpl::GetChannel() {
@@ -2655,13 +2659,6 @@ void RenderProcessHostImpl::OnRegisterAecDumpConsumer(int id) {
weak_factory_.GetWeakPtr(), id));
}
-void RenderProcessHostImpl::OnRegisterEventLogConsumer(int id) {
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(&RenderProcessHostImpl::RegisterEventLogConsumerOnUIThread,
- weak_factory_.GetWeakPtr(), id));
-}
-
void RenderProcessHostImpl::OnUnregisterAecDumpConsumer(int id) {
BrowserThread::PostTask(
BrowserThread::UI, FROM_HERE,
@@ -2669,13 +2666,6 @@ void RenderProcessHostImpl::OnUnregisterAecDumpConsumer(int id) {
weak_factory_.GetWeakPtr(), id));
}
-void RenderProcessHostImpl::OnUnregisterEventLogConsumer(int id) {
- BrowserThread::PostTask(
- BrowserThread::UI, FROM_HERE,
- base::Bind(&RenderProcessHostImpl::UnregisterEventLogConsumerOnUIThread,
- weak_factory_.GetWeakPtr(), id));
-}
-
void RenderProcessHostImpl::RegisterAecDumpConsumerOnUIThread(int id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
aec_dump_consumers_.push_back(id);
@@ -2687,17 +2677,6 @@ void RenderProcessHostImpl::RegisterAecDumpConsumerOnUIThread(int id) {
}
}
-void RenderProcessHostImpl::RegisterEventLogConsumerOnUIThread(int id) {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
- aec_dump_consumers_.push_back(id);
-
- if (WebRTCInternals::GetInstance()->IsEventLogRecordingsEnabled()) {
- base::FilePath file_with_extensions = GetEventLogFilePathWithExtensions(
- WebRTCInternals::GetInstance()->GetEventLogRecordingsFilePath());
- EnableEventLogForId(file_with_extensions, id);
- }
-}
-
void RenderProcessHostImpl::UnregisterAecDumpConsumerOnUIThread(int id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
for (std::vector<int>::iterator it = aec_dump_consumers_.begin();
@@ -2709,17 +2688,6 @@ void RenderProcessHostImpl::UnregisterAecDumpConsumerOnUIThread(int id) {
}
}
-void RenderProcessHostImpl::UnregisterEventLogConsumerOnUIThread(int id) {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
- for (std::vector<int>::iterator it = aec_dump_consumers_.begin();
- it != aec_dump_consumers_.end(); ++it) {
- if (*it == id) {
- aec_dump_consumers_.erase(it);
- break;
- }
- }
-}
-
void RenderProcessHostImpl::EnableAecDumpForId(const base::FilePath& file,
int id) {
DCHECK_CURRENTLY_ON(BrowserThread::UI);
@@ -2730,16 +2698,6 @@ void RenderProcessHostImpl::EnableAecDumpForId(const base::FilePath& file,
weak_factory_.GetWeakPtr(), id));
}
-void RenderProcessHostImpl::EnableEventLogForId(const base::FilePath& file,
- int id) {
- DCHECK_CURRENTLY_ON(BrowserThread::UI);
- BrowserThread::PostTaskAndReplyWithResult(
- BrowserThread::FILE, FROM_HERE,
- base::Bind(&CreateFileForProcess, file.AddExtension(IntToStringType(id))),
- base::Bind(&RenderProcessHostImpl::SendEventLogFileToRenderer,
- weak_factory_.GetWeakPtr(), id));
-}
-
void RenderProcessHostImpl::SendAecDumpFileToRenderer(
int id,
IPC::PlatformFileForTransit file_for_transit) {
@@ -2748,33 +2706,15 @@ void RenderProcessHostImpl::SendAecDumpFileToRenderer(
Send(new AecDumpMsg_EnableAecDump(id, file_for_transit));
}
-void RenderProcessHostImpl::SendEventLogFileToRenderer(
- int id,
- IPC::PlatformFileForTransit file_for_transit) {
- if (file_for_transit == IPC::InvalidPlatformFileForTransit())
- return;
- Send(new WebRTCEventLogMsg_EnableEventLog(id, file_for_transit));
-}
-
void RenderProcessHostImpl::SendDisableAecDumpToRenderer() {
Send(new AecDumpMsg_DisableAecDump());
}
-void RenderProcessHostImpl::SendDisableEventLogToRenderer() {
- Send(new WebRTCEventLogMsg_DisableEventLog());
-}
-
base::FilePath RenderProcessHostImpl::GetAecDumpFilePathWithExtensions(
const base::FilePath& file) {
return file.AddExtension(IntToStringType(base::GetProcId(GetHandle())))
.AddExtension(kAecDumpFileNameAddition);
}
-
-base::FilePath RenderProcessHostImpl::GetEventLogFilePathWithExtensions(
- const base::FilePath& file) {
- return file.AddExtension(IntToStringType(base::GetProcId(GetHandle())))
- .AddExtension(kEventLogFileNameAddition);
-}
#endif // defined(ENABLE_WEBRTC)
void RenderProcessHostImpl::GetAudioOutputControllers(

Powered by Google App Engine
This is Rietveld 408576698