Chromium Code Reviews| Index: chrome/browser/media/webrtc_event_log_handler.cc |
| diff --git a/chrome/browser/media/webrtc_event_log_handler.cc b/chrome/browser/media/webrtc_event_log_handler.cc |
| index 0d9baccce4be9ff2de0f7586f9bd9508f533285f..6e798604dc7d6e048614973cdb1d83f240f4a746 100644 |
| --- a/chrome/browser/media/webrtc_event_log_handler.cc |
| +++ b/chrome/browser/media/webrtc_event_log_handler.cc |
| @@ -31,14 +31,13 @@ base::FilePath GetWebRtcEventLogPrefixPath(const base::FilePath& directory, |
| uint64_t rtc_event_log_id) { |
|
Henrik Grunell
2016/05/24 13:31:59
Isn't an int enough?
Ivo-OOO until feb 6
2016/05/25 14:57:00
It probably is, but since the current code uses a
|
| static const char kWebRtcEventLogFilePrefix[] = "WebRtcEventLog."; |
| return directory.AppendASCII(kWebRtcEventLogFilePrefix + |
| - base::Int64ToString(rtc_event_log_id)); |
| + base::Uint64ToString(rtc_event_log_id)); |
| } |
| } // namespace |
| WebRtcEventLogHandler::WebRtcEventLogHandler(Profile* profile) |
| : profile_(profile), |
| - is_rtc_event_logging_in_progress_(false), |
| current_rtc_event_log_id_(0) { |
| DCHECK(profile_); |
| thread_checker_.DetachFromThread(); |
| @@ -94,16 +93,13 @@ void WebRtcEventLogHandler::DoStartWebRtcEventLogging( |
| const base::FilePath& log_directory) { |
| DCHECK(thread_checker_.CalledOnValidThread()); |
| - if (is_rtc_event_logging_in_progress_) { |
| + base::FilePath prefix_path = |
| + GetWebRtcEventLogPrefixPath(log_directory, current_rtc_event_log_id_); |
| + if (!host->StartWebRTCEventLog(prefix_path)) { |
| error_callback.Run("RTC event logging already in progress"); |
| return; |
| } |
| - is_rtc_event_logging_in_progress_ = true; |
| - base::FilePath prefix_path = |
| - GetWebRtcEventLogPrefixPath(log_directory, ++current_rtc_event_log_id_); |
| - host->EnableEventLogRecordings(prefix_path); |
| - |
| if (delay.is_zero()) { |
| const bool is_stopped = false, is_manual_stop = false; |
| callback.Run(prefix_path.AsUTF8Unsafe(), is_stopped, is_manual_stop); |
| @@ -114,7 +110,7 @@ void WebRtcEventLogHandler::DoStartWebRtcEventLogging( |
| BrowserThread::PostDelayedTask( |
| BrowserThread::UI, FROM_HERE, |
| base::Bind(&WebRtcEventLogHandler::DoStopWebRtcEventLogging, this, host, |
| - is_manual_stop, current_rtc_event_log_id_, callback, |
| + is_manual_stop, ++current_rtc_event_log_id_, callback, |
|
ncarter (slow)
2016/05/20 18:27:20
This ++ doesn't make any sense to me. The paramete
Ivo-OOO until feb 6
2016/05/25 14:57:00
Right, good catch. This ++ is indeed in the wrong
|
| error_callback, log_directory), |
| delay); |
| } |
| @@ -142,13 +138,11 @@ void WebRtcEventLogHandler::DoStopWebRtcEventLogging( |
| return; |
| } |
| - if (!is_rtc_event_logging_in_progress_) { |
| + if (!host->StopWebRTCEventLog()) { |
| error_callback.Run("No RTC event logging in progress"); |
| return; |
| } |
| - host->DisableEventLogRecordings(); |
| - is_rtc_event_logging_in_progress_ = false; |
| const bool is_stopped = true; |
| callback.Run(prefix_path.AsUTF8Unsafe(), is_stopped, is_manual_stop); |
| } |