| Index: chrome/common/metrics/metrics_log_manager.cc
|
| diff --git a/chrome/common/metrics/metrics_log_manager.cc b/chrome/common/metrics/metrics_log_manager.cc
|
| index e78ce89e152419e09669e77c104c7ab8b9f9ad03..af1be0c7be6c777cc18b7d318acc18bcfcf92eea 100644
|
| --- a/chrome/common/metrics/metrics_log_manager.cc
|
| +++ b/chrome/common/metrics/metrics_log_manager.cc
|
| @@ -87,21 +87,35 @@ void MetricsLogManager::StageNextLogForUpload() {
|
| }
|
|
|
| bool MetricsLogManager::has_staged_log() const {
|
| - return !staged_log_text().empty();
|
| + return has_staged_log_proto() || has_staged_log_xml();
|
| }
|
|
|
| bool MetricsLogManager::has_staged_log_proto() const {
|
| - return has_staged_log() && staged_log_text().proto != kDiscardedLog;
|
| + return
|
| + !staged_log_text().proto.empty() &&
|
| + staged_log_text().proto != kDiscardedLog;
|
| }
|
|
|
| -void MetricsLogManager::DiscardStagedLog() {
|
| - staged_log_text_.xml.clear();
|
| - staged_log_text_.proto.clear();
|
| - staged_log_type_ = NO_LOG;
|
| +bool MetricsLogManager::has_staged_log_xml() const {
|
| + return
|
| + !staged_log_text().xml.empty() &&
|
| + staged_log_text().xml != kDiscardedLog;
|
| }
|
|
|
| void MetricsLogManager::DiscardStagedLogProto() {
|
| staged_log_text_.proto = kDiscardedLog;
|
| +
|
| + // If we're discarding the last piece of the log, reset the staged log state.
|
| + if (!has_staged_log())
|
| + DiscardStagedLog();
|
| +}
|
| +
|
| +void MetricsLogManager::DiscardStagedLogXml() {
|
| + staged_log_text_.xml = kDiscardedLog;
|
| +
|
| + // If we're discarding the last piece of the log, reset the staged log state.
|
| + if (!has_staged_log())
|
| + DiscardStagedLog();
|
| }
|
|
|
| void MetricsLogManager::DiscardCurrentLog() {
|
| @@ -220,6 +234,12 @@ void MetricsLogManager::CompressCurrentLog(SerializedLog* compressed_log) {
|
| }
|
| }
|
|
|
| +void MetricsLogManager::DiscardStagedLog() {
|
| + staged_log_text_.xml.clear();
|
| + staged_log_text_.proto.clear();
|
| + staged_log_type_ = NO_LOG;
|
| +}
|
| +
|
| // static
|
| // This implementation is based on the Firefox MetricsService implementation.
|
| bool MetricsLogManager::Bzip2Compress(const std::string& input,
|
|
|