nsresult SerializeUntyped(BlobImpl* aBlobImpl, IProtocol* aActor, IPCBlob& aIPCBlob) { // We always want to act on the toplevel protocol. IProtocol* manager = aActor; while (manager->Manager()) { manager = manager->Manager(); } // We always need the toplevel protocol switch(manager->GetProtocolTypeId()) { case PBackgroundMsgStart: if (manager->GetSide() == mozilla::ipc::ParentSide) { return SerializeInternal(aBlobImpl, static_cast<PBackgroundParent*>(manager), aIPCBlob); } else { return SerializeInternal(aBlobImpl, static_cast<PBackgroundChild*>(manager), aIPCBlob); } case PContentMsgStart: if (manager->GetSide() == mozilla::ipc::ParentSide) { return SerializeInternal(aBlobImpl, static_cast<ContentParent*>(manager), aIPCBlob); } else { return SerializeInternal(aBlobImpl, static_cast<ContentChild*>(manager), aIPCBlob); } default: MOZ_CRASH("Unsupported protocol passed to BlobImpl serialize"); } }
bool FInternationalizationManifestJsonSerializer::SerializeManifest( TSharedRef< const FInternationalizationManifest > Manifest, FString& Str ) { TSharedRef< FJsonObject > JsonManifestObj = MakeShareable( new FJsonObject ); bool bExecSuccessful = SerializeInternal( Manifest, JsonManifestObj ); if(bExecSuccessful) { TSharedRef< TJsonWriter<> > Writer = TJsonWriterFactory<>::Create( &Str ); bExecSuccessful = FJsonSerializer::Serialize(JsonManifestObj, Writer); Writer->Close(); } return bExecSuccessful; }
bool FJsonInternationalizationArchiveSerializer::SerializeArchive( TSharedRef< const FInternationalizationArchive > InternationalizationArchive, FString& Str ) { TSharedRef< FJsonObject > JsonArchiveObj = MakeShareable( new FJsonObject ); bool bExecSuccessful = SerializeInternal( InternationalizationArchive, JsonArchiveObj ); if( bExecSuccessful ) { TSharedRef< TJsonWriter<> > Writer = TJsonWriterFactory<>::Create( &Str ); bExecSuccessful = FJsonSerializer::Serialize( JsonArchiveObj, Writer ); Writer->Close(); } return bExecSuccessful; }
bool FJsonInternationalizationArchiveSerializer::SerializeArchive( TSharedRef< const FInternationalizationArchive > InArchive, TSharedRef< FJsonObject > InJsonObj ) { return SerializeInternal( InArchive, InJsonObj ); }
bool FInternationalizationManifestJsonSerializer::SerializeManifest( TSharedRef< const FInternationalizationManifest > Manifest, TSharedRef< FJsonObject > JsonObj ) { return SerializeInternal( Manifest, JsonObj ); }
nsresult Serialize(BlobImpl* aBlobImpl, PBackgroundParent* aManager, IPCBlob& aIPCBlob) { return SerializeInternal(aBlobImpl, aManager, aIPCBlob); }
nsresult Serialize(BlobImpl* aBlobImpl, nsIContentParent* aManager, IPCBlob& aIPCBlob) { return SerializeInternal(aBlobImpl, aManager, aIPCBlob); }