Exemplo n.º 1
0
FileSystemResponseValue
GetFilesTaskParent::GetSuccessRequestResult(ErrorResult& aRv) const
{
  AssertIsOnBackgroundThread();

  InfallibleTArray<PBlobParent*> blobs;

  FallibleTArray<FileSystemFileResponse> inputs;
  if (!inputs.SetLength(mTargetBlobImplArray.Length(), mozilla::fallible_t())) {
    aRv.Throw(NS_ERROR_OUT_OF_MEMORY);
    FileSystemFilesResponse response;
    return response;
  }

  for (unsigned i = 0; i < mTargetBlobImplArray.Length(); i++) {
    BlobParent* blobParent =
      BlobParent::GetOrCreate(mRequestParent->Manager(),
                              mTargetBlobImplArray[i]);
    inputs[i] = FileSystemFileResponse(blobParent, nullptr);
  }

  FileSystemFilesResponse response;
  response.data().SwapElements(inputs);
  return response;
}
Exemplo n.º 2
0
FileSystemResponseValue
CreateFileTaskParent::GetSuccessRequestResult(ErrorResult& aRv) const
{
  AssertIsOnBackgroundThread();

  nsAutoString path;
  aRv = mTargetPath->GetPath(path);
  if (NS_WARN_IF(aRv.Failed())) {
    return FileSystemDirectoryResponse();
  }

  return FileSystemFileResponse(path, EmptyString());
}
Exemplo n.º 3
0
FileSystemResponseValue
GetFileOrDirectoryTaskParent::GetSuccessRequestResult(ErrorResult& aRv) const
{
  AssertIsOnBackgroundThread();

  nsAutoString path;
  aRv = mTargetPath->GetPath(path);
  if (NS_WARN_IF(aRv.Failed())) {
    return FileSystemDirectoryResponse();
  }

  if (mIsDirectory) {
    return FileSystemDirectoryResponse(path);
  }

  RefPtr<BlobImpl> blobImpl = new FileBlobImpl(mTargetPath);
  BlobParent* blobParent =
    BlobParent::GetOrCreate(mRequestParent->Manager(), blobImpl);
  return FileSystemFileResponse(blobParent, nullptr);
}