зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1358111 - Use IPCBlob in Entries API - part 1 - GetFilesHelper, r=smaug
This commit is contained in:
Родитель
25e4c65c6d
Коммит
44a1314868
|
@ -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
|
||||
|
|
Загрузка…
Ссылка в новой задаче