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

Unified Diff: third_party/WebKit/Source/modules/mediacapturefromelement/TimedCanvasDrawListener.cpp

Issue 1746443002: Use Timer in TimedCanvasDrawListener (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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 | « third_party/WebKit/Source/modules/mediacapturefromelement/TimedCanvasDrawListener.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/modules/mediacapturefromelement/TimedCanvasDrawListener.cpp
diff --git a/third_party/WebKit/Source/modules/mediacapturefromelement/TimedCanvasDrawListener.cpp b/third_party/WebKit/Source/modules/mediacapturefromelement/TimedCanvasDrawListener.cpp
index c57578a6cfe8d58c0ff298e456b1ebd3d05dd4e3..f05e2c559508a1d9fbf29095ba05b17aa64d31cb 100644
--- a/third_party/WebKit/Source/modules/mediacapturefromelement/TimedCanvasDrawListener.cpp
+++ b/third_party/WebKit/Source/modules/mediacapturefromelement/TimedCanvasDrawListener.cpp
@@ -4,16 +4,13 @@
#include "modules/mediacapturefromelement/TimedCanvasDrawListener.h"
-#include "public/platform/Platform.h"
-#include "public/platform/WebTaskRunner.h"
-#include "public/platform/WebTraceLocation.h"
-
namespace blink {
TimedCanvasDrawListener::TimedCanvasDrawListener(const PassOwnPtr<WebCanvasCaptureHandler>& handler, double frameRate)
: CanvasDrawListener(handler)
+ , m_frameInterval(1 / frameRate)
+ , m_requestFrameTimer(this, &TimedCanvasDrawListener::requestFrameTimerFired)
{
- m_frameInterval = 1000 / frameRate;
}
TimedCanvasDrawListener::~TimedCanvasDrawListener() {}
@@ -22,7 +19,7 @@ TimedCanvasDrawListener::~TimedCanvasDrawListener() {}
TimedCanvasDrawListener* TimedCanvasDrawListener::create(const PassOwnPtr<WebCanvasCaptureHandler>& handler, double frameRate)
{
TimedCanvasDrawListener* listener = new TimedCanvasDrawListener(handler, frameRate);
- listener->postRequestFrameCaptureTask();
+ listener->m_requestFrameTimer.startRepeating(listener->m_frameInterval, BLINK_FROM_HERE);
return listener;
}
@@ -32,10 +29,10 @@ void TimedCanvasDrawListener::sendNewFrame(const WTF::PassRefPtr<SkImage>& image
CanvasDrawListener::sendNewFrame(image);
}
-void TimedCanvasDrawListener::postRequestFrameCaptureTask()
+void TimedCanvasDrawListener::requestFrameTimerFired(Timer<TimedCanvasDrawListener>*)
{
+ // TODO(emircan): Measure the jitter and log, see crbug.com/589974.
m_frameCaptureRequested = true;
- Platform::current()->currentThread()->taskRunner()->postDelayedTask(BLINK_FROM_HERE, bind(&TimedCanvasDrawListener::postRequestFrameCaptureTask, this), m_frameInterval);
}
} // namespace blink
« no previous file with comments | « third_party/WebKit/Source/modules/mediacapturefromelement/TimedCanvasDrawListener.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698