Bug 1535397 - Part 1 - use native Maybe syntax in place of PendingIPCFileUnion in IDPL; r=baku
authorAlex Gaynor <agaynor@mozilla.com>
Fri, 15 Mar 2019 17:09:44 +0000
changeset 464435 cd11bf45d948
parent 464434 fbb0b16293f0
child 464436 b9479ab9a8f3
push id35716
push useraciure@mozilla.com
push dateSun, 17 Mar 2019 09:42:17 +0000
treeherdermozilla-central@8ee97c045359 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbaku
bugs1535397
milestone67.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1535397 - Part 1 - use native Maybe syntax in place of PendingIPCFileUnion in IDPL; r=baku Differential Revision: https://phabricator.services.mozilla.com/D23558
dom/file/ipc/PPendingIPCBlob.ipdl
dom/file/ipc/PendingIPCBlobChild.cpp
dom/file/ipc/PendingIPCBlobParent.cpp
--- a/dom/file/ipc/PPendingIPCBlob.ipdl
+++ b/dom/file/ipc/PPendingIPCBlob.ipdl
@@ -16,32 +16,23 @@ namespace ipc {
 
 // This contains any extra bit for making a File out of a Blob.
 struct PendingIPCFileData
 {
   nsString name;
   int64_t lastModified;
 };
 
-// Union for blob vs file.
-union PendingIPCFileUnion
-{
-  // For Blob.
-  void_t;
-
-  // For File.
-  PendingIPCFileData;
-};
-
 struct PendingIPCBlobData
 {
   nsString type;
   uint64_t size;
 
-  PendingIPCFileUnion file;
+  // Nothing() is used for Blob
+  PendingIPCFileData? file;
 };
 
 protocol PPendingIPCBlob
 {
   manager PBackground;
 
 parent:
   async __delete__(PendingIPCBlobData aData);
--- a/dom/file/ipc/PendingIPCBlobChild.cpp
+++ b/dom/file/ipc/PendingIPCBlobChild.cpp
@@ -20,29 +20,29 @@ already_AddRefed<BlobImpl> PendingIPCBlo
     const nsString& aName, const nsString& aContentType, uint64_t aLength,
     int64_t aLastModifiedDate) {
   RefPtr<BlobImpl> blobImpl;
   blobImpl.swap(mBlobImpl);
 
   blobImpl->SetLazyData(aName, aContentType, aLength, aLastModifiedDate);
 
   PendingIPCFileData fileData(nsString(aName), aLastModifiedDate);
-  PendingIPCBlobData blobData(nsString(aContentType), aLength, fileData);
+  PendingIPCBlobData blobData(nsString(aContentType), aLength, Some(fileData));
   Unused << Send__delete__(this, blobData);
 
   return blobImpl.forget();
 }
 
 already_AddRefed<BlobImpl> PendingIPCBlobChild::SetPendingInfoAndDeleteActor(
     const nsString& aContentType, uint64_t aLength) {
   RefPtr<BlobImpl> blobImpl;
   blobImpl.swap(mBlobImpl);
 
   blobImpl->SetLazyData(VoidString(), aContentType, aLength, INT64_MAX);
 
-  PendingIPCBlobData data(nsString(aContentType), aLength, void_t());
+  PendingIPCBlobData data(nsString(aContentType), aLength, Nothing());
   Unused << Send__delete__(this, data);
 
   return blobImpl.forget();
 }
 
 }  // namespace dom
 }  // namespace mozilla
--- a/dom/file/ipc/PendingIPCBlobParent.cpp
+++ b/dom/file/ipc/PendingIPCBlobParent.cpp
@@ -34,20 +34,20 @@ PendingIPCBlobParent* PendingIPCBlobPare
   return actor;
 }
 
 PendingIPCBlobParent::PendingIPCBlobParent(BlobImpl* aBlobImpl)
     : mBlobImpl(aBlobImpl) {}
 
 IPCResult PendingIPCBlobParent::Recv__delete__(
     const PendingIPCBlobData& aData) {
-  if (aData.file().type() == PendingIPCFileUnion::Tvoid_t) {
+  if (aData.file().isNothing()) {
     mBlobImpl->SetLazyData(VoidString(), aData.type(), aData.size(), INT64_MAX);
   } else {
-    const PendingIPCFileData& fileData = aData.file().get_PendingIPCFileData();
+    const PendingIPCFileData& fileData = aData.file().ref();
     mBlobImpl->SetLazyData(fileData.name(), aData.type(), aData.size(),
                            fileData.lastModified());
   }
 
   return IPC_OK();
 }
 
 }  // namespace dom