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() {} |