Coverage Report

Created: 2018-09-25 14:53

/src/mozilla-central/dom/canvas/CacheMap.cpp
Line
Count
Source (jump to first uncovered line)
1
/* -*- Mode: C++; tab-width: 13; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2
/* vim: set ts=13 sts=4 et sw=4 tw=90: */
3
/* This Source Code Form is subject to the terms of the Mozilla Public
4
 * License, v. 2.0. If a copy of the MPL was not distributed with this
5
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6
7
#include "CacheMap.h"
8
9
namespace mozilla {
10
11
void
12
CacheMapInvalidator::InvalidateCaches() const
13
0
{
14
0
    while (mCacheEntries.size()) {
15
0
        const auto pEntry = *(mCacheEntries.begin());
16
0
        pEntry->Invalidate();
17
0
        MOZ_ASSERT(mCacheEntries.find(pEntry) == mCacheEntries.end());
18
0
    }
19
0
}
20
21
namespace detail {
22
23
CacheMapUntypedEntry::CacheMapUntypedEntry(std::vector<const CacheMapInvalidator*>&& invalidators)
24
    : mInvalidators(std::move(invalidators))
25
0
{
26
0
    for (const auto& cur : mInvalidators) {
27
0
        // Don't assert that we insert, since there may be dupes in `invalidators`.
28
0
        // (and it's not worth removing the dupes)
29
0
        (void)cur->mCacheEntries.insert(this);
30
0
    }
31
0
}
32
33
CacheMapUntypedEntry::~CacheMapUntypedEntry()
34
0
{
35
0
    for (const auto& cur : mInvalidators) {
36
0
        // There might be dupes, so erase might return >1.
37
0
        (void)cur->mCacheEntries.erase(this);
38
0
    }
39
0
}
40
41
} // namespace detail
42
43
} // namespace mozilla