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

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: Small bugfix and Tommi's comment. 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..092467394628fe626f76dd26472148602525dd09 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) {
@@ -569,6 +567,9 @@ RenderProcessHostImpl::RenderProcessHostImpl(
delayed_cleanup_needed_(false),
within_process_died_observer_(false),
power_monitor_broadcaster_(this),
+#if defined(ENABLE_WEBRTC)
+ webrtc_eventlog_host_(id_),
+#endif
worker_ref_count_(0),
max_worker_count_(0),
permission_service_context_(new PermissionServiceContext(this)),
@@ -936,7 +937,8 @@ void RenderProcessHostImpl::CreateMessageFilters() {
AddFilter(new WebRTCIdentityServiceHost(
GetID(), storage_partition_impl_->GetWebRTCIdentityStore(),
resource_context));
- peer_connection_tracker_host_ = new PeerConnectionTrackerHost(GetID());
+ peer_connection_tracker_host_ =
+ new PeerConnectionTrackerHost(GetID(), &webrtc_eventlog_host_);
AddFilter(peer_connection_tracker_host_.get());
AddFilter(new MediaStreamDispatcherHost(
GetID(), browser_context->GetResourceContext()->GetMediaDeviceIDSalt(),
@@ -1735,12 +1737,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,26 +2004,13 @@ 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);
+bool RenderProcessHostImpl::StartWebRTCEventLog(
+ const base::FilePath& file_path) {
+ return webrtc_eventlog_host_.StartWebRTCEventLog(file_path);
}
-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()));
+bool RenderProcessHostImpl::StopWebRTCEventLog() {
+ return webrtc_eventlog_host_.StopWebRTCEventLog();
}
void RenderProcessHostImpl::SetWebRtcLogMessageCallback(
@@ -2655,13 +2640,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 +2647,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 +2658,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 +2669,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 +2679,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 +2687,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