Bug 1215644 - Use child process volume service cache for available and storage status requests. r=dhylands
authorAndrew Osmond <aosmond@mozilla.com>
Wed, 21 Oct 2015 01:55:24 -0400
changeset 303962 28499fbb07010d812afd75db81cad2fa55e7e059
parent 303961 b627b7dfb3cf498824cdfa7b49b6c77d52920490
child 303963 e96a6b23978cb2247df4e164b10a7d68f1722223
push id1001
push userraliiev@mozilla.com
push dateMon, 18 Jan 2016 19:06:03 +0000
treeherdermozilla-release@8b89261f3ac4 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersdhylands
bugs1215644
milestone44.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 1215644 - Use child process volume service cache for available and storage status requests. r=dhylands
dom/devicestorage/DeviceStorageRequestChild.cpp
dom/devicestorage/DeviceStorageRequestParent.cpp
dom/devicestorage/DeviceStorageRequestParent.h
dom/devicestorage/PDeviceStorageRequest.ipdl
dom/devicestorage/nsDeviceStorage.cpp
--- a/dom/devicestorage/DeviceStorageRequestChild.cpp
+++ b/dom/devicestorage/DeviceStorageRequestChild.cpp
@@ -90,32 +90,16 @@ DeviceStorageRequestChild::
     case DeviceStorageResponseValue::TUsedSpaceStorageResponse:
     {
       DS_LOG_INFO("used %u", mRequest->GetId());
       UsedSpaceStorageResponse r = aValue;
       mRequest->Resolve(r.usedBytes());
       break;
     }
 
-    case DeviceStorageResponseValue::TAvailableStorageResponse:
-    {
-      DS_LOG_INFO("available %u", mRequest->GetId());
-      AvailableStorageResponse r = aValue;
-      mRequest->Resolve(r.mountState());
-      break;
-    }
-
-    case DeviceStorageResponseValue::TStorageStatusResponse:
-    {
-      DS_LOG_INFO("status %u", mRequest->GetId());
-      StorageStatusResponse r = aValue;
-      mRequest->Resolve(r.storageStatus());
-      break;
-    }
-
     case DeviceStorageResponseValue::TFormatStorageResponse:
     {
       DS_LOG_INFO("format %u", mRequest->GetId());
       FormatStorageResponse r = aValue;
       mRequest->Resolve(r.mountState());
       break;
     }
 
--- a/dom/devicestorage/DeviceStorageRequestParent.cpp
+++ b/dom/devicestorage/DeviceStorageRequestParent.cpp
@@ -159,42 +159,16 @@ DeviceStorageRequestParent::Dispatch()
       RefPtr<DeviceStorageFile> dsf =
         new DeviceStorageFile(p.type(), p.storageName());
       RefPtr<UsedSpaceFileEvent> r = new UsedSpaceFileEvent(this, dsf);
 
       usedSpaceCache->Dispatch(r);
       break;
     }
 
-    case DeviceStorageParams::TDeviceStorageAvailableParams:
-    {
-      DeviceStorageAvailableParams p = mParams;
-
-      RefPtr<DeviceStorageFile> dsf =
-        new DeviceStorageFile(p.type(), p.storageName());
-      RefPtr<PostAvailableResultEvent> r
-        = new PostAvailableResultEvent(this, dsf);
-      DebugOnly<nsresult> rv = NS_DispatchToMainThread(r);
-      MOZ_ASSERT(NS_SUCCEEDED(rv));
-      break;
-    }
-
-    case DeviceStorageParams::TDeviceStorageStatusParams:
-    {
-      DeviceStorageStatusParams p = mParams;
-
-      RefPtr<DeviceStorageFile> dsf =
-        new DeviceStorageFile(p.type(), p.storageName());
-      RefPtr<PostStatusResultEvent> r
-        = new PostStatusResultEvent(this, dsf);
-      DebugOnly<nsresult> rv = NS_DispatchToMainThread(r);
-      MOZ_ASSERT(NS_SUCCEEDED(rv));
-      break;
-    }
-
     case DeviceStorageParams::TDeviceStorageFormatParams:
     {
       DeviceStorageFormatParams p = mParams;
 
       RefPtr<DeviceStorageFile> dsf =
         new DeviceStorageFile(p.type(), p.storageName());
       RefPtr<PostFormatResultEvent> r
         = new PostFormatResultEvent(this, dsf);
@@ -915,72 +889,16 @@ DeviceStorageRequestParent::PostFileDesc
 {
   MOZ_ASSERT(NS_IsMainThread());
 
   FileDescriptorResponse response(mFileDescriptor);
   unused << mParent->Send__delete__(mParent, response);
   return NS_OK;
 }
 
-DeviceStorageRequestParent::PostAvailableResultEvent::
-  PostAvailableResultEvent(DeviceStorageRequestParent* aParent,
-                           DeviceStorageFile* aFile)
-  : CancelableRunnable(aParent)
-  , mFile(aFile)
-{
-}
-
-DeviceStorageRequestParent::PostAvailableResultEvent::
-  ~PostAvailableResultEvent()
-{
-}
-
-nsresult
-DeviceStorageRequestParent::PostAvailableResultEvent::CancelableRun()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  nsString state = NS_LITERAL_STRING("unavailable");
-  if (mFile) {
-    mFile->GetStatus(state);
-  }
-
-  AvailableStorageResponse response(state);
-  unused << mParent->Send__delete__(mParent, response);
-  return NS_OK;
-}
-
-DeviceStorageRequestParent::PostStatusResultEvent::
-  PostStatusResultEvent(DeviceStorageRequestParent* aParent,
-                           DeviceStorageFile* aFile)
-  : CancelableRunnable(aParent)
-  , mFile(aFile)
-{
-}
-
-DeviceStorageRequestParent::PostStatusResultEvent::
-  ~PostStatusResultEvent()
-{
-}
-
-nsresult
-DeviceStorageRequestParent::PostStatusResultEvent::CancelableRun()
-{
-  MOZ_ASSERT(NS_IsMainThread());
-
-  nsString state = NS_LITERAL_STRING("undefined");
-  if (mFile) {
-    mFile->GetStorageStatus(state);
-  }
-
-  StorageStatusResponse response(state);
-  unused << mParent->Send__delete__(mParent, response);
-  return NS_OK;
-}
-
 DeviceStorageRequestParent::PostFormatResultEvent::
   PostFormatResultEvent(DeviceStorageRequestParent* aParent,
                            DeviceStorageFile* aFile)
   : CancelableRunnable(aParent)
   , mFile(aFile)
 {
 }
 
