Skip to content

Commit 03e7828

Browse files
committed
Bug 910989. Remove nsTHashtable::Init, fallible allocation, and MT hashtables. r=ehsan,bsmedberg
--HG-- extra : rebase_source : 0787130b1814c74bfb38dc178de94022f0b2e64e
1 parent 26ceee4 commit 03e7828

File tree

260 files changed

+628
-1445
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

260 files changed

+628
-1445
lines changed

accessible/src/base/DocManager.cpp

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,11 @@ using namespace mozilla::dom;
3838
// DocManager
3939
////////////////////////////////////////////////////////////////////////////////
4040

41+
DocManager::DocManager()
42+
: mDocAccessibleCache(4)
43+
{
44+
}
45+
4146
////////////////////////////////////////////////////////////////////////////////
4247
// DocManager public
4348

@@ -88,8 +93,6 @@ DocManager::IsProcessingRefreshDriverNotification() const
8893
bool
8994
DocManager::Init()
9095
{
91-
mDocAccessibleCache.Init(4);
92-
9396
nsCOMPtr<nsIWebProgress> progress =
9497
do_GetService(NS_DOCUMENTLOADER_SERVICE_CONTRACTID);
9598

accessible/src/base/DocManager.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ class DocManager : public nsIWebProgressListener,
7373
#endif
7474

7575
protected:
76-
DocManager() { }
76+
DocManager();
7777

7878
/**
7979
* Initialize the manager.

accessible/src/base/NotificationController.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ NotificationController::NotificationController(DocAccessible* aDocument,
2929
EventQueue(aDocument), mObservingState(eNotObservingRefresh),
3030
mPresShell(aPresShell)
3131
{
32-
mTextHash.Init();
33-
3432
// Schedule initial accessible tree construction.
3533
ScheduleProcessing();
3634
}

accessible/src/generic/DocAccessible.cpp

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,9 @@ DocAccessible::
7474
nsIPresShell* aPresShell) :
7575
HyperTextAccessibleWrap(aRootContent, this),
7676
mDocumentNode(aDocument), mScrollPositionChangedTicks(0),
77+
// XXX aaronl should we use an algorithm for the initial cache size?
78+
mAccessibleCache(kDefaultCacheSize),
79+
mNodeToAccessibleMap(kDefaultCacheSize),
7780
mLoadState(eTreeConstructionPending), mDocFlags(0), mLoadEventType(0),
7881
mVirtualCursor(nullptr),
7982
mPresShell(aPresShell)
@@ -84,11 +87,6 @@ DocAccessible::
8487
MOZ_ASSERT(mPresShell, "should have been given a pres shell");
8588
mPresShell->SetDocAccessible(this);
8689

87-
mDependentIDsHash.Init();
88-
// XXX aaronl should we use an algorithm for the initial cache size?
89-
mAccessibleCache.Init(kDefaultCacheSize);
90-
mNodeToAccessibleMap.Init(kDefaultCacheSize);
91-
9290
// If this is a XUL Document, it should not implement nsHyperText
9391
if (mDocumentNode && mDocumentNode->IsXUL())
9492
mGenericTypes &= ~eHyperText;

accessible/src/windows/msaa/DocAccessibleWrap.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ DocAccessibleWrap::Shutdown()
248248
if (nsWinUtils::IsWindowEmulationStarted()) {
249249
// Destroy window created for root document.
250250
if (mDocFlags & eTabDocument) {
251-
nsWinUtils::sHWNDCache.Remove(mHWND);
251+
nsWinUtils::sHWNDCache->Remove(mHWND);
252252
::DestroyWindow(static_cast<HWND>(mHWND));
253253
}
254254

@@ -308,7 +308,7 @@ DocAccessibleWrap::DoInitialUpdate()
308308
mHWND = nsWinUtils::CreateNativeWindow(kClassNameTabContent, parentWnd,
309309
x, y, width, height, isActive);
310310

311-
nsWinUtils::sHWNDCache.Put(mHWND, this);
311+
nsWinUtils::sHWNDCache->Put(mHWND, this);
312312

313313
} else {
314314
DocAccessible* parentDocument = ParentDocument();

accessible/src/windows/msaa/nsWinUtils.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ const PRUnichar* kPropNameTabContent = L"AccessibleTabWindow";
3030
static LRESULT CALLBACK WindowProc(HWND hWnd, UINT msg,
3131
WPARAM wParam, LPARAM lParam);
3232

33-
nsRefPtrHashtable<nsPtrHashKey<void>, DocAccessible> nsWinUtils::sHWNDCache;
33+
nsRefPtrHashtable<nsPtrHashKey<void>, DocAccessible>* nsWinUtils::sHWNDCache = nullptr;
3434

3535
already_AddRefed<nsIDOMCSSStyleDeclaration>
3636
nsWinUtils::GetComputedStyleDeclaration(nsIContent* aContent)
@@ -60,7 +60,7 @@ nsWinUtils::MaybeStartWindowEmulation()
6060
Compatibility::IsDolphin() ||
6161
Preferences::GetBool("browser.tabs.remote")) {
6262
RegisterNativeWindow(kClassNameTabContent);
63-
sHWNDCache.Init(4);
63+
sHWNDCache = new nsRefPtrHashtable<nsPtrHashKey<void>, DocAccessible>(4);
6464
return true;
6565
}
6666

@@ -79,7 +79,7 @@ nsWinUtils::ShutdownWindowEmulation()
7979
bool
8080
nsWinUtils::IsWindowEmulationStarted()
8181
{
82-
return sHWNDCache.IsInitialized();
82+
return sHWNDCache != nullptr;
8383
}
8484

8585
void
@@ -145,7 +145,7 @@ WindowProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
145145
{
146146
if (lParam == OBJID_CLIENT) {
147147
DocAccessible* document =
148-
nsWinUtils::sHWNDCache.GetWeak(static_cast<void*>(hWnd));
148+
nsWinUtils::sHWNDCache->GetWeak(static_cast<void*>(hWnd));
149149
if (document) {
150150
IAccessible* msaaAccessible = nullptr;
151151
document->GetNativeInterface((void**)&msaaAccessible); // does an addref

accessible/src/windows/msaa/nsWinUtils.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ class nsWinUtils
7878
* Cache for HWNDs of windows created for document accessibles in windows
7979
* emulation mode.
8080
*/
81-
static nsRefPtrHashtable<nsPtrHashKey<void>, DocAccessible> sHWNDCache;
81+
static nsRefPtrHashtable<nsPtrHashKey<void>, DocAccessible>* sHWNDCache;
8282
};
8383

