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

Unified Diff: media/base/media_log.cc

Issue 7480032: Plumb media data from renderers up to MediaInternals in the browser process. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: s/MessageLoop/MessageLoopProxy Created 9 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: media/base/media_log.cc
diff --git a/media/base/media_log.cc b/media/base/media_log.cc
new file mode 100644
index 0000000000000000000000000000000000000000..8d64c1b80571a19d152f662251061b147818774a
--- /dev/null
+++ b/media/base/media_log.cc
@@ -0,0 +1,59 @@
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "base/logging.h"
+#include "media/base/media_log.h"
+
+namespace media {
+
+// A count of all MediaLogs created on this render process.
+// Used to generate unique ids.
+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
+
+const char* MediaLog::EventTypeToString(MediaLogEvent::Type type) {
+ switch (type) {
+ case MediaLogEvent::CREATE:
+ return "CREATE";
+ case MediaLogEvent::DESTROY:
+ return "DESTROY";
+ case MediaLogEvent::LOAD:
+ return "LOAD";
+ case MediaLogEvent::PLAY:
+ return "PLAY";
+ case MediaLogEvent::PAUSE:
+ return "PAUSE";
+ }
+ NOTREACHED();
+ return NULL;
+}
+
+MediaLog::MediaLog() {
+ id_ = media_log_count;
+ media_log_count++;
+}
+
+MediaLog::~MediaLog() {}
+
+void MediaLog::Load(const std::string& url) {
+ MediaLogEvent* event = CreateEvent(MediaLogEvent::LOAD);
+ event->params.SetString("url", url);
+ AddEvent(event);
+}
+
+void MediaLog::AddEventOfType(MediaLogEvent::Type type) {
+ MediaLogEvent* event = CreateEvent(type);
+ AddEvent(event);
+}
+
+MediaLogEvent* MediaLog::CreateEvent(MediaLogEvent::Type type) {
+ MediaLogEvent* event = new MediaLogEvent;
+ event->id = id_;
+ event->type = type;
+ event->time = base::Time::Now();
+ return event;
+}
+
+void MediaLog::AddEvent(MediaLogEvent* event) {}
+
+} //namespace media

Powered by Google App Engine
This is Rietveld 408576698