Fix for bug 633738 (quora.com bloats out of control (part 3)) - make nsHTMLEditor participate in CC, clear editor from SHistory if we're not storing anything else. r=jst, a=jst.

This commit is contained in:
Peter Van der Beken 2011-02-16 13:07:47 +01:00
Родитель 536c4678f1
Коммит c4aeb00d0d
7 изменённых файлов: 81 добавлений и 5 удалений

Просмотреть файл

@ -375,6 +375,15 @@ NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsXULElement,
nsStyledElement) nsStyledElement)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mPrototype, NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NATIVE_MEMBER(mPrototype,
nsXULPrototypeElement) nsXULPrototypeElement)
{
nsXULSlots* slots = static_cast<nsXULSlots*>(tmp->GetExistingSlots());
if (slots) {
NS_CYCLE_COLLECTION_NOTE_EDGE_NAME(cb, "mFrameLoader");
nsISupports *frameLoader =
static_cast<nsIFrameLoader*>(slots->mFrameLoader);
cb.NoteXPCOMChild(frameLoader);
}
}
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_ADDREF_INHERITED(nsXULElement, nsStyledElement) NS_IMPL_ADDREF_INHERITED(nsXULElement, nsStyledElement)

Просмотреть файл

@ -7081,6 +7081,11 @@ nsDocShell::RestoreFromHistory()
mContentViewer->Close(mSavingOldViewer ? mOSHE.get() : nsnull); mContentViewer->Close(mSavingOldViewer ? mOSHE.get() : nsnull);
viewer->SetPreviousViewer(mContentViewer); viewer->SetPreviousViewer(mContentViewer);
} }
if (mOSHE && (!mContentViewer || !mSavingOldViewer)) {
// We don't plan to save a viewer in mOSHE; tell it to drop
// any other state it's holding.
mOSHE->SyncPresentationState();
}
// Order the mContentViewer setup just like Embed does. // Order the mContentViewer setup just like Embed does.
mContentViewer = nsnull; mContentViewer = nsnull;
@ -7698,9 +7703,14 @@ nsDocShell::SetupNewViewer(nsIContentViewer * aNewViewer)
mContentViewer->Close(mSavingOldViewer ? mOSHE.get() : nsnull); mContentViewer->Close(mSavingOldViewer ? mOSHE.get() : nsnull);
aNewViewer->SetPreviousViewer(mContentViewer); aNewViewer->SetPreviousViewer(mContentViewer);
mContentViewer = nsnull;
} }
if (mOSHE && (!mContentViewer || !mSavingOldViewer)) {
// We don't plan to save a viewer in mOSHE; tell it to drop
// any other state it's holding.
mOSHE->SyncPresentationState();
}
mContentViewer = nsnull;
// Now that we're about to switch documents, forget all of our children. // Now that we're about to switch documents, forget all of our children.
// Note that we cached them as needed up in CaptureState above. // Note that we cached them as needed up in CaptureState above.

Просмотреть файл

@ -763,6 +763,7 @@ nsSHEntry::DropPresentationState()
mViewerBounds.SetRect(0, 0, 0, 0); mViewerBounds.SetRect(0, 0, 0, 0);
mChildShells.Clear(); mChildShells.Clear();
mRefreshURIList = nsnull; mRefreshURIList = nsnull;
mEditorData = nsnull;
} }
void void

Просмотреть файл