8484
} // namespace a11y

accessible/src/xul/XULTreeAccessible.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ using namespace mozilla::a11y;
4040
XULTreeAccessible::
4141
XULTreeAccessible(nsIContent* aContent, DocAccessible* aDoc,
4242
nsTreeBodyFrame* aTreeFrame) :
43-
AccessibleWrap(aContent, aDoc)
43+
AccessibleWrap(aContent, aDoc),
44+
mAccessibleCache(kDefaultTreeCacheSize)
4445
{
4546
mType = eXULTreeType;
4647
mGenericTypes |= eSelect;
@@ -58,8 +59,6 @@ XULTreeAccessible::
5859
if (autoCompletePopupElm)
5960
mGenericTypes |= eAutoCompletePopup;
6061
}
61-
62-
mAccessibleCache.Init(kDefaultTreeCacheSize);
6362
}
6463

6564
////////////////////////////////////////////////////////////////////////////////

accessible/src/xul/XULTreeGridAccessible.cpp

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -267,11 +267,10 @@ XULTreeGridRowAccessible::
267267
XULTreeGridRowAccessible(nsIContent* aContent, DocAccessible* aDoc,
268268
Accessible* aTreeAcc, nsITreeBoxObject* aTree,
269269
nsITreeView* aTreeView, int32_t aRow) :
270-
XULTreeItemAccessibleBase(aContent, aDoc, aTreeAcc, aTree, aTreeView, aRow)
270+
XULTreeItemAccessibleBase(aContent, aDoc, aTreeAcc, aTree, aTreeView, aRow),
271+
mAccessibleCache(kDefaultTreeCacheSize)
271272
{
272273
mGenericTypes |= eTableRow;
273-
274-
mAccessibleCache.Init(kDefaultTreeCacheSize);
275274
}
276275

277276
////////////////////////////////////////////////////////////////////////////////

chrome/src/nsChromeRegistry.cpp

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,8 +140,6 @@ nsChromeRegistry::GetService()
140140
nsresult
141141
nsChromeRegistry::Init()
142142
{
143-
mOverrideTable.Init();
144-
145143
// This initialization process is fairly complicated and may cause reentrant
146144
// getservice calls to resolve chrome URIs (especially locale files). We
147145
// don't want that, so we inform the protocol handler about our existence

0 commit comments

Comments
 (0)