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/logging.h" | 10 #include "base/logging.h" |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
134 scoped_ptr<MediaLogEvent> MediaLog::CreateStringEvent( | 134 scoped_ptr<MediaLogEvent> MediaLog::CreateStringEvent( |
135 MediaLogEvent::Type type, const char* property, const std::string& value) { | 135 MediaLogEvent::Type type, const char* property, const std::string& value) { |
136 scoped_ptr<MediaLogEvent> event(CreateEvent(type)); | 136 scoped_ptr<MediaLogEvent> event(CreateEvent(type)); |
137 event->params.SetString(property, value); | 137 event->params.SetString(property, value); |
138 return event.Pass(); | 138 return event.Pass(); |
139 } | 139 } |
140 | 140 |
141 scoped_ptr<MediaLogEvent> MediaLog::CreateTimeEvent( | 141 scoped_ptr<MediaLogEvent> MediaLog::CreateTimeEvent( |
142 MediaLogEvent::Type type, const char* property, base::TimeDelta value) { | 142 MediaLogEvent::Type type, const char* property, base::TimeDelta value) { |
143 scoped_ptr<MediaLogEvent> event(CreateEvent(type)); | 143 scoped_ptr<MediaLogEvent> event(CreateEvent(type)); |
144 if (value.is_max()) | 144 event->params.SetDouble(property, value.InSecondsF()); |
145 event->params.SetString(property, "unknown"); | |
146 else | |
147 event->params.SetDouble(property, value.InSecondsF()); | |
148 return event.Pass(); | 145 return event.Pass(); |
149 } | 146 } |
150 | 147 |
151 scoped_ptr<MediaLogEvent> MediaLog::CreateLoadEvent(const std::string& url) { | 148 scoped_ptr<MediaLogEvent> MediaLog::CreateLoadEvent(const std::string& url) { |
152 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::LOAD)); | 149 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::LOAD)); |
153 event->params.SetString("url", url); | 150 event->params.SetString("url", url); |
154 return event.Pass(); | 151 return event.Pass(); |
155 } | 152 } |
156 | 153 |
157 scoped_ptr<MediaLogEvent> MediaLog::CreateSeekEvent(float seconds) { | 154 scoped_ptr<MediaLogEvent> MediaLog::CreateSeekEvent(float seconds) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
225 } | 222 } |
226 | 223 |
227 void MediaLog::SetBooleanProperty( | 224 void MediaLog::SetBooleanProperty( |
228 const char* key, bool value) { | 225 const char* key, bool value) { |
229 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::PROPERTY_CHANGE)); | 226 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::PROPERTY_CHANGE)); |
230 event->params.SetBoolean(key, value); | 227 event->params.SetBoolean(key, value); |
231 AddEvent(event.Pass()); | 228 AddEvent(event.Pass()); |
232 } | 229 } |
233 | 230 |
234 } //namespace media | 231 } //namespace media |
OLD | NEW |