accessible/base/nsAccCache.h
author B2G Bumper Bot <release+b2gbumper@mozilla.com>
Mon, 19 Oct 2015 01:05:33 -0700
changeset 303448 2cda93c9cb39755deb2d582d50f529f852fa9a78
parent 303345 e8c7dfe727cd970e2c3294934e2927b14143c205
child 310819 a7ba739d20a99e0808eed568175aa9404f2b4929
permissions -rw-r--r--
Bumping gaia.json for 5 gaia revision(s) a=gaia-bump ======== https://hg.mozilla.org/integration/gaia-central/rev/8be78fcf836b Author: Timothy Guan-tin Chien <timdream@gmail.com> Desc: Merge pull request #32536 from timdream/input-mgmt-chrome-event2 Bug 1207485 - Remove mozChromeEvent/mozContentEvent w/ new InputMethod API methods, r=albertopq ======== https://hg.mozilla.org/integration/gaia-central/rev/2d8ecd5869db Author: Timothy Guan-tin Chien <timdream@gmail.com> Desc: Bug 1207485 - Part II, Use addinputrequest/removeinputrequest events to handle addInput()/removeInput() ======== https://hg.mozilla.org/integration/gaia-central/rev/f372403a5fd3 Author: Timothy Guan-tin Chien <timdream@gmail.com> Desc: Bug 1207485 - Remove mozChromeEvent/mozContentEvent w/ new InputMethod API methods ======== https://hg.mozilla.org/integration/gaia-central/rev/508a6cea1619 Author: Staś Małolepszy <stas@mozilla.com> Desc: Merge pull request #32526 from stasm/1215454-l20n-3.3.3 Bug 1215454 - Update l20n.js to 3.3.3. r=gandalf ======== https://hg.mozilla.org/integration/gaia-central/rev/c02403f4901d Author: Staś Małolepszy <stas@mozilla.com> Desc: Bug 1215454 - Update l20n.js to 3.3.3. r=gandalf

/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* 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/. */

#ifndef _nsAccCache_H_
#define _nsAccCache_H_

#include "xpcAccessibleDocument.h"

////////////////////////////////////////////////////////////////////////////////
// Accessible cache utils
////////////////////////////////////////////////////////////////////////////////

/**
 * Shutdown and removes the accessible from cache.
 */
template <class T>
static PLDHashOperator
ClearCacheEntry(const void* aKey, RefPtr<T>& aAccessible, void* aUserArg)
{
  NS_ASSERTION(aAccessible, "Calling ClearCacheEntry with a nullptr pointer!");
  if (aAccessible && !aAccessible->IsDefunct())
    aAccessible->Shutdown();

  return PL_DHASH_REMOVE;
}

template <class T>
static PLDHashOperator
UnbindCacheEntryFromDocument(const void* aKey, RefPtr<T>& aAccessible,
                             void* aUserArg)
{
  MOZ_ASSERT(aAccessible && !aAccessible->IsDefunct());
  aAccessible->Document()->UnbindFromDocument(aAccessible);

  return PL_DHASH_REMOVE;
}

/**
 * Clear the cache and shutdown the accessibles.
 */

template <class T>
static void
ClearCache(nsRefPtrHashtable<nsPtrHashKey<const void>, T>& aCache)
{
  aCache.Enumerate(ClearCacheEntry<T>, nullptr);
}

#endif