| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/media/webrtc_logging_handler_host.h" | 5 #include "chrome/browser/media/webrtc_logging_handler_host.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> |
| 8 | 9 |
| 9 #include "base/bind.h" | 10 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
| 11 #include "base/cpu.h" | 12 #include "base/cpu.h" |
| 12 #include "base/files/file_util.h" | 13 #include "base/files/file_util.h" |
| 13 #include "base/logging.h" | 14 #include "base/logging.h" |
| 14 #include "base/prefs/pref_service.h" | 15 #include "base/prefs/pref_service.h" |
| 15 #include "base/strings/string_number_conversions.h" | 16 #include "base/strings/string_number_conversions.h" |
| 16 #include "base/sys_info.h" | 17 #include "base/sys_info.h" |
| 17 #include "base/time/time.h" | 18 #include "base/time/time.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 172 | 173 |
| 173 void WebRtcLoggingHandlerHost::SetMetaData( | 174 void WebRtcLoggingHandlerHost::SetMetaData( |
| 174 scoped_ptr<MetaDataMap> meta_data, | 175 scoped_ptr<MetaDataMap> meta_data, |
| 175 const GenericDoneCallback& callback) { | 176 const GenericDoneCallback& callback) { |
| 176 DCHECK_CURRENTLY_ON(BrowserThread::IO); | 177 DCHECK_CURRENTLY_ON(BrowserThread::IO); |
| 177 DCHECK(!callback.is_null()); | 178 DCHECK(!callback.is_null()); |
| 178 | 179 |
| 179 std::string error_message; | 180 std::string error_message; |
| 180 if (logging_state_ == CLOSED) { | 181 if (logging_state_ == CLOSED) { |
| 181 if (!meta_data_.get()) | 182 if (!meta_data_.get()) |
| 182 meta_data_ = meta_data.Pass(); | 183 meta_data_ = std::move(meta_data); |
| 183 } else if (logging_state_ == STARTED) { | 184 } else if (logging_state_ == STARTED) { |
| 184 std::string meta_data_message; | 185 std::string meta_data_message; |
| 185 FormatMetaDataAsLogMessage(*meta_data.get(), &meta_data_message); | 186 FormatMetaDataAsLogMessage(*meta_data.get(), &meta_data_message); |
| 186 LogToCircularBuffer(meta_data_message); | 187 LogToCircularBuffer(meta_data_message); |
| 187 } else { | 188 } else { |
| 188 error_message = "Meta data must be set before stop or upload."; | 189 error_message = "Meta data must be set before stop or upload."; |
| 189 } | 190 } |
| 190 | 191 |
| 191 if (error_message.empty() && meta_data.get()) { | 192 if (error_message.empty() && meta_data.get()) { |
| 192 // Keep the meta data around for uploading separately from the log. | 193 // Keep the meta data around for uploading separately from the log. |
| (...skipping 672 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 865 | 866 |
| 866 if (!is_audio_debug_recordings_in_progress_) { | 867 if (!is_audio_debug_recordings_in_progress_) { |
| 867 error_callback.Run("No audio debug recording in progress"); | 868 error_callback.Run("No audio debug recording in progress"); |
| 868 return; | 869 return; |
| 869 } | 870 } |
| 870 | 871 |
| 871 host->DisableAudioDebugRecordings(); | 872 host->DisableAudioDebugRecordings(); |
| 872 is_audio_debug_recordings_in_progress_ = false; | 873 is_audio_debug_recordings_in_progress_ = false; |
| 873 callback.Run(prefix_path.AsUTF8Unsafe(), true /* stopped */, is_manual_stop); | 874 callback.Run(prefix_path.AsUTF8Unsafe(), true /* stopped */, is_manual_stop); |
| 874 } | 875 } |
| OLD | NEW |