author Andrew Osmond <>
Mon, 11 Sep 2017 08:39:30 -0400
changeset 424048 0b5841c7c3992c2c0a43cb77b51b3fd04b63b7d6
parent 387659 fe7e4ea3cda6c5a0dc746f55e209a0b60aeffc0d
child 466280 befe8c748a4b4dad323ac9333a50c7fa0e870cfa
permissions -rw-r--r--
Bug 1397223 - Gracefully handle failures in SurfaceCacheImpl::StartTracking. r=tnikkel, a=lizzard When the surface cache starts tracking an unlocked surface, it must insert it into the expiration tracker, so that it can be freed later if it is remains unused. ExpirationTrackerImpl::AddObjectLocked can fail due to out-of-memory conditions or during shutdown, which we previously ignored, and could leave us in a state where we think the surface is in the tracker but is not. When we later try to mark the surface as used in the tracker, it will hit a release assert because it doesn't exist. Now we handle the insertion failure by discarding the surface. Marking the surface as used can itself encounter a similar issue, and we handle it the same way.

# Style Guide

The majority of our style recommendations are automatically enforced via our
automated linters. This document has guidelines that are less easy to lint for.

## Shell scripts

Shell scripts are OK for small tasks or wrappers, but prefer to use Python for
anything with a hint of complexity or in general.

Shell scripts should be written against bash, starting with this shebang:
#!/usr/bin/env bash

Note that the version of bash available on OS X by default is quite old, so be
careful when using new features.

Scripts should enable a few options at the top for robustness:
set -o errexit
set -o nounset
set -o pipefail

Quote all variables, using the full form: `"${SOME_VARIABLE}"`.

Use `"$(some-command)"` instead of backticks for command substitution. Note
that these should be quoted as well.