Bug 1484944 - Remove nsSHEnumerator. r=qdot

--HG--
extra : rebase_source : 3f52fd7bf780e53631919a0f2e6925345b714517
This commit is contained in:
Nicholas Nethercote 2018-08-21 19:52:19 +10:00
parent 9ddc263762
commit 5ad84b56e2
3 changed files with 0 additions and 95 deletions

View file

@ -7,7 +7,6 @@
interface nsISHEntry;
interface nsISHistoryListener;
interface nsISimpleEnumerator;
/**
* An interface to the primary properties of the Session History
@ -132,29 +131,6 @@ interface nsISHistory: nsISupports
*/
void removeSHistoryListener(in nsISHistoryListener aListener);
/**
* Called to obtain a enumerator for all the documents stored in
* session history. The enumerator object thus returned by this method
* can be traversed using nsISimpleEnumerator.
*
* @note To access individual history entries of the enumerator, perform the
* following steps:
* 1) Call nsISHistory->GetSHistoryEnumerator() to obtain handle
* the nsISimpleEnumerator object.
* 2) Use nsISimpleEnumerator->GetNext() on the object returned
* by step #1 to obtain handle to the next object in the list.
* The object returned by this step is of type nsISupports.
* 3) Perform a QueryInterface on the object returned by step #2
* to nsISHEntry.
* 4) Use nsISHEntry to access properties of each history entry.
*
* @see nsISimpleEnumerator
* @see nsISHEntry
* @see QueryInterface()
* @see do_QueryInterface()
*/
readonly attribute nsISimpleEnumerator SHistoryEnumerator;
void reloadCurrentEntry();
/**

View file

@ -2110,55 +2110,3 @@ nsSHistory::SetRootDocShell(nsIDocShell* aDocShell)
return NS_OK;
}
NS_IMETHODIMP
nsSHistory::GetSHistoryEnumerator(nsISimpleEnumerator** aEnumerator)
{
NS_ENSURE_ARG_POINTER(aEnumerator);
RefPtr<nsSHEnumerator> iterator = new nsSHEnumerator(this);
iterator.forget(aEnumerator);
return NS_OK;
}
nsSHEnumerator::nsSHEnumerator(nsSHistory* aSHistory) : mIndex(-1)
{
mSHistory = aSHistory;
}
nsSHEnumerator::~nsSHEnumerator()
{
mSHistory = nullptr;
}
NS_IMPL_ISUPPORTS(nsSHEnumerator, nsISimpleEnumerator)
NS_IMETHODIMP
nsSHEnumerator::HasMoreElements(bool* aReturn)
{
int32_t cnt;
*aReturn = false;
mSHistory->GetCount(&cnt);
if (mIndex >= -1 && mIndex < (cnt - 1)) {
*aReturn = true;
}
return NS_OK;
}
NS_IMETHODIMP
nsSHEnumerator::GetNext(nsISupports** aItem)
{
NS_ENSURE_ARG_POINTER(aItem);
int32_t cnt = 0;
nsresult result = NS_ERROR_FAILURE;
mSHistory->GetCount(&cnt);
if (mIndex < (cnt - 1)) {
mIndex++;
nsCOMPtr<nsISHEntry> hEntry;
result = mSHistory->GetEntryAtIndex(mIndex, false, getter_AddRefs(hEntry));
if (hEntry) {
result = CallQueryInterface(hEntry, aItem);
}
}
return result;
}

View file

@ -22,7 +22,6 @@
class nsIDocShell;
class nsDocShell;
class nsSHEnumerator;
class nsSHistoryObserver;
class nsISHEntry;
class nsISHTransaction;
@ -133,7 +132,6 @@ public:
private:
virtual ~nsSHistory();
friend class nsSHEnumerator;
friend class nsSHistoryObserver;
nsresult GetTransactionAtIndex(int32_t aIndex, nsISHTransaction** aResult);
@ -192,23 +190,6 @@ private:
static int32_t sHistoryMaxTotalViewers;
};
class nsSHEnumerator : public nsISimpleEnumerator
{
public:
NS_DECL_ISUPPORTS
NS_DECL_NSISIMPLEENUMERATOR
explicit nsSHEnumerator(nsSHistory* aHistory);
protected:
friend class nsSHistory;
virtual ~nsSHEnumerator();
private:
int32_t mIndex;
nsSHistory* mSHistory;
};
inline nsISupports*
ToSupports(nsSHistory* aObj)
{