Chromium Code Reviews| Index: content/browser/media/webrtc/webrtc_internals.cc |
| diff --git a/content/browser/media/webrtc/webrtc_internals.cc b/content/browser/media/webrtc/webrtc_internals.cc |
| index 1ebc884a5cb0a7816f607c31ddd38dc9ebedd0b0..0f7ddbe57b57f0e55c5d42574367887742166966 100644 |
| --- a/content/browser/media/webrtc/webrtc_internals.cc |
| +++ b/content/browser/media/webrtc/webrtc_internals.cc |
| @@ -15,6 +15,13 @@ |
| #include "content/public/browser/power_save_blocker.h" |
| #include "content/public/browser/render_process_host.h" |
| #include "content/public/browser/web_contents.h" |
| +#include "ipc/ipc_platform_file.h" |
| + |
| +#if defined(OS_WIN) |
| +#define IntToStringType base::IntToString16 |
| +#else |
| +#define IntToStringType base::IntToString |
| +#endif |
| using base::ProcessId; |
| using std::string; |
| @@ -36,7 +43,6 @@ static base::ListValue* EnsureLogList(base::DictionaryValue* dict) { |
| } |
| return log; |
| } |
| - |
|
Henrik Grunell
2016/05/10 08:44:56
Keep empty line.
Ivo-OOO until feb 6
2016/05/12 13:23:23
Done.
|
| } // namespace |
| WebRTCInternals::PendingUpdate::PendingUpdate( |
| @@ -68,6 +74,7 @@ WebRTCInternals::WebRTCInternals(int aggregate_updates_ms) |
| : audio_debug_recordings_(false), |
| event_log_recordings_(false), |
| selecting_event_log_(false), |
| + number_event_log_files_(0), |
| aggregate_updates_ms_(aggregate_updates_ms), |
| weak_factory_(this) { |
| // TODO(grunell): Shouldn't all the webrtc_internals* files be excluded from the |
| @@ -342,13 +349,16 @@ void WebRTCInternals::SetEventLogRecordings( |
| event_log_recordings_ = false; |
| // Tear down the dialog since the user has unchecked the audio debug |
| // recordings box. |
| - select_file_dialog_ = nullptr; |
| DCHECK(select_file_dialog_->HasOneRef()); |
| + select_file_dialog_ = nullptr; |
| for (RenderProcessHost::iterator i( |
| content::RenderProcessHost::AllHostsIterator()); |
| !i.IsAtEnd(); i.Advance()) { |
| - i.GetCurrentValue()->DisableEventLogRecordings(); |
| + int rid = i.GetCurrentValue()->GetID(); |
|
Henrik Grunell
2016/05/10 08:44:56
I'd prefer to have some other component keep track
Ivo-OOO until feb 6
2016/05/12 13:23:23
I have moved this into a new class: WebRTCCallback
|
| + if (event_log_handlers.count(rid)) { |
| + event_log_handlers[rid].second.Run(); |
| + } |
| } |
| } |
| #endif |
| @@ -359,9 +369,12 @@ bool WebRTCInternals::IsEventLogRecordingsEnabled() const { |
| return event_log_recordings_; |
| } |
| -const base::FilePath& WebRTCInternals::GetEventLogRecordingsFilePath() const { |
| - DCHECK_CURRENTLY_ON(BrowserThread::UI); |
| - return event_log_recordings_file_path_; |
| +void WebRTCInternals::RegisterEventLogHandler( |
| + int render_process_id, |
| + event_log_start_func start_logging_callback, |
| + event_log_stop_func stop_logging_callback) { |
| + event_log_handlers[render_process_id] = |
| + std::make_pair(start_logging_callback, stop_logging_callback); |
| } |
| void WebRTCInternals::SendUpdate(const string& command, |
| @@ -486,8 +499,10 @@ void WebRTCInternals::EnableEventLogRecordingsOnAllRenderProcessHosts() { |
| for (RenderProcessHost::iterator i( |
| content::RenderProcessHost::AllHostsIterator()); |
| !i.IsAtEnd(); i.Advance()) { |
| - i.GetCurrentValue()->EnableEventLogRecordings( |
| - event_log_recordings_file_path_); |
| + int rid = i.GetCurrentValue()->GetID(); |
| + if (event_log_handlers.count(rid)) { |
| + event_log_handlers[rid].first.Run(event_log_recordings_file_path_); |
| + } |
| } |
| } |
| #endif |