Bug 1358111 - Use IPCBlob in Entries API - part 1 - GetFilesHelper, r=smaug

This commit is contained in:
Andrea Marchesini 2017-04-24 12:16:49 +02:00
Родитель 25e4c65c6d
Коммит 44a1314868
3 изменённых файлов: 16 добавлений и 10 удалений

Просмотреть файл

@ -8,6 +8,8 @@
#include "mozilla/dom/ContentChild.h"
#include "mozilla/dom/ContentParent.h"
#include "mozilla/dom/FileBlobImpl.h"
#include "mozilla/dom/IPCBlobUtils.h"
#include "mozilla/ipc/IPCStreamUtils.h"
#include "FileSystemUtils.h"
#include "nsProxyRelease.h"
@ -585,13 +587,15 @@ public:
}
GetFilesResponseSuccess success;
nsTArray<PBlobParent*>& blobsParent = success.blobsParent();
blobsParent.SetLength(aFiles.Length());
nsTArray<IPCBlob>& ipcBlobs = success.blobs();
ipcBlobs.SetLength(aFiles.Length());
for (uint32_t i = 0; i < aFiles.Length(); ++i) {
blobsParent[i] =
mParent->mContentParent->GetOrCreateActorForBlob(aFiles[i]);
if (!blobsParent[i]) {
nsresult rv = IPCBlobUtils::Serialize(aFiles[i]->Impl(),
mParent->mContentParent,
ipcBlobs[i]);
if (NS_WARN_IF(NS_FAILED(rv))) {
mParent->mContentParent->SendGetFilesResponseAndForget(mParent->mUUID,
GetFilesResponseFailure(NS_ERROR_OUT_OF_MEMORY));
return;

Просмотреть файл

@ -31,6 +31,7 @@
#include "mozilla/dom/FileCreatorHelper.h"
#include "mozilla/dom/FlyWebPublishedServerIPC.h"
#include "mozilla/dom/GetFilesHelper.h"
#include "mozilla/dom/IPCBlobUtils.h"
#include "mozilla/dom/MemoryReportRequest.h"
#include "mozilla/dom/ProcessGlobal.h"
#include "mozilla/dom/PushNotifier.h"
@ -3152,12 +3153,12 @@ ContentChild::RecvGetFilesResponse(const nsID& aUUID,
} else {
MOZ_ASSERT(aResult.type() == GetFilesResponseResult::TGetFilesResponseSuccess);
const nsTArray<PBlobChild*>& blobs =
aResult.get_GetFilesResponseSuccess().blobsChild();
const nsTArray<IPCBlob>& ipcBlobs =
aResult.get_GetFilesResponseSuccess().blobs();
bool succeeded = true;
for (uint32_t i = 0; succeeded && i < blobs.Length(); ++i) {
RefPtr<BlobImpl> impl = static_cast<BlobChild*>(blobs[i])->GetBlobImpl();
for (uint32_t i = 0; succeeded && i < ipcBlobs.Length(); ++i) {
RefPtr<BlobImpl> impl = IPCBlobUtils::Deserialize(ipcBlobs[i]);
succeeded = child->AppendBlobImpl(impl);
}

Просмотреть файл

@ -47,6 +47,7 @@ include protocol PVideoDecoderManager;
include protocol PFlyWebPublishedServer;
include DOMTypes;
include JavaScriptTypes;
include IPCBlob;
include IPCStream;
include PTabContext;
include URIParams;
@ -195,7 +196,7 @@ struct AndroidSystemInfo
struct GetFilesResponseSuccess
{
PBlob[] blobs;
IPCBlob[] blobs;
};
struct GetFilesResponseFailure