The call to SkImage::readPixels in content::CanvasCaptureHandler::CreateNewFrame may cause a GPU readback if the SkImage is GPU accelerated. There is an opportunity to avoid blocking the main thread of the render process by using async readbacks.
To achieve this, we need to:
1) determine that the Image is texture-backed,
2) If so, flush the GrContext that owns the image (because there is a GPU deferral/batching mechanism inside skia). Do this by calling SkImage::getTextureHandle with the flushPendingGrContextIO arg set to true. This will also return the texture ID require for the next step.
3) Do something like this: https://cs.chromium.org/chromium/src/third_party/WebKit/Source/modules/webgl/WebGLGetBufferSubDataAsync.cpp?sq=package:chromium&l=90
Comment 1 by emir...@chromium.org
, May 30 2017