Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(137)

Side by Side Diff: media/base/media_log.cc

Issue 186683002: Reland "Add base::TimeDelta::Max()" again. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: remediate to review Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/base/media_log.h ('k') | media/filters/chunk_demuxer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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 event->params.SetDouble(property, value.InSecondsF()); 144 if (value.is_max())
145 event->params.SetString(property, "unknown");
146 else
147 event->params.SetDouble(property, value.InSecondsF());
145 return event.Pass(); 148 return event.Pass();
146 } 149 }
147 150
148 scoped_ptr<MediaLogEvent> MediaLog::CreateLoadEvent(const std::string& url) { 151 scoped_ptr<MediaLogEvent> MediaLog::CreateLoadEvent(const std::string& url) {
149 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::LOAD)); 152 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::LOAD));
150 event->params.SetString("url", url); 153 event->params.SetString("url", url);
151 return event.Pass(); 154 return event.Pass();
152 } 155 }
153 156
154 scoped_ptr<MediaLogEvent> MediaLog::CreateSeekEvent(float seconds) { 157 scoped_ptr<MediaLogEvent> MediaLog::CreateSeekEvent(float seconds) {
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 AddEvent(event.Pass()); 224 AddEvent(event.Pass());
222 } 225 }
223 226
224 void MediaLog::SetBooleanProperty( 227 void MediaLog::SetBooleanProperty(
225 const char* key, bool value) { 228 const char* key, bool value) {
226 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::PROPERTY_CHANGE)); 229 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::PROPERTY_CHANGE));
227 event->params.SetBoolean(key, value); 230 event->params.SetBoolean(key, value);
228 AddEvent(event.Pass()); 231 AddEvent(event.Pass());
229 } 232 }
230 233
234 void MediaLog::SetTimeProperty(
235 const char* key, base::TimeDelta value) {
236 scoped_ptr<MediaLogEvent> event(CreateEvent(MediaLogEvent::PROPERTY_CHANGE));
237 if (value.is_max())
238 event->params.SetString(key, "unknown");
239 else
240 event->params.SetDouble(key, value.InSecondsF());
241 AddEvent(event.Pass());
242 }
243
231 } //namespace media 244 } //namespace media
OLDNEW
« no previous file with comments | « media/base/media_log.h ('k') | media/filters/chunk_demuxer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698