Bug 1113062 - patch 1 - PIFileImpl and FileImpl merged, r=smaug
authorAndrea Marchesini <amarchesini@mozilla.com>
Sun, 11 Jan 2015 21:34:31 +0000
changeset 248988 a0ec121ce6bffb7aff20ae78be3fa7136ec0560b
parent 248987 3ffd66a3f1bd9d2bca1acf5c6086c85dec1119c2
child 248989 d6581084a01f38ebaf28a4629d6e69e95071a03f
push id4489
push userraliiev@mozilla.com
push dateMon, 23 Feb 2015 15:17:55 +0000
treeherdermozilla-beta@fd7c3dc24146 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug
bugs1113062
milestone37.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 1113062 - patch 1 - PIFileImpl and FileImpl merged, r=smaug
dom/base/File.cpp
dom/base/File.h
dom/base/nsHostObjectProtocolHandler.cpp
--- a/dom/base/File.cpp
+++ b/dom/base/File.cpp
@@ -713,17 +713,17 @@ FileImpl::Slice(const Optional<int64_t>&
 
   return CreateSlice((uint64_t)start, (uint64_t)(end - start),
                      aContentType, aRv);
 }
 
 ////////////////////////////////////////////////////////////////////////////
 // FileImpl implementation
 
-NS_IMPL_ISUPPORTS(FileImpl, PIFileImpl)
+NS_IMPL_ISUPPORTS(FileImpl, FileImpl)
 
 ////////////////////////////////////////////////////////////////////////////
 // FileImplFile implementation
 
 NS_IMPL_ISUPPORTS_INHERITED0(FileImplFile, FileImpl)
 
 void
 FileImplBase::GetName(nsAString& aName)
--- a/dom/base/File.h
+++ b/dom/base/File.h
@@ -29,27 +29,19 @@
 #include "nsWrapperCache.h"
 #include "nsWeakReference.h"
 
 class nsDOMMultipartFile;
 class nsIFile;
 class nsIInputStream;
 class nsIClassInfo;
 
-#define PIFILEIMPL_IID \
-  { 0x218ee173, 0xf44f, 0x4d30, \
-    { 0xab, 0x0c, 0xd6, 0x66, 0xea, 0xc2, 0x84, 0x47 } }
-
-class PIFileImpl : public nsISupports
-{
-public:
-  NS_DECLARE_STATIC_IID_ACCESSOR(PIFILEIMPL_IID)
-};
-
-NS_DEFINE_STATIC_IID_ACCESSOR(PIFileImpl, PIFILEIMPL_IID)
+#define FILEIMPL_IID \
+  { 0xbccb3275, 0x6778, 0x4ac5, \
+    { 0xaf, 0x03, 0x90, 0xed, 0x37, 0xad, 0xdf, 0x5d } }
 
 namespace mozilla {
 namespace dom {
 
 namespace indexedDB {
 class FileInfo;
 };
 
@@ -225,19 +217,20 @@ private:
   // Note: we should not store any other state in this class!
   const nsRefPtr<FileImpl> mImpl;
 
   nsCOMPtr<nsISupports> mParent;
 };
 
 // This is the abstract class for any File backend. It must be nsISupports
 // because this class must be ref-counted and it has to work with IPC.
-class FileImpl : public PIFileImpl
+class FileImpl : public nsISupports
 {
 public:
+  NS_DECLARE_STATIC_IID_ACCESSOR(FILEIMPL_IID)
   NS_DECL_THREADSAFE_ISUPPORTS
 
   FileImpl() {}
 
   virtual void GetName(nsAString& aName) = 0;
 
   virtual nsresult GetPath(nsAString& aName) = 0;
 
@@ -301,16 +294,18 @@ public:
   {
     return false;
   }
 
 protected:
   virtual ~FileImpl() {}
 };
 
+NS_DEFINE_STATIC_IID_ACCESSOR(FileImpl, FILEIMPL_IID)
+
 class FileImplBase : public FileImpl
 {
 public:
   FileImplBase(const nsAString& aName, const nsAString& aContentType,
                uint64_t aLength, uint64_t aLastModifiedDate)
     : mIsFile(true)
     , mImmutable(false)
     , mContentType(aContentType)
--- a/dom/base/nsHostObjectProtocolHandler.cpp
+++ b/dom/base/nsHostObjectProtocolHandler.cpp
@@ -494,31 +494,30 @@ nsHostObjectProtocolHandler::NewChannel2
   uri->GetSpec(spec);
 
   DataInfo* info = GetDataInfo(spec);
 
   if (!info) {
     return NS_ERROR_DOM_BAD_URI;
   }
 
-  nsCOMPtr<PIFileImpl> blobImpl = do_QueryInterface(info->mObject);
-  if (!blobImpl) {
+  nsCOMPtr<FileImpl> blob = do_QueryInterface(info->mObject);
+  if (!blob) {
     return NS_ERROR_DOM_BAD_URI;
   }
 
 #ifdef DEBUG
   {
     nsCOMPtr<nsIURIWithPrincipal> uriPrinc = do_QueryInterface(uri);
     nsCOMPtr<nsIPrincipal> principal;
     uriPrinc->GetPrincipal(getter_AddRefs(principal));
     NS_ASSERTION(info->mPrincipal == principal, "Wrong principal!");
   }
 #endif
 
-  FileImpl* blob = static_cast<FileImpl*>(blobImpl.get());
   nsCOMPtr<nsIInputStream> stream;
   nsresult rv = blob->GetInternalStream(getter_AddRefs(stream));
   NS_ENSURE_SUCCESS(rv, rv);
 
   nsCOMPtr<nsIChannel> channel;
   // Bug 1087720 (and Bug 1099296):
   // Once all callsites have been updated to call NewChannel2() instead of NewChannel()
   // we should have a non-null loadInfo consistently. Until then we have to brach on the
@@ -610,22 +609,21 @@ nsFontTableProtocolHandler::GetScheme(ns
 
 nsresult
 NS_GetBlobForBlobURI(nsIURI* aURI, FileImpl** aBlob)
 {
   NS_ASSERTION(IsBlobURI(aURI), "Only call this with blob URIs");
 
   *aBlob = nullptr;
 
-  nsCOMPtr<PIFileImpl> blobImpl = do_QueryInterface(GetDataObject(aURI));
-  if (!blobImpl) {
+  nsCOMPtr<FileImpl> blob = do_QueryInterface(GetDataObject(aURI));
+  if (!blob) {
     return NS_ERROR_DOM_BAD_URI;
   }
 
-  nsRefPtr<FileImpl> blob = static_cast<FileImpl*>(blobImpl.get());
   blob.forget(aBlob);
   return NS_OK;
 }
 
 nsresult
 NS_GetStreamForBlobURI(nsIURI* aURI, nsIInputStream** aStream)
 {
   nsRefPtr<FileImpl> blobImpl;