mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
bug 1241453 - allow caching xpc documents for remote documents r=davidb
This commit is contained in:
parent
66dfc5d929
commit
973d0ef356
@ -40,6 +40,8 @@ using namespace mozilla::a11y;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
StaticAutoPtr<nsTArray<DocAccessibleParent*>> DocManager::sRemoteDocuments;
|
||||
nsRefPtrHashtable<nsPtrHashKey<const DocAccessibleParent>, xpcAccessibleDocument>*
|
||||
DocManager::sRemoteXPCDocumentCache = nullptr;
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// DocManager
|
||||
@ -101,6 +103,16 @@ DocManager::NotifyOfDocumentShutdown(DocAccessible* aDocument,
|
||||
RemoveListeners(aDOMDocument);
|
||||
}
|
||||
|
||||
void
|
||||
DocManager::NotifyOfRemoteDocShutdown(DocAccessibleParent* aDoc)
|
||||
{
|
||||
xpcAccessibleDocument* doc = GetCachedXPCDocument(aDoc);
|
||||
if (doc) {
|
||||
doc->Shutdown();
|
||||
sRemoteXPCDocumentCache->Remove(aDoc);
|
||||
}
|
||||
}
|
||||
|
||||
xpcAccessibleDocument*
|
||||
DocManager::GetXPCDocument(DocAccessible* aDocument)
|
||||
{
|
||||
@ -115,6 +127,26 @@ DocManager::GetXPCDocument(DocAccessible* aDocument)
|
||||
return xpcDoc;
|
||||
}
|
||||
|
||||
xpcAccessibleDocument*
|
||||
DocManager::GetXPCDocument(DocAccessibleParent* aDoc)
|
||||
{
|
||||
xpcAccessibleDocument* doc = GetCachedXPCDocument(aDoc);
|
||||
if (doc) {
|
||||
return doc;
|
||||
}
|
||||
|
||||
if (!sRemoteXPCDocumentCache) {
|
||||
sRemoteXPCDocumentCache =
|
||||
new nsRefPtrHashtable<nsPtrHashKey<const DocAccessibleParent>, xpcAccessibleDocument>;
|
||||
}
|
||||
|
||||
doc =
|
||||
new xpcAccessibleDocument(aDoc, Interfaces::DOCUMENT | Interfaces::HYPERTEXT);
|
||||
sRemoteXPCDocumentCache->Put(aDoc, doc);
|
||||
|
||||
return doc;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
bool
|
||||
DocManager::IsProcessingRefreshDriverNotification() const
|
||||
|
@ -90,6 +90,21 @@ public:
|
||||
static const nsTArray<DocAccessibleParent*>* TopLevelRemoteDocs()
|
||||
{ return sRemoteDocuments; }
|
||||
|
||||
/**
|
||||
* Remove the xpc document for a remote document if there is one.
|
||||
*/
|
||||
static void NotifyOfRemoteDocShutdown(DocAccessibleParent* adoc);
|
||||
|
||||
/**
|
||||
* Get a XPC document for a remote document.
|
||||
*/
|
||||
static xpcAccessibleDocument* GetXPCDocument(DocAccessibleParent* aDoc);
|
||||
static xpcAccessibleDocument* GetCachedXPCDocument(const DocAccessibleParent* aDoc)
|
||||
{
|
||||
return sRemoteXPCDocumentCache ? sRemoteXPCDocumentCache->GetWeak(aDoc)
|
||||
: nullptr;
|
||||
}
|
||||
|
||||
#ifdef DEBUG
|
||||
bool IsProcessingRefreshDriverNotification() const;
|
||||
#endif
|
||||
@ -147,6 +162,8 @@ private:
|
||||
typedef nsRefPtrHashtable<nsPtrHashKey<const DocAccessible>, xpcAccessibleDocument>
|
||||
XPCDocumentHashtable;
|
||||
XPCDocumentHashtable mXPCDocumentCache;
|
||||
static nsRefPtrHashtable<nsPtrHashKey<const DocAccessibleParent>, xpcAccessibleDocument>*
|
||||
sRemoteXPCDocumentCache;
|
||||
|
||||
/*
|
||||
* The list of remote top level documents.
|
||||
|
@ -267,6 +267,8 @@ DocAccessibleParent::Destroy()
|
||||
ProxyDestroyed(iter.Get()->mProxy);
|
||||
iter.Remove();
|
||||
}
|
||||
|
||||
DocManager::NotifyOfRemoteDocShutdown(this);
|
||||
ProxyDestroyed(this);
|
||||
if (mParentDoc)
|
||||
mParentDoc->RemoveChildDoc(this);
|
||||
|
Loading…
Reference in New Issue
Block a user