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

Unified Diff: third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp

Issue 1945903003: Demonstration: postIdleTask does not work when users do not move mouse Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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/core/html/canvas/CanvasAsyncBlobCreator.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/core/html/canvas/CanvasAsyncBlobCreator.cpp
diff --git a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp
index 86acd77dab2b4b29382b64ffd2ec6394a39acbbb..4e61747e58d129538ed3a73008dd29ed0d736481 100644
--- a/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp
+++ b/third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.cpp
@@ -17,6 +17,7 @@
#include "public/platform/WebTraceLocation.h"
#include "wtf/CurrentTime.h"
#include "wtf/Functional.h"
+#include <iostream>
namespace blink {
@@ -107,6 +108,7 @@ void CanvasAsyncBlobCreator::initiateJpegEncoding(const double& quality)
void CanvasAsyncBlobCreator::scheduleInitiatePngEncoding()
{
+ std::cout << "Begin! Posting idle task to initiate" << std::endl;
Platform::current()->mainThread()->scheduler()->postIdleTask(BLINK_FROM_HERE, bind<double>(&CanvasAsyncBlobCreator::initiatePngEncoding, this));
}
@@ -117,6 +119,7 @@ void CanvasAsyncBlobCreator::initiatePngEncoding(double deadlineSeconds)
return;
}
+ std::cout << "Idle task is starting " << std::endl;
ASSERT(m_idleTaskStatus == IdleTaskNotStarted);
m_idleTaskStatus = IdleTaskStarted;
@@ -134,10 +137,14 @@ void CanvasAsyncBlobCreator::idleEncodeRowsPng(double deadlineSeconds)
return;
}
+ if (m_numRowsCompleted > 0 )
+ std::cout << "Idle task continued... " << std::flush;
+
unsigned char* inputPixels = m_data->data() + m_pixelRowStride * m_numRowsCompleted;
for (int y = m_numRowsCompleted; y < m_size.height(); ++y) {
if (isDeadlineNearOrPassed(deadlineSeconds)) {
m_numRowsCompleted = y;
+ std::cout << "Idle task paused at row " << m_numRowsCompleted << "..." << std::flush;
Platform::current()->currentThread()->scheduler()->postIdleTask(BLINK_FROM_HERE, bind<double>(&CanvasAsyncBlobCreator::idleEncodeRowsPng, this));
return;
}
@@ -148,6 +155,8 @@ void CanvasAsyncBlobCreator::idleEncodeRowsPng(double deadlineSeconds)
PNGImageEncoder::finalizePng(m_pngEncoderState.get());
m_idleTaskStatus = IdleTaskCompleted;
+ std::cout << std::endl;
+ std::cout << "Idle task completed " << std::endl;
if (isDeadlineNearOrPassed(deadlineSeconds)) {
Platform::current()->mainThread()->getWebTaskRunner()->postTask(BLINK_FROM_HERE, bind(&CanvasAsyncBlobCreator::createBlobAndInvokeCallback, this));
« no previous file with comments | « third_party/WebKit/Source/core/html/canvas/CanvasAsyncBlobCreator.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698