gecko-dev/image/moz.build
Andrew Osmond 6f594078d6 Bug 1465619 - Part 6. Add support for recycling to imgFrame. r=tnikkel
Beyond the necessary reinitialization methods, we need to protect
ourselves from recycling a frame that some other entity in the browser
is still using. Generally speaking the animated surface will only be
used in imgFrame::Draw since we don't layerize animated images, which
will be safe. However with OMTP or blob recordings, we could retain a
reference to the surface outside the current stack context. Additional
if something calls RasterImage::GetImageContainer(AtSize) or
RasterImage::GetFrame(AtSize), it may also have a reference to the
surface for an indetermine period of time.

As such, if an imgFrame is a candidate for recycling, it will wrap
imgFrame::mLockedSurface in a RecyclingSourceSurface. Its job is to
track how many consumers there are still of the surface, so that after
we advance the animation, the decoder will know if there are still
outstanding consumers.

If the surface is still in use, it will block for a finite period of
time (the refresh interval) before giving up on reclaiming the surface,
and will allocate a new surface. The old surface can then remain in
circulation for as long as necessary without further blocking the
animation progression, since we stop recycling that surface/imgFrame.

Differential Revision: https://phabricator.services.mozilla.com/D7511
2018-10-22 13:40:35 -04:00

128 lines
3.1 KiB
Python

# -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
# vim: set filetype=python:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
DIRS += ['build', 'decoders', 'encoders']
if CONFIG['ENABLE_TESTS']:
DIRS += ['test/gtest']
if CONFIG['FUZZING_INTERFACES']:
DIRS += ['test/fuzzing']
with Files('**'):
BUG_COMPONENT = ('Core', 'ImageLib')
BROWSER_CHROME_MANIFESTS += ['test/browser/browser.ini']
MOCHITEST_MANIFESTS += ['test/mochitest/mochitest.ini']
MOCHITEST_CHROME_MANIFESTS += ['test/mochitest/chrome.ini']
XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini']
XPIDL_SOURCES += [
'imgICache.idl',
'imgIContainer.idl',
'imgIContainerDebug.idl',
'imgIEncoder.idl',
'imgILoader.idl',
'imgINotificationObserver.idl',
'imgIRequest.idl',
'imgIScriptedNotificationObserver.idl',
'imgITools.idl',
'nsIIconURI.idl',
]
XPIDL_MODULE = 'imglib2'
EXPORTS += [
'FrameTimeout.h',
'ImageCacheKey.h',
'ImageLogging.h',
'ImageMetadata.h',
'ImageOps.h',
'ImageRegion.h',
'ImgDrawResult.h',
'imgLoader.h',
'imgRequest.h',
'imgRequestProxy.h',
'IProgressObserver.h',
'Orientation.h',
'SurfaceCacheUtils.h',
]
EXPORTS.mozilla.image += [
'ImageMemoryReporter.h',
'RecyclingSourceSurface.h',
]
UNIFIED_SOURCES += [
'AnimationFrameBuffer.cpp',
'AnimationSurfaceProvider.cpp',
'ClippedImage.cpp',
'DecodedSurfaceProvider.cpp',
'DecodePool.cpp',
'Decoder.cpp',
'DecoderFactory.cpp',
'DynamicImage.cpp',
'FrameAnimator.cpp',
'FrozenImage.cpp',
'IDecodingTask.cpp',
'Image.cpp',
'ImageCacheKey.cpp',
'ImageFactory.cpp',
'ImageMemoryReporter.cpp',
'ImageOps.cpp',
'ImageWrapper.cpp',
'imgFrame.cpp',
'imgLoader.cpp',
'imgRequest.cpp',
'imgRequestProxy.cpp',
'imgTools.cpp',
'MultipartImage.cpp',
'OrientedImage.cpp',
'ProgressTracker.cpp',
'RasterImage.cpp',
'ScriptedNotificationObserver.cpp',
'ShutdownTracker.cpp',
'SourceBuffer.cpp',
'SurfaceCache.cpp',
'SurfaceCacheUtils.cpp',
'SurfacePipe.cpp',
'SVGDocumentWrapper.cpp',
'VectorImage.cpp',
]
if CONFIG['MOZ_ENABLE_SKIA']:
UNIFIED_SOURCES += [ 'Downscaler.cpp']
include('/ipc/chromium/chromium-config.mozbuild')
FINAL_LIBRARY = 'xul'
LOCAL_INCLUDES += [
# Because SVGDocumentWrapper.cpp includes "mozilla/dom/SVGSVGElement.h"
'/dom/base',
'/dom/svg',
# We need to instantiate the decoders
'/image/decoders',
# Because VectorImage.cpp includes nsSVGUtils.h and SVGObserverUtils.h
'/layout/svg',
# For URI-related functionality
'/netwerk/base',
# DecodePool uses thread-related facilities.
'/xpcom/threads',
]
# Because imgFrame.cpp includes "cairo.h"
CXXFLAGS += CONFIG['MOZ_CAIRO_CFLAGS']
LOCAL_INCLUDES += CONFIG['SKIA_INCLUDES']
if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
CXXFLAGS += ['-Wno-error=shadow']
# Add libFuzzer configuration directives
include('/tools/fuzzing/libfuzzer-config.mozbuild')