Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /* vim: set ts=8 sts=4 et sw=4 tw=80: */
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 : /* Implementation of xptiWorkingSet. */
8 :
9 : #include "mozilla/XPTInterfaceInfoManager.h"
10 :
11 : #include "xptiprivate.h"
12 : #include "nsString.h"
13 :
14 : using namespace mozilla;
15 :
16 : static const size_t XPTI_ARENA8_BLOCK_SIZE = 16 * 1024;
17 : static const size_t XPTI_ARENA1_BLOCK_SIZE = 8 * 1024;
18 :
19 : static const uint32_t XPTI_HASHTABLE_LENGTH = 1024;
20 :
21 3 : XPTInterfaceInfoManager::xptiWorkingSet::xptiWorkingSet()
22 : : mTableReentrantMonitor("xptiWorkingSet::mTableReentrantMonitor")
23 : , mIIDTable(XPTI_HASHTABLE_LENGTH)
24 3 : , mNameTable(XPTI_HASHTABLE_LENGTH)
25 : {
26 3 : MOZ_COUNT_CTOR(xptiWorkingSet);
27 :
28 3 : gXPTIStructArena = XPT_NewArena(XPTI_ARENA8_BLOCK_SIZE,
29 : XPTI_ARENA1_BLOCK_SIZE);
30 3 : }
31 :
32 : void
33 0 : XPTInterfaceInfoManager::xptiWorkingSet::InvalidateInterfaceInfos()
34 : {
35 0 : ReentrantMonitorAutoEnter monitor(mTableReentrantMonitor);
36 0 : for (auto iter = mNameTable.Iter(); !iter.Done(); iter.Next()) {
37 0 : xptiInterfaceEntry* entry = iter.UserData();
38 0 : entry->LockedInvalidateInterfaceInfo();
39 : }
40 0 : }
41 :
42 0 : XPTInterfaceInfoManager::xptiWorkingSet::~xptiWorkingSet()
43 : {
44 0 : MOZ_COUNT_DTOR(xptiWorkingSet);
45 :
46 : // Only destroy the arena if we're doing leak stats. Why waste shutdown
47 : // time touching pages if we don't have to?
48 : #ifdef NS_FREE_PERMANENT_DATA
49 0 : XPT_DestroyArena(gXPTIStructArena);
50 : #endif
51 0 : }
52 :
53 9 : XPTArena* gXPTIStructArena;
|