Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/logging.h" | |
| 6 #include "media/base/media_log.h" | |
| 7 | |
| 8 namespace media { | |
| 9 | |
| 10 // A count of all MediaLogs created on this render process. | |
| 11 // Used to generate unique ids. | |
| 12 static int32 media_log_count = 0; | |
|
acolwell GONE FROM CHROMIUM
2011/08/03 16:31:37
Do we need to worry about thread safety here? If s
Scott Franklin
2011/08/03 20:55:04
In practice, no, MediaLogs are only created on the
| |
| 13 | |
| 14 const char* MediaLog::EventTypeToString(MediaLogEvent::Type type) { | |
| 15 switch (type) { | |
| 16 case MediaLogEvent::CREATE: | |
| 17 return "CREATE"; | |
| 18 case MediaLogEvent::DESTROY: | |
| 19 return "DESTROY"; | |
| 20 case MediaLogEvent::LOAD: | |
| 21 return "LOAD"; | |
| 22 case MediaLogEvent::PLAY: | |
| 23 return "PLAY"; | |
| 24 case MediaLogEvent::PAUSE: | |
| 25 return "PAUSE"; | |
| 26 } | |
| 27 NOTREACHED(); | |
| 28 return NULL; | |
| 29 } | |
| 30 | |
| 31 MediaLog::MediaLog() { | |
| 32 id_ = media_log_count; | |
| 33 media_log_count++; | |
| 34 } | |
| 35 | |
| 36 MediaLog::~MediaLog() {} | |
| 37 | |
| 38 void MediaLog::Load(const std::string& url) { | |
| 39 MediaLogEvent* event = CreateEvent(MediaLogEvent::LOAD); | |
| 40 event->params.SetString("url", url); | |
| 41 AddEvent(event); | |
| 42 } | |
| 43 | |
| 44 void MediaLog::AddEventOfType(MediaLogEvent::Type type) { | |
| 45 MediaLogEvent* event = CreateEvent(type); | |
| 46 AddEvent(event); | |
| 47 } | |
| 48 | |
| 49 MediaLogEvent* MediaLog::CreateEvent(MediaLogEvent::Type type) { | |
| 50 MediaLogEvent* event = new MediaLogEvent; | |
| 51 event->id = id_; | |
| 52 event->type = type; | |
| 53 event->time = base::Time::Now(); | |
| 54 return event; | |
| 55 } | |
| 56 | |
| 57 void MediaLog::AddEvent(MediaLogEvent* event) {} | |
| 58 | |
| 59 } //namespace media | |
| OLD | NEW |