| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "media/base/media_log.h" | 5 #include "media/base/media_log.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/atomic_sequence_num.h" | 9 #include "base/atomic_sequence_num.h" |
| 10 #include "base/json/json_writer.h" | 10 #include "base/json/json_writer.h" |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 134 // event for figuring out media pipeline failures, and just reporting | 134 // event for figuring out media pipeline failures, and just reporting |
| 135 // pipeline status as numeric code is not very helpful/user-friendly. | 135 // pipeline status as numeric code is not very helpful/user-friendly. |
| 136 int error_code = 0; | 136 int error_code = 0; |
| 137 if (event.type == MediaLogEvent::PIPELINE_ERROR && | 137 if (event.type == MediaLogEvent::PIPELINE_ERROR && |
| 138 event.params.GetInteger("pipeline_error", &error_code)) { | 138 event.params.GetInteger("pipeline_error", &error_code)) { |
| 139 PipelineStatus status = static_cast<PipelineStatus>(error_code); | 139 PipelineStatus status = static_cast<PipelineStatus>(error_code); |
| 140 return EventTypeToString(event.type) + " " + | 140 return EventTypeToString(event.type) + " " + |
| 141 media::MediaLog::PipelineStatusToString(status); | 141 media::MediaLog::PipelineStatusToString(status); |
| 142 } | 142 } |
| 143 std::string params_json; | 143 std::string params_json; |
| 144 base::JSONWriter::Write(&event.params, ¶ms_json); | 144 base::JSONWriter::Write(event.params, ¶ms_json); |
| 145 return EventTypeToString(event.type) + " " + params_json; | 145 return EventTypeToString(event.type) + " " + params_json; |
| 146 } | 146 } |
| 147 | 147 |
| 148 MediaLog::MediaLog() : id_(g_media_log_count.GetNext()) {} | 148 MediaLog::MediaLog() : id_(g_media_log_count.GetNext()) {} |
| 149 | 149 |
| 150 MediaLog::~MediaLog() {} | 150 MediaLog::~MediaLog() {} |
| 151 | 151 |
| 152 void MediaLog::AddEvent(scoped_ptr<MediaLogEvent> event) {} | 152 void MediaLog::AddEvent(scoped_ptr<MediaLogEvent> event) {} |
| 153 | 153 |
| 154 scoped_ptr<MediaLogEvent> MediaLog::CreateEvent(MediaLogEvent::Type type) { | 154 scoped_ptr<MediaLogEvent> MediaLog::CreateEvent(MediaLogEvent::Type type) { |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 : level_(level), log_cb_(log_cb) { | 284 : level_(level), log_cb_(log_cb) { |
| 285 } | 285 } |
| 286 | 286 |
| 287 LogHelper::~LogHelper() { | 287 LogHelper::~LogHelper() { |
| 288 if (log_cb_.is_null()) | 288 if (log_cb_.is_null()) |
| 289 return; | 289 return; |
| 290 log_cb_.Run(level_, stream_.str()); | 290 log_cb_.Run(level_, stream_.str()); |
| 291 } | 291 } |
| 292 | 292 |
| 293 } //namespace media | 293 } //namespace media |
| OLD | NEW |