зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1539716. Remove nsIHashable. r=froydnj
It's dead code. Differential Revision: https://phabricator.services.mozilla.com/D25190 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
29bb054a50
Коммит
92f7b5dd5e
|
@ -71,9 +71,6 @@ class nsPermissionManager final : public nsIPermissionManager,
|
|||
|
||||
/**
|
||||
* PermissionKey is the key used by PermissionHashKey hash table.
|
||||
*
|
||||
* NOTE: It could be implementing nsIHashable but there is no reason to worry
|
||||
* with XPCOM interfaces while we don't need to.
|
||||
*/
|
||||
class PermissionKey {
|
||||
public:
|
||||
|
|
|
@ -74,7 +74,6 @@
|
|||
#include "nsIException.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIHashable.h"
|
||||
#include "nsIINIParser.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIInterfaceRequestor.h"
|
||||
|
|
|
@ -7,7 +7,6 @@
|
|||
XPIDL_SOURCES += [
|
||||
'nsIArray.idl',
|
||||
'nsIArrayExtensions.idl',
|
||||
'nsIHashable.idl',
|
||||
'nsIINIParser.idl',
|
||||
'nsIMutableArray.idl',
|
||||
'nsIObserver.idl',
|
||||
|
|
|
@ -9,7 +9,6 @@
|
|||
|
||||
#include "nsID.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIHashable.h"
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "PLDHashTable.h"
|
||||
|
@ -62,7 +61,6 @@ inline uint32_t HashString(const nsACString& aStr) {
|
|||
* nsDepCharHashKey
|
||||
* nsCharPtrHashKey
|
||||
* nsUnicharPtrHashKey
|
||||
* nsHashableHashKey
|
||||
* nsGenericHashKey
|
||||
*/
|
||||
|
||||
|
@ -587,47 +585,6 @@ class nsUnicharPtrHashKey : public PLDHashEntryHdr {
|
|||
const char16_t* mKey;
|
||||
};
|
||||
|
||||
/**
|
||||
* Hashtable key class to use with objects that support nsIHashable
|
||||
*/
|
||||
class nsHashableHashKey : public PLDHashEntryHdr {
|
||||
public:
|
||||
typedef nsIHashable* KeyType;
|
||||
typedef const nsIHashable* KeyTypePointer;
|
||||
|
||||
explicit nsHashableHashKey(const nsIHashable* aKey)
|
||||
: mKey(const_cast<nsIHashable*>(aKey)) {}
|
||||
nsHashableHashKey(nsHashableHashKey&& aOther)
|
||||
: PLDHashEntryHdr(std::move(aOther)), mKey(std::move(aOther.mKey)) {}
|
||||
~nsHashableHashKey() {}
|
||||
|
||||
nsIHashable* GetKey() const { return mKey; }
|
||||
|
||||
bool KeyEquals(const nsIHashable* aKey) const {
|
||||
bool eq;
|
||||
if (NS_SUCCEEDED(mKey->Equals(const_cast<nsIHashable*>(aKey), &eq))) {
|
||||
return eq;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static const nsIHashable* KeyToPointer(nsIHashable* aKey) { return aKey; }
|
||||
static PLDHashNumber HashKey(const nsIHashable* aKey) {
|
||||
uint32_t code = 8888; // magic number if GetHashCode fails :-(
|
||||
#ifdef DEBUG
|
||||
nsresult rv =
|
||||
#endif
|
||||
const_cast<nsIHashable*>(aKey)->GetHashCode(&code);
|
||||
NS_ASSERTION(NS_SUCCEEDED(rv), "GetHashCode should not throw!");
|
||||
return code;
|
||||
}
|
||||
|
||||
enum { ALLOW_MEMMOVE = true };
|
||||
|
||||
private:
|
||||
nsCOMPtr<nsIHashable> mKey;
|
||||
};
|
||||
|
||||
namespace mozilla {
|
||||
|
||||
template <typename T>
|
||||
|
|
|
@ -1,24 +0,0 @@
|
|||
/* This Source Code Form is subject to the terms of the Mozilla Public
|
||||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
/**
|
||||
* Represents an object that can be stored in a hashtable.
|
||||
*/
|
||||
[scriptable, uuid(17e595fa-b57a-4933-bd0f-b1812e8ab188)]
|
||||
interface nsIHashable : nsISupports
|
||||
{
|
||||
/**
|
||||
* Is this object the equivalent of the other object?
|
||||
*/
|
||||
boolean equals(in nsIHashable aOther);
|
||||
|
||||
/**
|
||||
* A generated hashcode for this object. Objects that are equivalent
|
||||
* must have the same hash code. Getting this property should never
|
||||
* throw an exception!
|
||||
*/
|
||||
readonly attribute unsigned long hashCode;
|
||||
};
|
|
@ -230,9 +230,9 @@ nsLocalFile::nsLocalFile(const nsACString& aFilePath) : mCachedStat() {
|
|||
nsLocalFile::nsLocalFile(const nsLocalFile& aOther) : mPath(aOther.mPath) {}
|
||||
|
||||
#ifdef MOZ_WIDGET_COCOA
|
||||
NS_IMPL_ISUPPORTS(nsLocalFile, nsILocalFileMac, nsIFile, nsIHashable)
|
||||
NS_IMPL_ISUPPORTS(nsLocalFile, nsILocalFileMac, nsIFile)
|
||||
#else
|
||||
NS_IMPL_ISUPPORTS(nsLocalFile, nsIFile, nsIHashable)
|
||||
NS_IMPL_ISUPPORTS(nsLocalFile, nsIFile)
|
||||
#endif
|
||||
|
||||
nsresult nsLocalFile::nsLocalFileConstructor(nsISupports* aOuter,
|
||||
|
@ -2104,25 +2104,6 @@ nsresult nsLocalFile::GetTarget(nsAString& aResult) {
|
|||
GET_UCS(GetNativeTarget, aResult);
|
||||
}
|
||||
|
||||
// nsIHashable
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::Equals(nsIHashable* aOther, bool* aResult) {
|
||||
nsCOMPtr<nsIFile> otherFile(do_QueryInterface(aOther));
|
||||
if (!otherFile) {
|
||||
*aResult = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return Equals(otherFile, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::GetHashCode(uint32_t* aResult) {
|
||||
*aResult = HashString(mPath);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult NS_NewLocalFile(const nsAString& aPath, bool aFollowLinks,
|
||||
nsIFile** aResult) {
|
||||
nsAutoCString buf;
|
||||
|
|
|
@ -18,7 +18,6 @@
|
|||
#include "nscore.h"
|
||||
#include "nsString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIHashable.h"
|
||||
#include "nsIClassInfoImpl.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#ifdef MOZ_WIDGET_COCOA
|
||||
|
@ -84,8 +83,7 @@ class nsLocalFile final
|
|||
#else
|
||||
: public nsIFile
|
||||
#endif
|
||||
,
|
||||
public nsIHashable {
|
||||
{
|
||||
public:
|
||||
NS_DEFINE_STATIC_CID_ACCESSOR(NS_LOCAL_FILE_CID)
|
||||
|
||||
|
@ -100,7 +98,6 @@ class nsLocalFile final
|
|||
#ifdef MOZ_WIDGET_COCOA
|
||||
NS_DECL_NSILOCALFILEMAC
|
||||
#endif
|
||||
NS_DECL_NSIHASHABLE
|
||||
|
||||
private:
|
||||
nsLocalFile(const nsLocalFile& aOther);
|
||||
|
|
|
@ -791,7 +791,7 @@ nsresult nsLocalFile::nsLocalFileConstructor(nsISupports* aOuter,
|
|||
// nsLocalFile::nsISupports
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
NS_IMPL_ISUPPORTS(nsLocalFile, nsIFile, nsILocalFileWin, nsIHashable)
|
||||
NS_IMPL_ISUPPORTS(nsLocalFile, nsIFile, nsILocalFileWin)
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
// nsLocalFile <private>
|
||||
|
@ -3287,29 +3287,6 @@ void nsLocalFile::EnsureShortPath() {
|
|||
}
|
||||
}
|
||||
|
||||
// nsIHashable
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::Equals(nsIHashable* aOther, bool* aResult) {
|
||||
nsCOMPtr<nsIFile> otherfile(do_QueryInterface(aOther));
|
||||
if (!otherfile) {
|
||||
*aResult = false;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
return Equals(otherfile, aResult);
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsLocalFile::GetHashCode(uint32_t* aResult) {
|
||||
// In order for short and long path names to hash to the same value we
|
||||
// always hash on the short pathname.
|
||||
EnsureShortPath();
|
||||
|
||||
*aResult = HashString(mShortWorkingPath);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(nsDriveEnumerator, nsSimpleEnumerator,
|
||||
nsIDirectoryEnumerator)
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
#include "nsIFile.h"
|
||||
#include "nsIFactory.h"
|
||||
#include "nsILocalFileWin.h"
|
||||
#include "nsIHashable.h"
|
||||
#include "nsIClassInfoImpl.h"
|
||||
#include "prio.h"
|
||||
|
||||
|
@ -25,7 +24,7 @@
|
|||
|
||||
#include <sys/stat.h>
|
||||
|
||||
class nsLocalFile final : public nsILocalFileWin, public nsIHashable {
|
||||
class nsLocalFile final : public nsILocalFileWin {
|
||||
public:
|
||||
NS_DEFINE_STATIC_CID_ACCESSOR(NS_LOCAL_FILE_CID)
|
||||
|
||||
|
@ -44,9 +43,6 @@ class nsLocalFile final : public nsILocalFileWin, public nsIHashable {
|
|||
// nsILocalFileWin interface
|
||||
NS_DECL_NSILOCALFILEWIN
|
||||
|
||||
// nsIHashable interface
|
||||
NS_DECL_NSIHASHABLE
|
||||
|
||||
public:
|
||||
// Removes registry command handler parameters, quotes, and expands
|
||||
// environment strings.
|
||||
|
|
Загрузка…
Ссылка в новой задаче