This doesn't address the more general problem, but reduces the race
window significantly.
BUG=440282
R=reed@google.com
Review URL: https://codereview.chromium.org/
787043006
SkAutoTUnref<SkShader>* result = reinterpret_cast<SkAutoTUnref<SkShader>*>(contextShader);
result->reset(SkRef(rec.fShader.get()));
- return true;
+
+ SkBitmap tile;
+ rec.fShader.get()->asABitmap(&tile, NULL, NULL);
+ // FIXME: this doesn't protect the pixels from being discarded as soon as we unlock.
+ // Should be handled via a pixel ref generator instead
+ // (https://code.google.com/p/skia/issues/detail?id=3220).
+ SkAutoLockPixels alp(tile, true);
+ return tile.getPixels() != NULL;
}
};