зеркало из https://github.com/mozilla/gecko-dev.git
a2b3d3f84d
FlipScreenPixels was heap-allocating and leaking a ScopedMap object, which kept the surface alive. Instead, we want to keep the surface alive just long enough to copy its data into a Java Bitmap object. This copy needs to be done on the C++ side so that we're sure that it happens while the surface data exists. After that, the Java code can hold on to the resulting Bitmap object as long as it wants, since the Bitmap then owns its own data. The ScreenshotBuilder GeckoView API allows users to specify the bitmap object that will be used. So rather than creating a new Bitmap object in the C++ code, we pass the target bitmap into the C++ code that performs the copy. As a drive-by fix, this patch eliminates another copy at the start of FlipScreenPixels by replacing a call to `gfx::CreateDataSourceSurfaceFromData` (which copies) with a call to `gfx::Factory::CreateWrappingDataSourceSurface` (which doesn't copy). It would be nice if we could eliminate another copy here, by performing the flip during the copy into the Bitmap object. But I don't think there's a way to do that. Also, for optimal performance, we probably want to get an AHardwareBuffer object from the compositor and wrap that into a Bitmap. Furthermore, the patch adds a check that makes sure the draw target was created successfully before accessing it (throwing an exception if not). Differential Revision: https://phabricator.services.mozilla.com/D85490 |
||
---|---|---|
.. | ||
android | ||
locales | ||
.eslintrc.js |