Backed out changeset 73f62ae76c08 (bug 1358111)

This commit is contained in:
Sebastian Hengst 2017-04-24 15:43:10 +02:00
parent d3da87ad97
commit 894a9bd892
7 changed files with 32 additions and 39 deletions

View File

@ -12,6 +12,7 @@
#include "mozilla/dom/FileSystemRequestParent.h"
#include "mozilla/dom/FileSystemUtils.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/ipc/BlobParent.h"
#include "mozilla/ipc/BackgroundChild.h"
#include "mozilla/ipc/BackgroundParent.h"
#include "mozilla/ipc/PBackgroundChild.h"

View File

@ -19,6 +19,7 @@ namespace dom {
class BlobImpl;
class FileSystemBase;
class FileSystemParams;
class PBlobParent;
/*
* The base class to implement a Task class.

View File

@ -11,10 +11,11 @@
#include "mozilla/dom/FileBlobImpl.h"
#include "mozilla/dom/FileSystemBase.h"
#include "mozilla/dom/FileSystemUtils.h"
#include "mozilla/dom/IPCBlobUtils.h"
#include "mozilla/dom/PFileSystemParams.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/UnionTypes.h"
#include "mozilla/dom/ipc/BlobChild.h"
#include "mozilla/dom/ipc/BlobParent.h"
#include "nsIFile.h"
#include "nsISimpleEnumerator.h"
#include "nsStringGlue.h"
@ -130,7 +131,8 @@ GetDirectoryListingTaskChild::SetSuccessRequestResult(const FileSystemResponseVa
const FileSystemDirectoryListingResponseFile& d =
data.get_FileSystemDirectoryListingResponseFile();
RefPtr<BlobImpl> blobImpl = IPCBlobUtils::Deserialize(d.blob());
RefPtr<BlobImpl> blobImpl =
static_cast<BlobChild*>(d.blobChild())->GetBlobImpl();
MOZ_ASSERT(blobImpl);
RefPtr<File> file = File::Create(mFileSystem->GetParentObject(), blobImpl);
@ -220,6 +222,8 @@ GetDirectoryListingTaskParent::GetSuccessRequestResult(ErrorResult& aRv) const
{
AssertIsOnBackgroundThread();
InfallibleTArray<PBlobParent*> blobs;
nsTArray<FileSystemDirectoryListingResponseData> inputs;
for (unsigned i = 0; i < mTargetData.Length(); i++) {
@ -247,14 +251,8 @@ GetDirectoryListingTaskParent::GetSuccessRequestResult(ErrorResult& aRv) const
filePath.Append(name);
blobImpl->SetDOMPath(filePath);
IPCBlob ipcBlob;
rv =
IPCBlobUtils::Serialize(blobImpl, mRequestParent->Manager(), ipcBlob);
if (NS_WARN_IF(NS_FAILED(rv))) {
return FileSystemErrorResponse(rv);
}
fileData.blob() = ipcBlob;
fileData.blobParent() =
BlobParent::GetOrCreate(mRequestParent->Manager(), blobImpl);
inputs.AppendElement(fileData);
} else {
MOZ_ASSERT(mTargetData[i].mType == FileOrDirectoryPath::eDirectoryPath);

View File

@ -12,7 +12,8 @@
#include "mozilla/dom/FileSystemUtils.h"
#include "mozilla/dom/PFileSystemParams.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/IPCBlobUtils.h"
#include "mozilla/dom/ipc/BlobChild.h"
#include "mozilla/dom/ipc/BlobParent.h"
#include "nsIFile.h"
#include "nsStringGlue.h"
@ -97,7 +98,8 @@ GetFileOrDirectoryTaskChild::SetSuccessRequestResult(const FileSystemResponseVal
case FileSystemResponseValue::TFileSystemFileResponse: {
FileSystemFileResponse r = aValue;
RefPtr<BlobImpl> blobImpl = IPCBlobUtils::Deserialize(r.blob());
RefPtr<BlobImpl> blobImpl =
static_cast<BlobChild*>(r.blobChild())->GetBlobImpl();
MOZ_ASSERT(blobImpl);
mResultFile = File::Create(mFileSystem->GetParentObject(), blobImpl);
@ -206,14 +208,9 @@ GetFileOrDirectoryTaskParent::GetSuccessRequestResult(ErrorResult& aRv) const
}
RefPtr<BlobImpl> blobImpl = new FileBlobImpl(mTargetPath);
IPCBlob ipcBlob;
aRv = IPCBlobUtils::Serialize(blobImpl, mRequestParent->Manager(), ipcBlob);
if (NS_WARN_IF(aRv.Failed())) {
return FileSystemDirectoryResponse();
}
return FileSystemFileResponse(ipcBlob);
BlobParent* blobParent =
BlobParent::GetOrCreate(mRequestParent->Manager(), blobImpl);
return FileSystemFileResponse(blobParent, nullptr);
}
nsresult

View File

@ -11,9 +11,10 @@
#include "mozilla/dom/File.h"
#include "mozilla/dom/FileSystemBase.h"
#include "mozilla/dom/FileSystemUtils.h"
#include "mozilla/dom/IPCBlobUtils.h"
#include "mozilla/dom/PFileSystemParams.h"
#include "mozilla/dom/Promise.h"
#include "mozilla/dom/ipc/BlobChild.h"
#include "mozilla/dom/ipc/BlobParent.h"
#include "nsIFile.h"
#include "nsStringGlue.h"
@ -122,7 +123,8 @@ GetFilesTaskChild::SetSuccessRequestResult(const FileSystemResponseValue& aValue
for (uint32_t i = 0; i < r.data().Length(); ++i) {
const FileSystemFileResponse& data = r.data()[i];
RefPtr<BlobImpl> blobImpl = IPCBlobUtils::Deserialize(data.blob());
RefPtr<BlobImpl> blobImpl =
static_cast<BlobChild*>(data.blobChild())->GetBlobImpl();
MOZ_ASSERT(blobImpl);
mTargetData[i] = File::Create(mFileSystem->GetParentObject(), blobImpl);
@ -191,6 +193,8 @@ GetFilesTaskParent::GetSuccessRequestResult(ErrorResult& aRv) const
{
AssertIsOnBackgroundThread();
InfallibleTArray<PBlobParent*> blobs;
FallibleTArray<FileSystemFileResponse> inputs;
if (!inputs.SetLength(mTargetBlobImplArray.Length(), mozilla::fallible_t())) {
FileSystemFilesResponse response;
@ -199,15 +203,10 @@ GetFilesTaskParent::GetSuccessRequestResult(ErrorResult& aRv) const
}
for (unsigned i = 0; i < mTargetBlobImplArray.Length(); i++) {
IPCBlob ipcBlob;
aRv = IPCBlobUtils::Serialize(mTargetBlobImplArray[i],
mRequestParent->Manager(), ipcBlob);
if (NS_WARN_IF(aRv.Failed())) {
FileSystemFilesResponse response;
return response;
}
inputs[i] = FileSystemFileResponse(ipcBlob);
BlobParent* blobParent =
BlobParent::GetOrCreate(mRequestParent->Manager(),
mTargetBlobImplArray[i]);
inputs[i] = FileSystemFileResponse(blobParent, nullptr);
}
FileSystemFilesResponse response;

View File

@ -2,6 +2,8 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
include protocol PBlob;
namespace mozilla {
namespace dom {

View File

@ -5,19 +5,14 @@
* You can obtain one at http://mozilla.org/MPL/2.0/. */
include protocol PBackground;
include protocol PIPCBlobInputStream;
include protocol PChildToParentStream;
include protocol PParentToChildStream;
include protocol PFileDescriptorSet;
include IPCBlob;
include protocol PBlob;
namespace mozilla {
namespace dom {
struct FileSystemFileResponse
{
IPCBlob blob;
PBlob blob;
};
struct FileSystemDirectoryResponse
@ -27,7 +22,7 @@ struct FileSystemDirectoryResponse
struct FileSystemDirectoryListingResponseFile
{
IPCBlob blob;
PBlob blob;
};
struct FileSystemDirectoryListingResponseDirectory