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

Unified Diff: content/renderer/media/content_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: Much cleanup and making MediaLog thread safe. 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: content/renderer/media/content_media_log.cc
diff --git a/content/renderer/media/content_media_log.cc b/content/renderer/media/content_media_log.cc
new file mode 100644
index 0000000000000000000000000000000000000000..6a95080390e20175960568035732db637bca37bb
--- /dev/null
+++ b/content/renderer/media/content_media_log.cc
@@ -0,0 +1,27 @@
+// 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 "content/renderer/media/content_media_log.h"
+
+#include "base/message_loop.h"
+#include "content/common/media/media_log_messages.h"
+#include "content/renderer/render_thread.h"
+
+ContentMediaLog::ContentMediaLog() : render_loop_(MessageLoop::current()) {
+ DCHECK(RenderThread::current()) <<
+ "ContentMediaLog must be constructed on the render thread";
+}
+
+void ContentMediaLog::AddEvent(Event* event) {
+ scoped_ptr<Event> e(event);
+
+ if (MessageLoop::current() == render_loop_) {
jam 2011/07/29 16:08:55 you don't need to store the message loop pointer.
Scott Franklin 2011/07/29 22:30:25 Right, but I then have no way of posting the task
jam 2011/08/01 06:03:25 of course, nm them :) although please use MessageL
Scott Franklin 2011/08/01 18:41:04 Done.
+ RenderThread::current()->Send(new MediaLogMsg_MediaEvent(*e));
+ } else {
+ render_loop_->PostTask(FROM_HERE,
+ NewRunnableMethod(this, &ContentMediaLog::AddEvent, e.release()));
+ }
+}
+
+ContentMediaLog::~ContentMediaLog() {}

Powered by Google App Engine
This is Rietveld 408576698