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 "content/renderer/media/content_media_log.h" | |
| 6 | |
| 7 #include "base/message_loop.h" | |
| 8 #include "content/common/media/media_log_messages.h" | |
| 9 #include "content/renderer/render_thread.h" | |
| 10 | |
| 11 ContentMediaLog::ContentMediaLog() : render_loop_(MessageLoop::current()) { | |
| 12 DCHECK(RenderThread::current()) << | |
| 13 "ContentMediaLog must be constructed on the render thread"; | |
| 14 } | |
| 15 | |
| 16 void ContentMediaLog::AddEvent(Event* event) { | |
| 17 scoped_ptr<Event> e(event); | |
| 18 | |
| 19 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.
| |
| 20 RenderThread::current()->Send(new MediaLogMsg_MediaEvent(*e)); | |
| 21 } else { | |
| 22 render_loop_->PostTask(FROM_HERE, | |
| 23 NewRunnableMethod(this, &ContentMediaLog::AddEvent, e.release())); | |
| 24 } | |
| 25 } | |
| 26 | |
| 27 ContentMediaLog::~ContentMediaLog() {} | |
| OLD | NEW |