Index: media/blink/video_frame_compositor.cc |
diff --git a/media/blink/video_frame_compositor.cc b/media/blink/video_frame_compositor.cc |
index 544f7098701d481c2358c2493d2f59aae52d5256..96192f501df944e83d62c6fff99ced204db5389a 100644 |
--- a/media/blink/video_frame_compositor.cc |
+++ b/media/blink/video_frame_compositor.cc |
@@ -7,6 +7,7 @@ |
#include "base/bind.h" |
#include "base/message_loop/message_loop.h" |
#include "base/time/default_tick_clock.h" |
+#include "base/trace_event/auto_open_close_event.h" |
#include "base/trace_event/trace_event.h" |
#include "media/base/video_frame.h" |
@@ -52,6 +53,18 @@ void VideoFrameCompositor::OnRendererStateUpdate(bool new_state) { |
DCHECK_NE(rendering_, new_state); |
rendering_ = new_state; |
+ if (!auto_open_close_) { |
+ auto_open_close_.reset(new base::trace_event::AutoOpenCloseEvent( |
+ base::trace_event::AutoOpenCloseEvent::Type::ASYNC, "media,rail", |
+ "VideoPlayback")); |
+ } |
+ |
+ if (rendering_) { |
+ auto_open_close_->Begin(); |
+ } else { |
+ auto_open_close_->End(); |
+ } |
+ |
if (rendering_) { |
// Always start playback in background rendering mode, if |client_| kicks |
// in right away it's okay. |
@@ -105,9 +118,6 @@ bool VideoFrameCompositor::HasCurrentFrame() { |
} |
void VideoFrameCompositor::Start(RenderCallback* callback) { |
- TRACE_EVENT_ASYNC_BEGIN0("media,rail", "VideoPlayback", |
- static_cast<const void*>(this)); |
- |
// Called from the media thread, so acquire the callback under lock before |
// returning in case a Stop() call comes in before the PostTask is processed. |
base::AutoLock lock(callback_lock_); |
@@ -119,9 +129,6 @@ void VideoFrameCompositor::Start(RenderCallback* callback) { |
} |
void VideoFrameCompositor::Stop() { |
- TRACE_EVENT_ASYNC_END0("media,rail", "VideoPlayback", |
- static_cast<const void*>(this)); |
- |
// Called from the media thread, so release the callback under lock before |
// returning to avoid a pending UpdateCurrentFrame() call occurring before |
// the PostTask is processed. |