Bug 1212027 - part 7 - modify IPDL codegen to store sub-protocols in a hashtable rather than an array; r=jld,nical,cpearce,billm

This commit is contained in:
Nathan Froyd 2015-10-07 14:30:33 -04:00
parent 932187b05a
commit fe57e31ffe
20 changed files with 137 additions and 110 deletions

View File

@ -936,13 +936,13 @@ nsFrameLoader::SwapWithOtherRemoteLoader(nsFrameLoader* aOther,
mRemoteBrowser->SetBrowserDOMWindow(otherBrowserDOMWindow);
// Native plugin windows used by this remote content need to be reparented.
const nsTArray<mozilla::plugins::PPluginWidgetParent*>& plugins =
aOther->mRemoteBrowser->ManagedPPluginWidgetParent();
nsPIDOMWindow* newWin = ourDoc->GetWindow();
if (newWin) {
nsRefPtr<nsIWidget> newParent = ((nsGlobalWindow*)newWin)->GetMainWidget();
for (uint32_t idx = 0; idx < plugins.Length(); ++idx) {
static_cast<mozilla::plugins::PluginWidgetParent*>(plugins[idx])->SetParent(newParent);
const ManagedContainer<mozilla::plugins::PPluginWidgetParent>& plugins =
aOther->mRemoteBrowser->ManagedPPluginWidgetParent();
for (auto iter = plugins.ConstIter(); !iter.Done(); iter.Next()) {
static_cast<mozilla::plugins::PluginWidgetParent*>(iter.Get()->GetKey())->SetParent(newParent);
}
}

View File

@ -19888,7 +19888,7 @@ FactoryOp::CheckAtLeastOneAppHasPermission(ContentParent* aContentParent,
MOZ_ASSERT(!aPermissionString.IsEmpty());
#ifdef MOZ_CHILD_PERMISSIONS
const nsTArray<PBrowserParent*>& browsers =
const ManagedContainer<PBrowserParent>& browsers =
aContentParent->ManagedPBrowserParent();
if (!browsers.IsEmpty()) {
@ -19912,11 +19912,9 @@ FactoryOp::CheckAtLeastOneAppHasPermission(ContentParent* aContentParent,
const nsPromiseFlatCString permissionString =
PromiseFlatCString(aPermissionString);
for (uint32_t index = 0, count = browsers.Length();
index < count;
index++) {
for (auto iter = browsers.ConstIter(); !iter.Done(); iter.Next()) {
uint32_t appId =
TabParent::GetFrom(browsers[index])->OwnOrContainingAppId();
TabParent::GetFrom(iter.Get()->GetKey())->OwnOrContainingAppId();
MOZ_ASSERT(appId != nsIScriptSecurityManager::UNKNOWN_APP_ID &&
appId != nsIScriptSecurityManager::NO_APP_ID);

View File

@ -166,7 +166,7 @@ ContentBridgeParent::DeallocPBrowserParent(PBrowserParent* aParent)
void
ContentBridgeParent::NotifyTabDestroyed()
{
int32_t numLiveTabs = ManagedPBrowserParent().Length();
int32_t numLiveTabs = ManagedPBrowserParent().Count();
if (numLiveTabs == 1) {
MessageLoop::current()->PostTask(
FROM_HERE,

View File

@ -1279,7 +1279,7 @@ static void FirstIdle(void)
mozilla::jsipc::PJavaScriptChild *
ContentChild::AllocPJavaScriptChild()
{
MOZ_ASSERT(!ManagedPJavaScriptChild().Length());
MOZ_ASSERT(ManagedPJavaScriptChild().IsEmpty());
return nsIContentChild::AllocPJavaScriptChild();
}

View File

@ -1797,11 +1797,11 @@ ContentParent::ShutDownProcess(ShutDownMethod aMethod)
}
}
const InfallibleTArray<POfflineCacheUpdateParent*>& ocuParents =
const ManagedContainer<POfflineCacheUpdateParent>& ocuParents =
ManagedPOfflineCacheUpdateParent();
for (uint32_t i = 0; i < ocuParents.Length(); ++i) {
for (auto iter = ocuParents.ConstIter(); !iter.Done(); iter.Next()) {
nsRefPtr<mozilla::docshell::OfflineCacheUpdateParent> ocuParent =
static_cast<mozilla::docshell::OfflineCacheUpdateParent*>(ocuParents[i]);
static_cast<mozilla::docshell::OfflineCacheUpdateParent*>(iter.Get()->GetKey());
ocuParent->StopSendingMessagesToChild();
}
@ -3418,7 +3418,7 @@ ContentParent::RecvGetXPCOMProcessAttributes(bool* aIsOffline,
mozilla::jsipc::PJavaScriptParent *
ContentParent::AllocPJavaScriptParent()
{
MOZ_ASSERT(!ManagedPJavaScriptParent().Length());
MOZ_ASSERT(ManagedPJavaScriptParent().IsEmpty());
return nsIContentParent::AllocPJavaScriptParent();
}

View File

@ -290,10 +290,9 @@ ContentProcessManager::GetTabParentByProcessAndTabId(const ContentParentId& aChi
return nullptr;
}
const InfallibleTArray<PBrowserParent*>& browsers =
iter->second.mCp->ManagedPBrowserParent();
for (uint32_t i = 0; i < browsers.Length(); i++) {
nsRefPtr<TabParent> tab = TabParent::GetFrom(browsers[i]);
const ManagedContainer<PBrowserParent>& browsers = iter->second.mCp->ManagedPBrowserParent();
for (auto iter = browsers.ConstIter(); !iter.Done(); iter.Next()) {
nsRefPtr<TabParent> tab = TabParent::GetFrom(iter.Get()->GetKey());
if (tab->GetTabId() == aChildTabId) {
return tab.forget();
}

View File

@ -17,7 +17,7 @@ namespace dom {
PCrashReporterChild*
CrashReporterChild::GetCrashReporter()
{
const InfallibleTArray<PCrashReporterChild*>* reporters = nullptr;
const ManagedContainer<PCrashReporterChild>* reporters = nullptr;
switch (XRE_GetProcessType()) {
case GeckoProcessType_Content: {
ContentChild* child = ContentChild::GetSingleton();

View File

@ -1041,11 +1041,11 @@ ParticularProcessPriorityManager::Notify(nsITimer* aTimer)
bool
ParticularProcessPriorityManager::HasAppType(const char* aAppType)
{
const InfallibleTArray<PBrowserParent*>& browsers =
const ManagedContainer<PBrowserParent>& browsers =
mContentParent->ManagedPBrowserParent();
for (uint32_t i = 0; i < browsers.Length(); i++) {
for (auto iter = browsers.ConstIter(); !iter.Done(); iter.Next()) {
nsAutoString appType;
TabParent::GetFrom(browsers[i])->GetAppType(appType);
TabParent::GetFrom(iter.Get()->GetKey())->GetAppType(appType);
if (appType.EqualsASCII(aAppType)) {
return true;
}
@ -1057,10 +1057,10 @@ ParticularProcessPriorityManager::HasAppType(const char* aAppType)
bool
ParticularProcessPriorityManager::IsExpectingSystemMessage()
{
const InfallibleTArray<PBrowserParent*>& browsers =
const ManagedContainer<PBrowserParent>& browsers =
mContentParent->ManagedPBrowserParent();
for (uint32_t i = 0; i < browsers.Length(); i++) {
TabParent* tp = TabParent::GetFrom(browsers[i]);
for (auto iter = browsers.ConstIter(); !iter.Done(); iter.Next()) {
TabParent* tp = TabParent::GetFrom(iter.Get()->GetKey());
nsCOMPtr<nsIMozBrowserFrame> bf = do_QueryInterface(tp->GetOwnerElement());
if (!bf) {
continue;
@ -1089,10 +1089,10 @@ ParticularProcessPriorityManager::ComputePriority()
}
bool isVisible = false;
const InfallibleTArray<PBrowserParent*>& browsers =
const ManagedContainer<PBrowserParent>& browsers =
mContentParent->ManagedPBrowserParent();
for (uint32_t i = 0; i < browsers.Length(); i++) {
if (TabParent::GetFrom(browsers[i])->IsVisible()) {
for (auto iter = browsers.ConstIter(); !iter.Done(); iter.Next()) {
if (TabParent::GetFrom(iter.Get()->GetKey())->IsVisible()) {
isVisible = true;
break;
}

View File

@ -563,9 +563,11 @@ TabParent::DestroyInternal()
// Let all PluginWidgets know we are tearing down. Prevents
// these objects from sending async events after the child side
// is shut down.
const nsTArray<PPluginWidgetParent*>& kids = ManagedPPluginWidgetParent();
for (uint32_t idx = 0; idx < kids.Length(); ++idx) {
static_cast<mozilla::plugins::PluginWidgetParent*>(kids[idx])->ParentDestroy();
const ManagedContainer<PPluginWidgetParent>& kids =
ManagedPPluginWidgetParent();
for (auto iter = kids.ConstIter(); !iter.Done(); iter.Next()) {
static_cast<mozilla::plugins::PluginWidgetParent*>(
iter.Get()->GetKey())->ParentDestroy();
}
}
@ -1446,17 +1448,16 @@ TabParent::GetTopLevelDocAccessible() const
#ifdef ACCESSIBILITY
// XXX Consider managing non top level PDocAccessibles with their parent
// document accessible.
const nsTArray<PDocAccessibleParent*>& docs = ManagedPDocAccessibleParent();
size_t docCount = docs.Length();
for (size_t i = 0; i < docCount; i++) {
auto doc = static_cast<a11y::DocAccessibleParent*>(docs[i]);
const ManagedContainer<PDocAccessibleParent>& docs = ManagedPDocAccessibleParent();
for (auto iter = docs.ConstIter(); !iter.Done(); iter.Next()) {
auto doc = static_cast<a11y::DocAccessibleParent*>(iter.Get()->GetKey());
if (!doc->ParentDoc()) {
return doc;
}
}
MOZ_ASSERT(docCount == 0, "If there isn't a top level accessible doc "
"there shouldn't be an accessible doc at all!");
MOZ_ASSERT(docs.Count() == 0, "If there isn't a top level accessible doc "
"there shouldn't be an accessible doc at all!");
#endif
return nullptr;
}

View File

@ -181,28 +181,28 @@ void
GMPContentChild::CloseActive()
{
// Invalidate and remove any remaining API objects.
const nsTArray<PGMPAudioDecoderChild*>& audioDecoders =
const ManagedContainer<PGMPAudioDecoderChild>& audioDecoders =
ManagedPGMPAudioDecoderChild();
for (uint32_t i = audioDecoders.Length(); i > 0; i--) {
audioDecoders[i - 1]->SendShutdown();
for (auto iter = audioDecoders.ConstIter(); !iter.Done(); iter.Next()) {
iter.Get()->GetKey()->SendShutdown();
}
const nsTArray<PGMPDecryptorChild*>& decryptors =
const ManagedContainer<PGMPDecryptorChild>& decryptors =
ManagedPGMPDecryptorChild();
for (uint32_t i = decryptors.Length(); i > 0; i--) {
decryptors[i - 1]->SendShutdown();
for (auto iter = decryptors.ConstIter(); !iter.Done(); iter.Next()) {
iter.Get()->GetKey()->SendShutdown();
}
const nsTArray<PGMPVideoDecoderChild*>& videoDecoders =
const ManagedContainer<PGMPVideoDecoderChild>& videoDecoders =
ManagedPGMPVideoDecoderChild();
for (uint32_t i = videoDecoders.Length(); i > 0; i--) {
videoDecoders[i - 1]->SendShutdown();
for (auto iter = videoDecoders.ConstIter(); !iter.Done(); iter.Next()) {
iter.Get()->GetKey()->SendShutdown();
}
const nsTArray<PGMPVideoEncoderChild*>& videoEncoders =
const ManagedContainer<PGMPVideoEncoderChild>& videoEncoders =
ManagedPGMPVideoEncoderChild();
for (uint32_t i = videoEncoders.Length(); i > 0; i--) {
videoEncoders[i - 1]->SendShutdown();
for (auto iter = videoEncoders.ConstIter(); !iter.Done(); iter.Next()) {
iter.Get()->GetKey()->SendShutdown();
}
}

View File

@ -92,11 +92,11 @@ CompositorChild::Destroy()
mLayerManager = nullptr;
}
// start from the end of the array because Destroy() can cause the
// LayerTransactionChild to be removed from the array.
for (int i = ManagedPLayerTransactionChild().Length() - 1; i >= 0; --i) {
nsAutoTArray<PLayerTransactionChild*, 16> transactions;
ManagedPLayerTransactionChild(transactions);
for (int i = transactions.Length() - 1; i >= 0; --i) {
RefPtr<LayerTransactionChild> layers =
static_cast<LayerTransactionChild*>(ManagedPLayerTransactionChild()[i]);
static_cast<LayerTransactionChild*>(transactions[i]);
layers->Destroy();
}

View File

@ -612,7 +612,7 @@ CompositorParent::~CompositorParent()
void
CompositorParent::Destroy()
{
MOZ_ASSERT(ManagedPLayerTransactionParent().Length() == 0,
MOZ_ASSERT(ManagedPLayerTransactionParent().Count() == 0,
"CompositorParent destroyed before managed PLayerTransactionParent");
MOZ_ASSERT(mPaused); // Ensure RecvWillStop was called

View File

@ -33,11 +33,12 @@ LayerTransactionChild::Destroy()
// When it happens, IPCOpen() is still true.
// See bug 1004191.
mDestroyed = true;
MOZ_ASSERT(0 == ManagedPLayerChild().Length(),
MOZ_ASSERT(0 == ManagedPLayerChild().Count(),
"layers should have been cleaned up by now");
for (size_t i = 0; i < ManagedPTextureChild().Length(); ++i) {
TextureClient* texture = TextureClient::AsTextureClient(ManagedPTextureChild()[i]);
const ManagedContainer<PTextureChild>& textures = ManagedPTextureChild();
for (auto iter = textures.ConstIter(); !iter.Done(); iter.Next()) {
TextureClient* texture = TextureClient::AsTextureClient(iter.Get()->GetKey());
if (texture) {
texture->ForceRemove();
}

View File

@ -175,9 +175,10 @@ void
LayerTransactionParent::Destroy()
{
mDestroyed = true;
for (size_t i = 0; i < ManagedPLayerParent().Length(); ++i) {
const ManagedContainer<PLayerParent>& layers = ManagedPLayerParent();
for (auto iter = layers.ConstIter(); !iter.Done(); iter.Next()) {
ShadowLayerParent* slp =
static_cast<ShadowLayerParent*>(ManagedPLayerParent()[i]);
static_cast<ShadowLayerParent*>(iter.Get()->GetKey());
slp->Destroy();
}
}

View File

@ -28,6 +28,9 @@
#include <android/log.h>
#endif
template<typename T> class nsTHashtable;
template<typename T> class nsPtrHashKey;
// WARNING: this takes into account the private, special-message-type
// enum in ipc_channel.h. They need to be kept in sync.
namespace {
@ -328,14 +331,18 @@ DuplicateHandle(HANDLE aSourceHandle,
} // namespace ipc
template<typename Protocol>
using ManagedContainer = nsTHashtable<nsPtrHashKey<Protocol>>;
template<typename Protocol>
Protocol*
LoneManagedOrNull(const nsTArray<Protocol*>& aManagees)
LoneManagedOrNull(const ManagedContainer<Protocol>& aManagees)
{
if (aManagees.Length() == 0) {
if (aManagees.IsEmpty()) {
return nullptr;
}
return aManagees[0];
MOZ_ASSERT(aManagees.Count() == 1);
return aManagees.ConstIter().Get()->GetKey();
}
} // namespace mozilla

View File

@ -50,6 +50,7 @@ HeaderIncludes = (
'nsStringGlue.h',
'nsTArray.h',
'mozilla/ipc/ProtocolUtils.h',
'nsTHashtable.h',
)
CppIncludes = (

View File

@ -335,6 +335,10 @@ def _refptrTake(expr):
def _cxxArrayType(basetype, const=0, ref=0):
return Type('nsTArray', T=basetype, const=const, ref=ref, hasimplicitcopyctor=False)
def _cxxManagedContainerType(basetype, const=0, ref=0):
return Type('ManagedContainer', T=basetype,
const=const, ref=ref, hasimplicitcopyctor=False)
def _cxxFallibleArrayType(basetype, const=0, ref=0):
return Type('FallibleTArray', T=basetype, const=const, ref=ref)
@ -353,20 +357,18 @@ def _callCxxSwapArrayElements(arr1, arr2, sel='.'):
args=[ arr2 ])
def _callInsertManagedActor(managees, actor):
return ExprCall(ExprSelect(managees, '.', 'InsertElementSorted'),
return ExprCall(ExprSelect(managees, '.', 'PutEntry'),
args=[ actor ])
def _callRemoveManagedActor(managees, actor):
return ExprCall(ExprSelect(managees, '.', 'RemoveElementSorted'),
return ExprCall(ExprSelect(managees, '.', 'RemoveEntry'),
args=[ actor ])
def _callClearManagedActors(managees):
return ExprCall(ExprSelect(managees, '.', 'Clear'))
def _callHasManagedActor(managees, actor):
return ExprBinary(
ExprSelect(managees, '.', 'NoIndex'), '!=',
ExprCall(ExprSelect(managees, '.', 'BinaryIndexOf'), args=[ actor ]))
return ExprCall(ExprSelect(managees, '.', 'Contains'), args=[ actor ])
def _otherSide(side):
if side == 'child': return 'parent'
@ -1266,8 +1268,8 @@ class Protocol(ipdl.ast.Protocol):
def managedVarType(self, actortype, side, const=0, ref=0):
assert self.decl.type.isManagerOf(actortype)
return _cxxArrayType(self.managedCxxType(actortype, side),
const=const, ref=ref)
return _cxxManagedContainerType(Type(_actorName(actortype.name(), side)),
const=const, ref=ref)
def managerArrayExpr(self, thisvar, side):
"""The member var my manager keeps of actors of my type."""
@ -3054,17 +3056,41 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
self.cls.addstmts([ managermeth, Whitespace.NL ])
def actorFromIter(itervar):
return ExprCall(ExprSelect(ExprCall(ExprSelect(itervar, '.', 'Get')),
'->', 'GetKey'))
def forLoopOverHashtable(hashtable, itervar, const=False):
return StmtFor(
init=Param(Type.AUTO, itervar.name,
ExprCall(ExprSelect(hashtable, '.', 'ConstIter' if const else 'Iter'))),
cond=ExprNot(ExprCall(ExprSelect(itervar, '.', 'Done'))),
update=ExprCall(ExprSelect(itervar, '.', 'Next')))
## Managed[T](Array& inout) const
## const Array<T>& Managed() const
for managed in ptype.manages:
arrvar = ExprVar('aArr')
meth = MethodDefn(MethodDecl(
p.managedMethod(managed, self.side).name,
params=[ Decl(p.managedVarType(managed, self.side, ref=1),
params=[ Decl(_cxxArrayType(p.managedCxxType(managed, self.side), ref=1),
arrvar.name) ],
const=1))
meth.addstmt(StmtExpr(ExprAssn(
arrvar, p.managedVar(managed, self.side))))
ivar = ExprVar('i')
elementsvar = ExprVar('elements')
itervar = ExprVar('iter')
meth.addstmt(StmtDecl(Decl(Type.UINT32, ivar.name),
init=ExprLiteral.ZERO))
meth.addstmt(StmtDecl(Decl(Type(_actorName(managed.name(), self.side), ptrptr=1), elementsvar.name),
init=ExprCall(ExprSelect(arrvar, '.', 'AppendElements'),
args=[ ExprCall(ExprSelect(p.managedVar(managed, self.side),
'.', 'Count')) ])))
foreachaccumulate = forLoopOverHashtable(p.managedVar(managed, self.side),
itervar, const=True)
foreachaccumulate.addstmt(StmtExpr(
ExprAssn(ExprIndex(elementsvar, ivar),
actorFromIter(itervar))))
foreachaccumulate.addstmt(StmtExpr(ExprPrefixUnop(ivar, '++')))
meth.addstmt(foreachaccumulate)
refmeth = MethodDefn(MethodDecl(
p.managedMethod(managed, self.side).name,
@ -3404,6 +3430,7 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
subtreewhyvar = ExprVar('subtreewhy')
kidsvar = ExprVar('kids')
ivar = ExprVar('i')
itervar = ExprVar('iter')
ithkid = ExprIndex(kidsvar, ivar)
destroysubtree = MethodDefn(MethodDecl(
@ -3433,6 +3460,8 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
])
for managed in ptype.manages:
managedVar = p.managedVar(managed, self.side)
foreachdestroy = StmtFor(
init=Param(Type.UINT32, ivar.name, ExprLiteral.ZERO),
cond=ExprBinary(ivar, '<', _callCxxArrayLength(kidsvar)),
@ -3471,20 +3500,16 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
## DeallocSubtree()
deallocsubtree = MethodDefn(MethodDecl(deallocsubtreevar.name))
for managed in ptype.manages:
foreachrecurse = StmtFor(
init=Param(Type.UINT32, ivar.name, ExprLiteral.ZERO),
cond=ExprBinary(ivar, '<', _callCxxArrayLength(kidsvar)),
update=ExprPrefixUnop(ivar, '++'))
foreachrecurse.addstmt(StmtExpr(ExprCall(
ExprSelect(ithkid, '->', deallocsubtreevar.name))))
managedVar = p.managedVar(managed, self.side)
foreachdealloc = StmtFor(
init=Param(Type.UINT32, ivar.name, ExprLiteral.ZERO),
cond=ExprBinary(ivar, '<', _callCxxArrayLength(kidsvar)),
update=ExprPrefixUnop(ivar, '++'))
foreachrecurse = forLoopOverHashtable(managedVar, itervar)
foreachrecurse.addstmt(StmtExpr(ExprCall(
ExprSelect(actorFromIter(itervar), '->', deallocsubtreevar.name))))
foreachdealloc = forLoopOverHashtable(managedVar, itervar)
foreachdealloc.addstmts([
StmtExpr(ExprCall(_deallocMethod(managed, self.side),
args=[ ithkid ]))
args=[ actorFromIter(itervar) ]))
])
block = StmtBlock()
@ -3492,17 +3517,10 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
Whitespace(
'// Recursively deleting %s kids\n'% (managed.name()),
indent=1),
StmtDecl(
Decl(p.managedVarType(managed, self.side, ref=1),
kidsvar.name),
init=p.managedVar(managed, self.side)),
foreachrecurse,
Whitespace.NL,
# no need to copy |kids| here; we're the ones deleting
# stragglers, no outside C++ is being invoked (except
# Dealloc(subactor))
foreachdealloc,
StmtExpr(_callClearManagedActors(p.managedVar(managed, self.side))),
StmtExpr(_callClearManagedActors(managedVar)),
])
deallocsubtree.addstmt(block)
@ -3561,7 +3579,6 @@ class _GenerateProtocolActorCode(ipdl.ast.Visitor):
for managed in ptype.manages:
self.cls.addstmts([
Whitespace('// Sorted by pointer value\n', indent=1),
StmtDecl(Decl(
p.managedVarType(managed, self.side),
p.managedVar(managed, self.side).name)) ])

View File

@ -22,21 +22,21 @@ TestSelfManageRootParent::Main()
if (!a)
fail("constructing PTestSelfManage");
ASSERT(1 == ManagedPTestSelfManageParent().Length());
ASSERT(1 == ManagedPTestSelfManageParent().Count());
TestSelfManageParent* aa =
static_cast<TestSelfManageParent*>(a->SendPTestSelfManageConstructor());
if (!aa)
fail("constructing PTestSelfManage");
ASSERT(1 == ManagedPTestSelfManageParent().Length() &&
1 == a->ManagedPTestSelfManageParent().Length());
ASSERT(1 == ManagedPTestSelfManageParent().Count() &&
1 == a->ManagedPTestSelfManageParent().Count());
if (!PTestSelfManageParent::Send__delete__(aa))
fail("destroying PTestSelfManage");
ASSERT(Deletion == aa->mWhy &&
1 == ManagedPTestSelfManageParent().Length() &&
0 == a->ManagedPTestSelfManageParent().Length());
1 == ManagedPTestSelfManageParent().Count() &&
0 == a->ManagedPTestSelfManageParent().Count());
delete aa;
aa =
@ -44,15 +44,15 @@ TestSelfManageRootParent::Main()
if (!aa)
fail("constructing PTestSelfManage");
ASSERT(1 == ManagedPTestSelfManageParent().Length() &&
1 == a->ManagedPTestSelfManageParent().Length());
ASSERT(1 == ManagedPTestSelfManageParent().Count() &&
1 == a->ManagedPTestSelfManageParent().Count());
if (!PTestSelfManageParent::Send__delete__(a))
fail("destroying PTestSelfManage");
ASSERT(Deletion == a->mWhy &&
AncestorDeletion == aa->mWhy &&
0 == ManagedPTestSelfManageParent().Length() &&
0 == a->ManagedPTestSelfManageParent().Length());
0 == ManagedPTestSelfManageParent().Count() &&
0 == a->ManagedPTestSelfManageParent().Count());
delete a;
delete aa;

View File

@ -26,7 +26,7 @@ TestShutdownParent::ActorDestroy(ActorDestroyReason why)
void
TestShutdownSubParent::ActorDestroy(ActorDestroyReason why)
{
if (Manager()->ManagedPTestShutdownSubParent().Length() == 0)
if (Manager()->ManagedPTestShutdownSubParent().Count() == 0)
fail("manager should still have managees!");
if (mExpectCrash && AbnormalShutdown != why)
@ -34,14 +34,14 @@ TestShutdownSubParent::ActorDestroy(ActorDestroyReason why)
else if (!mExpectCrash && AbnormalShutdown == why)
fail("wasn't expecting crash!");
if (mExpectCrash && 0 == ManagedPTestShutdownSubsubParent().Length())
if (mExpectCrash && 0 == ManagedPTestShutdownSubsubParent().Count())
fail("expected to *still* have kids");
}
void
TestShutdownSubsubParent::ActorDestroy(ActorDestroyReason why)
{
if (Manager()->ManagedPTestShutdownSubsubParent().Length() == 0)
if (Manager()->ManagedPTestShutdownSubsubParent().Count() == 0)
fail("manager should still have managees!");
if (mExpectParentDeleted && AncestorDeletion != why)
@ -206,7 +206,7 @@ TestShutdownSubChild::AnswerStackFrame()
void
TestShutdownSubChild::ActorDestroy(ActorDestroyReason why)
{
if (Manager()->ManagedPTestShutdownSubChild().Length() == 0)
if (Manager()->ManagedPTestShutdownSubChild().Count() == 0)
fail("manager should still have managees!");
if (mExpectCrash && AbnormalShutdown != why)
@ -214,14 +214,14 @@ TestShutdownSubChild::ActorDestroy(ActorDestroyReason why)
else if (!mExpectCrash && AbnormalShutdown == why)
fail("wasn't expecting crash!");
if (mExpectCrash && 0 == ManagedPTestShutdownSubsubChild().Length())
if (mExpectCrash && 0 == ManagedPTestShutdownSubsubChild().Count())
fail("expected to *still* have kids");
}
void
TestShutdownSubsubChild::ActorDestroy(ActorDestroyReason why)
{
if (Manager()->ManagedPTestShutdownSubsubChild().Length() == 0)
if (Manager()->ManagedPTestShutdownSubsubChild().Count() == 0)
fail("manager should still have managees!");
if (mExpectParentDeleted && AncestorDeletion != why)

View File

@ -90,9 +90,11 @@ GonkPermissionChecker::Run()
}
// Now iterate its apps...
for (uint32_t i = 0; i < contentParent->ManagedPBrowserParent().Length(); i++) {
const ManagedContainer<PBrowserParent>& browsers =
contentParent->ManagedPBrowserParent();
for (auto iter = browsers.ConstIter(); !iter.Done(); iter.Next()) {
dom::TabParent *tabParent =
static_cast<dom::TabParent*>(contentParent->ManagedPBrowserParent()[i]);
static_cast<dom::TabParent*>(iter.Get()->GetKey());
nsCOMPtr<mozIApplication> mozApp = tabParent->GetOwnOrContainingApp();
if (!mozApp) {
continue;