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 522324 cd11bf45d948ab603bfd0eecada05b8854e93e0a
parent 522323 fbb0b16293f0ecf46837f473e4b02235d13b3db5
child 522325 b9479ab9a8f378b5d46fd1e212b5f6be16565264
push id10871
push usercbrindusan@mozilla.com
push dateMon, 18 Mar 2019 15:49:32 +0000
treeherdermozilla-beta@018abdd16060 [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