Bug 1020186 - Patch1: Revise the API in ContentProcessManager - v1, r=khuey

This commit is contained in:
Kershaw Chang 2014-11-13 01:27:00 +01:00
parent 7f42025e12
commit a5dd5a415d
2 changed files with 18 additions and 13 deletions

View File

@ -207,25 +207,29 @@ ContentProcessManager::DeallocateTabId(const ContentParentId& aChildCpId,
}
}
nsTArray<uint64_t>
ContentProcessManager::GetAppIdsByContentProcess(const ContentParentId& aChildCpId)
bool
ContentProcessManager::GetTabContextByProcessAndTabId(const ContentParentId& aChildCpId,
const TabId& aChildTabId,
/*out*/ TabContext* aTabContext)
{
MOZ_ASSERT(NS_IsMainThread());
MOZ_ASSERT(aTabContext);
nsTArray<uint64_t> appIdArray;
auto iter = mContentParentMap.find(aChildCpId);
if (NS_WARN_IF(iter == mContentParentMap.end())) {
ASSERT_UNLESS_FUZZING();
return Move(appIdArray);
return false;
}
for (auto remoteFrameIter = iter->second.mRemoteFrames.begin();
remoteFrameIter != iter->second.mRemoteFrames.end();
++remoteFrameIter) {
appIdArray.AppendElement(remoteFrameIter->second.mContext.OwnOrContainingAppId());
auto remoteFrameIter = iter->second.mRemoteFrames.find(aChildTabId);
if (NS_WARN_IF(remoteFrameIter == iter->second.mRemoteFrames.end())) {
ASSERT_UNLESS_FUZZING();
return false;
}
return Move(appIdArray);
*aTabContext = remoteFrameIter->second.mContext;
return true;
}
nsTArray<TabContext>

View File

@ -88,11 +88,12 @@ public:
const TabId& aChildTabId);
/**
* Get all app ids which are inside the given content process.
* XXX Currently not used. Plan to be used for bug 1020186.
* Get the TabContext by the given content process and tab id.
*/
nsTArray<uint64_t>
GetAppIdsByContentProcess(const ContentParentId& aChildCpId);
bool
GetTabContextByProcessAndTabId(const ContentParentId& aChildCpId,
const TabId& aChildTabId,
/*out*/ TabContext* aTabContext);
/**
* Get all TabContext which are inside the given content process.