@ -44,7 +44,13 @@
* XPCOM cruft * XPCOM cruft
*******************************************************************/ *******************************************************************/
NS_IMPL_ISUPPORTS1(TypeInState, nsISelectionListener) NS_IMPL_CYCLE_COLLECTION_1(TypeInState, mLastSelectionContainer)
NS_IMPL_CYCLE_COLLECTING_ADDREF(TypeInState)
NS_IMPL_CYCLE_COLLECTING_RELEASE(TypeInState)
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(TypeInState)
NS_INTERFACE_MAP_ENTRY(nsISelectionListener)
NS_INTERFACE_MAP_ENTRY(nsISupports)
NS_INTERFACE_MAP_END
/******************************************************************** /********************************************************************
* public methods * public methods

Просмотреть файл

@ -45,6 +45,7 @@
#include "nsEditProperty.h" #include "nsEditProperty.h"
#include "nsString.h" #include "nsString.h"
#include "nsTArray.h" #include "nsTArray.h"
#include "nsCycleCollectionParticipant.h"
struct PropItem struct PropItem
{ {
@ -61,7 +62,8 @@ class TypeInState : public nsISelectionListener
{ {
public: public:
NS_DECL_ISUPPORTS NS_DECL_CYCLE_COLLECTING_ISUPPORTS
NS_DECL_CYCLE_COLLECTION_CLASS(TypeInState)
TypeInState(); TypeInState();
void Reset(); void Reset();

Просмотреть файл

@ -230,10 +230,57 @@ nsHTMLEditor::Shutdown()
NS_IF_RELEASE(sRangeHelper); NS_IF_RELEASE(sRangeHelper);
} }
NS_IMPL_CYCLE_COLLECTION_CLASS(nsHTMLEditor)
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsHTMLEditor, nsPlaintextEditor)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTypeInState)
NS_IMPL_CYCLE_COLLECTION_UNLINK_NSCOMPTR(mTextServices)
tmp->HideResizers();
tmp->HideGrabber();
tmp->HideInlineTableEditingUI();
NS_IMPL_CYCLE_COLLECTION_UNLINK_END
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsHTMLEditor, nsPlaintextEditor)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTypeInState)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTextServices)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTopLeftHandle)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTopHandle)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mTopRightHandle)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mLeftHandle)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mRightHandle)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mBottomLeftHandle)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mBottomHandle)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mBottomRightHandle)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mActivatedHandle)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mResizingShadow)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mResizingInfo)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mResizedObject)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mMouseMotionListenerP)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mSelectionListenerP)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mResizeEventListenerP)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMARRAY(objectResizeEventListeners)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mAbsolutelyPositionedObject)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mGrabber)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mPositioningShadow)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mInlineEditedCell)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mAddColumnBeforeButton)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mRemoveColumnButton)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mAddColumnAfterButton)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mAddRowBeforeButton)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mRemoveRowButton)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_NSCOMPTR(mAddRowAfterButton)
NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END
NS_IMPL_ADDREF_INHERITED(nsHTMLEditor, nsEditor) NS_IMPL_ADDREF_INHERITED(nsHTMLEditor, nsEditor)
NS_IMPL_RELEASE_INHERITED(nsHTMLEditor, nsEditor) NS_IMPL_RELEASE_INHERITED(nsHTMLEditor, nsEditor)
NS_INTERFACE_MAP_BEGIN(nsHTMLEditor) NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsHTMLEditor)
NS_INTERFACE_MAP_ENTRY(nsIHTMLEditor) NS_INTERFACE_MAP_ENTRY(nsIHTMLEditor)
NS_INTERFACE_MAP_ENTRY(nsIHTMLEditor_MOZILLA_2_0_BRANCH) NS_INTERFACE_MAP_ENTRY(nsIHTMLEditor_MOZILLA_2_0_BRANCH)
NS_INTERFACE_MAP_ENTRY(nsIHTMLObjectResizer) NS_INTERFACE_MAP_ENTRY(nsIHTMLObjectResizer)

Просмотреть файл

@ -141,6 +141,7 @@ public:
//NOTE macro used is for classes that inherit from //NOTE macro used is for classes that inherit from
// another class. Only the base class should use NS_DECL_ISUPPORTS // another class. Only the base class should use NS_DECL_ISUPPORTS
NS_DECL_ISUPPORTS_INHERITED NS_DECL_ISUPPORTS_INHERITED
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsHTMLEditor, nsPlaintextEditor)
nsHTMLEditor(); nsHTMLEditor();