--- a/dom/devicestorage/DeviceStorageRequestParent.h
+++ b/dom/devicestorage/DeviceStorageRequestParent.h
@@ -237,36 +237,16 @@ private:
                                uint64_t aUsedSpace);
       virtual ~PostUsedSpaceResultEvent();
       virtual nsresult CancelableRun();
     private:
       nsString mType;
       uint64_t mUsedSpace;
  };
 
- class PostAvailableResultEvent : public CancelableRunnable
- {
-    public:
-      PostAvailableResultEvent(DeviceStorageRequestParent* aParent, DeviceStorageFile* aFile);
-      virtual ~PostAvailableResultEvent();
-      virtual nsresult CancelableRun();
-    private:
-      RefPtr<DeviceStorageFile> mFile;
- };
-
- class PostStatusResultEvent : public CancelableRunnable
- {
-    public:
-      PostStatusResultEvent(DeviceStorageRequestParent* aParent, DeviceStorageFile* aFile);
-      virtual ~PostStatusResultEvent();
-      virtual nsresult CancelableRun();
-    private:
-      RefPtr<DeviceStorageFile> mFile;
- };
-
  class PostFormatResultEvent : public CancelableRunnable
  {
     public:
       PostFormatResultEvent(DeviceStorageRequestParent* aParent, DeviceStorageFile* aFile);
       virtual ~PostFormatResultEvent();
       virtual nsresult CancelableRun();
     private:
       RefPtr<DeviceStorageFile> mFile;
--- a/dom/devicestorage/PDeviceStorageRequest.ipdl
+++ b/dom/devicestorage/PDeviceStorageRequest.ipdl
@@ -48,26 +48,16 @@ struct FreeSpaceStorageResponse
   uint64_t freeBytes;
 };
 
 struct UsedSpaceStorageResponse
 {
   uint64_t usedBytes;
 };
 
-struct AvailableStorageResponse
-{
-  nsString mountState;
-};
-
-struct StorageStatusResponse
-{
-  nsString storageStatus;
-};
-
 struct FormatStorageResponse
 {
   nsString mountState;
 };
 
 struct MountStorageResponse
 {
   nsString storageStatus;
@@ -82,18 +72,16 @@ union DeviceStorageResponseValue
 {
   ErrorResponse;
   SuccessResponse;
   FileDescriptorResponse;
   BlobResponse;
   EnumerationResponse;
   FreeSpaceStorageResponse;
   UsedSpaceStorageResponse;
-  AvailableStorageResponse;
-  StorageStatusResponse;
   FormatStorageResponse;
   MountStorageResponse;
   UnmountStorageResponse;
 };
 
 sync protocol PDeviceStorageRequest {
     manager PContent;
 child:
--- a/dom/devicestorage/nsDeviceStorage.cpp
+++ b/dom/devicestorage/nsDeviceStorage.cpp
@@ -2249,65 +2249,49 @@ protected:
 
 class DeviceStorageAvailableRequest final
   : public DeviceStorageRequest
 {
 public:
   DeviceStorageAvailableRequest()
   {
     mAccess = DEVICE_STORAGE_ACCESS_READ;
+    mSendToParent = false;
     DS_LOG_INFO("");
   }
 
   NS_IMETHOD Run() override
   {
     nsString state = NS_LITERAL_STRING("unavailable");
     if (mFile) {
       mFile->GetStatus(state);
     }
     return Resolve(state);
   }
-
-protected:
-  nsresult CreateSendParams(DeviceStorageParams& aParams) override
-  {
-    DeviceStorageAvailableParams params(mFile->mStorageType,
-                                        mFile->mStorageName);
-    aParams = params;
-    return NS_OK;
-  }
 };
 
 class DeviceStorageStatusRequest final
   : public DeviceStorageRequest
 {
 public:
   DeviceStorageStatusRequest()
   {
     mAccess = DEVICE_STORAGE_ACCESS_READ;
+    mSendToParent = false;
     DS_LOG_INFO("");
   }
 
   NS_IMETHOD Run() override
   {
     nsString state = NS_LITERAL_STRING("undefined");
     if (mFile) {
       mFile->GetStorageStatus(state);
     }
     return Resolve(state);
   }
-
-protected:
-  nsresult CreateSendParams(DeviceStorageParams& aParams) override
-  {
-    DeviceStorageStatusParams params(mFile->mStorageType,
-                                     mFile->mStorageName);
-    aParams = params;
-    return NS_OK;
-  }
 };
 
 class DeviceStorageWatchRequest final
   : public DeviceStorageRequest
 {
 public:
   DeviceStorageWatchRequest()
   {