提交 ac479c4f 编写于 作者: J Jason Simmons 提交者: GitHub

Move destruction of PictureLayer's SkPicture to the IO thread (#3219)

The picture may hold references to images backed by GPU textures that must
be deleted on the IO thread.
上级 e1ac3ca6
......@@ -4,6 +4,7 @@
#include "flutter/flow/layers/picture_layer.h"
#include "flutter/common/threads.h"
#include "flutter/flow/raster_cache.h"
#include "lib/ftl/logging.h"
......@@ -11,7 +12,12 @@ namespace flow {
PictureLayer::PictureLayer() {}
PictureLayer::~PictureLayer() {}
PictureLayer::~PictureLayer() {
// The picture may contain references to textures that are associated
// with the IO thread's context.
SkPicture* picture = picture_.release();
blink::Threads::IO()->PostTask([picture]() { picture->unref(); });
}
void PictureLayer::Preroll(PrerollContext* context, const SkMatrix& matrix) {
if (auto cache = context->raster_cache) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册