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 "base/atomic_sequence_num.h" | 7 #include "base/atomic_sequence_num.h" |
8 #include "base/json/json_writer.h" | 8 #include "base/json/json_writer.h" |
9 #include "base/values.h" | 9 #include "base/values.h" |
10 | 10 |
(...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
209 | 209 |
210 scoped_ptr<MediaLogEvent> MediaLog::CreateVideoSizeSetEvent( | 210 scoped_ptr<MediaLogEvent> MediaLog::CreateVideoSizeSetEvent( |
211 size_t width, size_t height) { | 211 size_t width, size_t height) { |
212 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::VIDEO_SIZE_SET)); | 212 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::VIDEO_SIZE_SET)); |
213 event->params.SetInteger("width", width); | 213 event->params.SetInteger("width", width); |
214 event->params.SetInteger("height", height); | 214 event->params.SetInteger("height", height); |
215 return event.Pass(); | 215 return event.Pass(); |
216 } | 216 } |
217 | 217 |
218 scoped_ptr<MediaLogEvent> MediaLog::CreateBufferedExtentsChangedEvent( | 218 scoped_ptr<MediaLogEvent> MediaLog::CreateBufferedExtentsChangedEvent( |
219 int64 start, int64 current, int64 end) { | 219 int64_t start, |
| 220 int64_t current, |
| 221 int64_t end) { |
220 scoped_ptr<MediaLogEvent> event( | 222 scoped_ptr<MediaLogEvent> event( |
221 CreateEvent(MediaLogEvent::BUFFERED_EXTENTS_CHANGED)); | 223 CreateEvent(MediaLogEvent::BUFFERED_EXTENTS_CHANGED)); |
222 // These values are headed to JS where there is no int64 so we use a double | 224 // These values are headed to JS where there is no int64_t so we use a double |
223 // and accept loss of precision above 2^53 bytes (8 Exabytes). | 225 // and accept loss of precision above 2^53 bytes (8 Exabytes). |
224 event->params.SetDouble("buffer_start", start); | 226 event->params.SetDouble("buffer_start", start); |
225 event->params.SetDouble("buffer_current", current); | 227 event->params.SetDouble("buffer_current", current); |
226 event->params.SetDouble("buffer_end", end); | 228 event->params.SetDouble("buffer_end", end); |
227 return event.Pass(); | 229 return event.Pass(); |
228 } | 230 } |
229 | 231 |
230 void MediaLog::AddLogEvent(MediaLogLevel level, const std::string& message) { | 232 void MediaLog::AddLogEvent(MediaLogLevel level, const std::string& message) { |
231 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogLevelToEventType(level))); | 233 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogLevelToEventType(level))); |
232 event->params.SetString(MediaLogLevelToString(level), message); | 234 event->params.SetString(MediaLogLevelToString(level), message); |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
275 const scoped_refptr<MediaLog>& media_log) | 277 const scoped_refptr<MediaLog>& media_log) |
276 : level_(level), media_log_(media_log) { | 278 : level_(level), media_log_(media_log) { |
277 DCHECK(media_log_.get()); | 279 DCHECK(media_log_.get()); |
278 } | 280 } |
279 | 281 |
280 LogHelper::~LogHelper() { | 282 LogHelper::~LogHelper() { |
281 media_log_->AddLogEvent(level_, stream_.str()); | 283 media_log_->AddLogEvent(level_, stream_.str()); |
282 } | 284 } |
283 | 285 |
284 } //namespace media | 286 } //namespace media |
OLD | NEW |