本文整理汇总了C++中ContentParent::ChildID方法的典型用法代码示例。如果您正苦于以下问题:C++ ContentParent::ChildID方法的具体用法?C++ ContentParent::ChildID怎么用?C++ ContentParent::ChildID使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentParent
的用法示例。
在下文中一共展示了ContentParent::ChildID方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: memset
bool
ScreenManagerParent::RecvScreenForBrowser(const TabId& aTabId,
ScreenDetails* aRetVal,
bool* aSuccess)
{
*aSuccess = false;
#ifdef MOZ_VALGRIND
// Zero this so that Valgrind doesn't complain when we send it to another
// process.
memset(aRetVal, 0, sizeof(ScreenDetails));
#endif
// Find the mWidget associated with the tabparent, and then return
// the nsIScreen it's on.
ContentParent* cp = static_cast<ContentParent*>(this->Manager());
ContentProcessManager* cpm = ContentProcessManager::GetSingleton();
nsRefPtr<TabParent> tabParent =
cpm->GetTopLevelTabParentByProcessAndTabId(cp->ChildID(), aTabId);
if(!tabParent){
return false;
}
nsCOMPtr<nsIWidget> widget = tabParent->GetWidget();
nsCOMPtr<nsIScreen> screen;
if (widget) {
if (widget->GetNativeData(NS_NATIVE_WINDOW)) {
mScreenMgr->ScreenForNativeWidget(widget->GetNativeData(NS_NATIVE_WINDOW),
getter_AddRefs(screen));
}
} else {
nsresult rv = mScreenMgr->GetPrimaryScreen(getter_AddRefs(screen));
if (NS_WARN_IF(NS_FAILED(rv))) {
return true;
}
}
NS_ENSURE_TRUE(screen, true);
ScreenDetails details;
if (!ExtractScreenDetails(screen, details)) {
return true;
}
*aRetVal = details;
*aSuccess = true;
return true;
}
示例2: SendFilesOrDirectories
void FilePickerParent::SendFilesOrDirectories(
const nsTArray<BlobImplOrString>& aData) {
ContentParent* parent = TabParent::GetFrom(Manager())->Manager();
if (mMode == nsIFilePicker::modeGetFolder) {
MOZ_ASSERT(aData.Length() <= 1);
if (aData.IsEmpty()) {
Unused << Send__delete__(this, void_t(), mResult);
return;
}
MOZ_ASSERT(aData[0].mType == BlobImplOrString::eDirectoryPath);
// Let's inform the security singleton about the given access of this tab on
// this directory path.
RefPtr<FileSystemSecurity> fss = FileSystemSecurity::GetOrCreate();
fss->GrantAccessToContentProcess(parent->ChildID(),
aData[0].mDirectoryPath);
InputDirectory input;
input.directoryPath() = aData[0].mDirectoryPath;
Unused << Send__delete__(this, input, mResult);
return;
}
InfallibleTArray<IPCBlob> ipcBlobs;
for (unsigned i = 0; i < aData.Length(); i++) {
IPCBlob ipcBlob;
MOZ_ASSERT(aData[i].mType == BlobImplOrString::eBlobImpl);
nsresult rv = IPCBlobUtils::Serialize(aData[i].mBlobImpl, parent, ipcBlob);
if (NS_WARN_IF(NS_FAILED(rv))) {
break;
}
ipcBlobs.AppendElement(ipcBlob);
}
InputBlobs inblobs;
inblobs.blobs().SwapElements(ipcBlobs);
Unused << Send__delete__(this, inblobs, mResult);
}