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

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: create the AutoOpenCloseEvent when you use it Created 4 years, 3 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..1229df0398c2c0d148d350ae4c26b98025be2891 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"
@@ -35,7 +36,8 @@ VideoFrameCompositor::VideoFrameCompositor(
new_background_frame_(false),
// Assume 60Hz before the first UpdateCurrentFrame() call.
last_interval_(base::TimeDelta::FromSecondsD(1.0 / 60)),
- callback_(nullptr) {
+ callback_(nullptr),
+ auto_open_close_(nullptr) {
background_rendering_timer_.SetTaskRunner(compositor_task_runner_);
}
@@ -43,6 +45,8 @@ VideoFrameCompositor::~VideoFrameCompositor() {
DCHECK(compositor_task_runner_->BelongsToCurrentThread());
benjhayden 2016/10/11 21:42:19 You're deleting auto_open_close_ on the compositor
DCHECK(!callback_);
DCHECK(!rendering_);
+ if (auto_open_close_)
+ delete auto_open_close_;
if (client_)
client_->StopUsingProvider();
}
@@ -105,8 +109,12 @@ bool VideoFrameCompositor::HasCurrentFrame() {
}
void VideoFrameCompositor::Start(RenderCallback* callback) {
- TRACE_EVENT_ASYNC_BEGIN0("media,rail", "VideoPlayback",
- static_cast<const void*>(this));
+ if (auto_open_close_ == nullptr) {
benjhayden 2016/10/11 21:42:19 It looks like you're creating this and calling Beg
+ auto_open_close_ = new base::trace_event::AutoOpenCloseEvent(
+ base::trace_event::AutoOpenCloseEvent::Type::ASYNC, "media,rail",
+ "VideoPlayback");
+ }
+ auto_open_close_->Begin();
// 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.
@@ -119,8 +127,7 @@ void VideoFrameCompositor::Start(RenderCallback* callback) {
}
void VideoFrameCompositor::Stop() {
- TRACE_EVENT_ASYNC_END0("media,rail", "VideoPlayback",
- static_cast<const void*>(this));
+ auto_open_close_->End();
// Called from the media thread, so release the callback under lock before
// returning to avoid a pending UpdateCurrentFrame() call occurring before
« 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