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

Unified Diff: media/blink/video_frame_compositor.cc

Issue 2159323002: Add tracing AutoOpenCloseEvent. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: add forward declaration Created 4 years, 2 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
« no previous file with comments | « media/blink/video_frame_compositor.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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.
« no previous file with comments | « media/blink/video_frame_compositor.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698