Bug 1113062 - Part 1: PIFileImpl and FileImpl merged. r=smaug, a=sledru
authorAndrea Marchesini <amarchesini@mozilla.com>
Sun, 11 Jan 2015 21:34:31 +0000
changeset 242851 23f5b373f676
parent 242850 18f7174682d3
child 242852 f203230f49f4
push id4321
push userryanvm@gmail.com
push date2015-01-14 15:04 +0000
treeherdermozilla-beta@a78eb4dd84f0 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssmaug, sledru
bugs1113062
milestone36.0
Bug 1113062 - Part 1: PIFileImpl and FileImpl merged. r=smaug, a=sledru
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;
   rv = NS_NewInputStreamChannel(getter_AddRefs(channel),
                                 uri,
                                 stream,
@@ -597,22 +596,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;