author Andrew Osmond <>
Tue, 16 Oct 2018 08:45:26 -0400
changeset 447457 ccfa531dea0301244c99db4ff26d5610382487e2
parent 428278 3aedafc1a36c96f44498649d6da4ee6dfa36f10b
permissions -rw-r--r--
Bug 1504699 - Part 7. Update animated image recycling queue to work well with WebRender. r=tnikkel WebRender takes longer than OMTP to release its hold on the current frame. This is because it is in a separate process and holds onto the surface in between rendering frames, rather than getting a reference for each repaint. This patch makes us less aggressive about taking the most recent surface placed in the recycling queue out to avoid blocking on waiting for the surface to be released. Differential Revision:

/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*-
 * vim: sw=2 ts=8 et :
/* 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 */

#ifndef mozilla_${HEADER}_h
#define mozilla_${HEADER}_h

#  error "STL code can only be used with -fno-exceptions"

#if defined(__clang__)
// Silence "warning: #include_next is a language extension [-Wgnu-include-next]"
#pragma clang system_header

// Include mozalloc after the STL header and all other headers it includes
// have been preprocessed.

#ifdef _DEBUG
// From
// and
// there appear to be two types of STL container checking.  The
// former is enabled by -D_DEBUG (which is implied by -MDd or -MTd), and
// looks to be full generation/mutation checked iterators as done by
// _GLIBCXX_DEBUG.  The latter appears to just be bounds checking, and
// is enabled by the following macros.  It appears that the _DEBUG
// iterators subsume _SECURE_SCL, and the following settings are
// default anyway, so we'll just leave this commented out.
//#  define _SECURE_SCL 1
//#  define _SECURE_SCL_THROWS 0
// Note: _SECURE_SCL iterators are on by default in opt builds.  We
// could leave them on, but since gcc doesn't, we might as well
// preserve that behavior for perf reasons.  nsTArray is in the same
// camp as gcc.  Can revisit later.
// FIXME/bug 551254: because we're not wrapping all the STL headers we
// use, undefining this here can cause some headers to be built with
// iterator checking and others not.  Turning this off until we have a
// better plan.
//#  undef _SECURE_SCL

// C4275: When _HAS_EXCEPTIONS is set to 0, system STL header
//        will generate the warning which we can't modify.
// C4530: We know that code won't be able to catch exceptions,
//        but that's OK because we're not throwing them.
#pragma warning( push )
#pragma warning( disable : 4275 4530 )

#ifdef __clang__
#include_next <${HEADER}>
#include <${HEADER_PATH}>

#pragma warning( pop )

// See if we're in code that can use mozalloc.
#  if !defined(NS_NO_XPCOM) && !defined(MOZ_NO_MOZALLOC)
#    include "mozilla/mozalloc.h"
#  else
#    error "STL code can only be used with infallible ::operator new()"
#  endif

#endif  // if mozilla_${HEADER}_h