зеркало из https://github.com/mozilla/gecko-dev.git
Bug 492376 - Optimize Docshell for memory usage; r=bz
This commit is contained in:
Родитель
6a70c37113
Коммит
bbcea38eb6
|
@ -682,6 +682,18 @@ DispatchPings(nsIContent *content, nsIURI *referrer)
|
|||
// Note: operator new zeros our memory
|
||||
nsDocShell::nsDocShell():
|
||||
nsDocLoader(),
|
||||
mDefaultScrollbarPref(Scrollbar_Auto, Scrollbar_Auto),
|
||||
mTreeOwner(nsnull),
|
||||
mChromeEventHandler(nsnull),
|
||||
mCharsetReloadState(eCharsetReloadInit),
|
||||
mChildOffset(0),
|
||||
mBusyFlags(BUSY_FLAGS_NONE),
|
||||
mAppType(nsIDocShell::APP_TYPE_UNKNOWN),
|
||||
mMarginWidth(-1),
|
||||
mMarginHeight(-1),
|
||||
mItemType(typeContent),
|
||||
mPreviousTransIndex(-1),
|
||||
mLoadedTransIndex(-1),
|
||||
mAllowSubframes(PR_TRUE),
|
||||
mAllowPlugins(PR_TRUE),
|
||||
mAllowJavascript(PR_TRUE),
|
||||
|
@ -702,19 +714,7 @@ nsDocShell::nsDocShell():
|
|||
mIsBeingDestroyed(PR_FALSE),
|
||||
mIsExecutingOnLoadHandler(PR_FALSE),
|
||||
mIsPrintingOrPP(PR_FALSE),
|
||||
mSavingOldViewer(PR_FALSE),
|
||||
mAppType(nsIDocShell::APP_TYPE_UNKNOWN),
|
||||
mChildOffset(0),
|
||||
mBusyFlags(BUSY_FLAGS_NONE),
|
||||
mMarginWidth(-1),
|
||||
mMarginHeight(-1),
|
||||
mItemType(typeContent),
|
||||
mDefaultScrollbarPref(Scrollbar_Auto, Scrollbar_Auto),
|
||||
mPreviousTransIndex(-1),
|
||||
mLoadedTransIndex(-1),
|
||||
mTreeOwner(nsnull),
|
||||
mChromeEventHandler(nsnull),
|
||||
mCharsetReloadState(eCharsetReloadInit)
|
||||
mSavingOldViewer(PR_FALSE)
|
||||
#ifdef DEBUG
|
||||
, mInEnsureScriptEnv(PR_FALSE)
|
||||
#endif
|
||||
|
@ -7494,11 +7494,11 @@ public:
|
|||
mURI(aURI),
|
||||
mReferrer(aReferrer),
|
||||
mOwner(aOwner),
|
||||
mFlags(aFlags),
|
||||
mPostData(aPostData),
|
||||
mHeadersData(aHeadersData),
|
||||
mLoadType(aLoadType),
|
||||
mSHEntry(aSHEntry),
|
||||
mFlags(aFlags),
|
||||
mLoadType(aLoadType),
|
||||
mFirstParty(aFirstParty)
|
||||
{
|
||||
// Make sure to keep null things null as needed
|
||||
|
@ -7515,20 +7515,20 @@ public:
|
|||
}
|
||||
|
||||
private:
|
||||
nsRefPtr<nsDocShell> mDocShell;
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
nsCOMPtr<nsIURI> mReferrer;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
PRUint32 mFlags;
|
||||
|
||||
// Use IDL strings so .get() returns null by default
|
||||
nsXPIDLString mWindowTarget;
|
||||
nsXPIDLCString mTypeHint;
|
||||
|
||||
nsRefPtr<nsDocShell> mDocShell;
|
||||
nsCOMPtr<nsIURI> mURI;
|
||||
nsCOMPtr<nsIURI> mReferrer;
|
||||
nsCOMPtr<nsISupports> mOwner;
|
||||
nsCOMPtr<nsIInputStream> mPostData;
|
||||
nsCOMPtr<nsIInputStream> mHeadersData;
|
||||
PRUint32 mLoadType;
|
||||
nsCOMPtr<nsISHEntry> mSHEntry;
|
||||
PRUint32 mFlags;
|
||||
PRUint32 mLoadType;
|
||||
PRBool mFirstParty;
|
||||
};
|
||||
|
||||
|
@ -9880,7 +9880,7 @@ nsDocShell::GetRootScrollableView(nsIScrollableView ** aOutScrollView)
|
|||
class nsDebugAutoBoolTrueSetter
|
||||
{
|
||||
public:
|
||||
nsDebugAutoBoolTrueSetter(PRBool *aBool)
|
||||
nsDebugAutoBoolTrueSetter(PRPackedBool *aBool)
|
||||
: mBool(aBool)
|
||||
{
|
||||
*mBool = PR_TRUE;
|
||||
|
@ -9891,7 +9891,7 @@ public:
|
|||
*mBool = PR_FALSE;
|
||||
}
|
||||
protected:
|
||||
PRBool *mBool;
|
||||
PRPackedBool *mBool;
|
||||
};
|
||||
#endif
|
||||
|
||||
|
|
|
@ -629,6 +629,98 @@ protected:
|
|||
nsDocShell *mDocShell;
|
||||
};
|
||||
|
||||
// hash of session storages, keyed by domain
|
||||
nsInterfaceHashtable<nsCStringHashKey, nsIDOMStorageObsolete> mStorages;
|
||||
nsIntRect mBounds; // Dimensions of the docshell
|
||||
nsString mName;
|
||||
nsString mTitle;
|
||||
/**
|
||||
* Content-Type Hint of the most-recently initiated load. Used for
|
||||
* session history entries.
|
||||
*/
|
||||
nsCString mContentTypeHint;
|
||||
nsIntPoint mDefaultScrollbarPref; // persistent across doc loads
|
||||
|
||||
nsCOMPtr<nsISupportsArray> mRefreshURIList;
|
||||
nsCOMPtr<nsISupportsArray> mSavedRefreshURIList;
|
||||
nsRefPtr<nsDSURIContentListener> mContentListener;
|
||||
nsCOMPtr<nsIContentViewer> mContentViewer;
|
||||
nsCOMPtr<nsIDocumentCharsetInfo> mDocumentCharsetInfo;
|
||||
nsCOMPtr<nsIWidget> mParentWidget;
|
||||
nsCOMPtr<nsIPrefBranch> mPrefs;
|
||||
|
||||
// mCurrentURI should be marked immutable on set if possible.
|
||||
nsCOMPtr<nsIURI> mCurrentURI;
|
||||
nsCOMPtr<nsIURI> mReferrerURI;
|
||||
nsCOMPtr<nsIScriptGlobalObject> mScriptGlobal;
|
||||
nsCOMPtr<nsISHistory> mSessionHistory;
|
||||
nsCOMPtr<nsIGlobalHistory2> mGlobalHistory;
|
||||
nsCOMPtr<nsIWebBrowserFind> mFind;
|
||||
nsCOMPtr<nsICommandManager> mCommandManager;
|
||||
// Reference to the SHEntry for this docshell until the page is destroyed.
|
||||
// Somebody give me better name
|
||||
nsCOMPtr<nsISHEntry> mOSHE;
|
||||
// Reference to the SHEntry for this docshell until the page is loaded
|
||||
// Somebody give me better name
|
||||
nsCOMPtr<nsISHEntry> mLSHE;
|
||||
|
||||
// Holds a weak pointer to a RestorePresentationEvent object if any that
|
||||
// holds a weak pointer back to us. We use this pointer to possibly revoke
|
||||
// the event whenever necessary.
|
||||
nsRevocableEventPtr<RestorePresentationEvent> mRestorePresentationEvent;
|
||||
|
||||
// Editor data, if this document is designMode or contentEditable.
|
||||
nsAutoPtr<nsDocShellEditorData> mEditorData;
|
||||
|
||||
// Transferable hooks/callbacks
|
||||
nsCOMPtr<nsIClipboardDragDropHookList> mTransferableHookData;
|
||||
|
||||
// Secure browser UI object
|
||||
nsCOMPtr<nsISecureBrowserUI> mSecurityUI;
|
||||
|
||||
// Suspends/resumes channels based on the URI classifier.
|
||||
nsRefPtr<nsClassifierCallback> mClassifier;
|
||||
|
||||
// The URI we're currently loading. This is only relevant during the
|
||||
// firing of a pagehide/unload. The caller of FirePageHideNotification()
|
||||
// is responsible for setting it and unsetting it. It may be null if the
|
||||
// pagehide/unload is happening for some reason other than just loading a
|
||||
// new URI.
|
||||
nsCOMPtr<nsIURI> mLoadingURI;
|
||||
|
||||
// WEAK REFERENCES BELOW HERE.
|
||||
// Note these are intentionally not addrefd. Doing so will create a cycle.
|
||||
// For that reasons don't use nsCOMPtr.
|
||||
|
||||
nsIDocShellTreeOwner * mTreeOwner; // Weak Reference
|
||||
nsPIDOMEventTarget * mChromeEventHandler; //Weak Reference
|
||||
|
||||
eCharsetReloadState mCharsetReloadState;
|
||||
|
||||
// Offset in the parent's child list.
|
||||
// XXXmats the line above is bogus, it's the offset in the parent's
|
||||
// child list at the time this docshell was added to it,
|
||||
// see nsDocShell::AddChild(). It isn't updated after that so if children
|
||||
// with lower indices are removed this offset is no longer valid to be used
|
||||
// as an index into the parent's child list (see bug 162283). It MUST not
|
||||
// be used for that purpose. It's used as an index to get/add history
|
||||
// entries into nsIDocShellHistory, although I very much doubt that it
|
||||
// can be correct for that purpose as well...
|
||||
// Try not to use it, we should get rid of it.
|
||||
PRUint32 mChildOffset;
|
||||
PRUint32 mBusyFlags;
|
||||
PRUint32 mAppType;
|
||||
PRUint32 mLoadType;
|
||||
|
||||
PRInt32 mMarginWidth;
|
||||
PRInt32 mMarginHeight;
|
||||
PRInt32 mItemType;
|
||||
|
||||
// Index into the SHTransaction list, indicating the previous and current
|
||||
// transaction at the time that this DocShell begins to load
|
||||
PRInt32 mPreviousTransIndex;
|
||||
PRInt32 mLoadedTransIndex;
|
||||
|
||||
PRPackedBool mAllowSubframes;
|
||||
PRPackedBool mAllowPlugins;
|
||||
PRPackedBool mAllowJavascript;
|
||||
|
@ -667,104 +759,8 @@ protected:
|
|||
// presentation of the page, and to SetupNewViewer() that the old viewer
|
||||
// should be passed a SHEntry to save itself into.
|
||||
PRPackedBool mSavingOldViewer;
|
||||
|
||||
PRUint32 mAppType;
|
||||
|
||||
// Offset in the parent's child list.
|
||||
// XXXmats the line above is bogus, it's the offset in the parent's
|
||||
// child list at the time this docshell was added to it,
|
||||
// see nsDocShell::AddChild(). It isn't updated after that so if children
|
||||
// with lower indices are removed this offset is no longer valid to be used
|
||||
// as an index into the parent's child list (see bug 162283). It MUST not
|
||||
// be used for that purpose. It's used as an index to get/add history
|
||||
// entries into nsIDocShellHistory, although I very much doubt that it
|
||||
// can be correct for that purpose as well...
|
||||
// Try not to use it, we should get rid of it.
|
||||
PRUint32 mChildOffset;
|
||||
|
||||
PRUint32 mBusyFlags;
|
||||
|
||||
PRInt32 mMarginWidth;
|
||||
PRInt32 mMarginHeight;
|
||||
PRInt32 mItemType;
|
||||
|
||||
PRUint32 mLoadType;
|
||||
|
||||
nsString mName;
|
||||
nsString mTitle;
|
||||
/**
|
||||
* Content-Type Hint of the most-recently initiated load. Used for
|
||||
* session history entries.
|
||||
*/
|
||||
nsCString mContentTypeHint;
|
||||
nsCOMPtr<nsISupportsArray> mRefreshURIList;
|
||||
nsCOMPtr<nsISupportsArray> mSavedRefreshURIList;
|
||||
nsRefPtr<nsDSURIContentListener> mContentListener;
|
||||
nsIntRect mBounds; // Dimensions of the docshell
|
||||
nsCOMPtr<nsIContentViewer> mContentViewer;
|
||||
nsCOMPtr<nsIDocumentCharsetInfo> mDocumentCharsetInfo;
|
||||
nsCOMPtr<nsIWidget> mParentWidget;
|
||||
nsCOMPtr<nsIPrefBranch> mPrefs;
|
||||
|
||||
// mCurrentURI should be marked immutable on set if possible.
|
||||
nsCOMPtr<nsIURI> mCurrentURI;
|
||||
nsCOMPtr<nsIURI> mReferrerURI;
|
||||
nsCOMPtr<nsIScriptGlobalObject> mScriptGlobal;
|
||||
nsCOMPtr<nsISHistory> mSessionHistory;
|
||||
nsCOMPtr<nsIGlobalHistory2> mGlobalHistory;
|
||||
nsCOMPtr<nsIWebBrowserFind> mFind;
|
||||
nsIntPoint mDefaultScrollbarPref; // persistent across doc loads
|
||||
// Reference to the SHEntry for this docshell until the page is destroyed.
|
||||
// Somebody give me better name
|
||||
nsCOMPtr<nsISHEntry> mOSHE;
|
||||
// Reference to the SHEntry for this docshell until the page is loaded
|
||||
// Somebody give me better name
|
||||
nsCOMPtr<nsISHEntry> mLSHE;
|
||||
|
||||
// Holds a weak pointer to a RestorePresentationEvent object if any that
|
||||
// holds a weak pointer back to us. We use this pointer to possibly revoke
|
||||
// the event whenever necessary.
|
||||
nsRevocableEventPtr<RestorePresentationEvent> mRestorePresentationEvent;
|
||||
|
||||
// hash of session storages, keyed by domain
|
||||
nsInterfaceHashtable<nsCStringHashKey, nsIDOMStorageObsolete> mStorages;
|
||||
|
||||
// Index into the SHTransaction list, indicating the previous and current
|
||||
// transaction at the time that this DocShell begins to load
|
||||
PRInt32 mPreviousTransIndex;
|
||||
PRInt32 mLoadedTransIndex;
|
||||
|
||||
// Editor data, if this document is designMode or contentEditable.
|
||||
nsAutoPtr<nsDocShellEditorData> mEditorData;
|
||||
|
||||
// Transferable hooks/callbacks
|
||||
nsCOMPtr<nsIClipboardDragDropHookList> mTransferableHookData;
|
||||
|
||||
// Secure browser UI object
|
||||
nsCOMPtr<nsISecureBrowserUI> mSecurityUI;
|
||||
|
||||
// Suspends/resumes channels based on the URI classifier.
|
||||
nsRefPtr<nsClassifierCallback> mClassifier;
|
||||
|
||||
// The URI we're currently loading. This is only relevant during the
|
||||
// firing of a pagehide/unload. The caller of FirePageHideNotification()
|
||||
// is responsible for setting it and unsetting it. It may be null if the
|
||||
// pagehide/unload is happening for some reason other than just loading a
|
||||
// new URI.
|
||||
nsCOMPtr<nsIURI> mLoadingURI;
|
||||
|
||||
// WEAK REFERENCES BELOW HERE.
|
||||
// Note these are intentionally not addrefd. Doing so will create a cycle.
|
||||
// For that reasons don't use nsCOMPtr.
|
||||
|
||||
nsIDocShellTreeOwner * mTreeOwner; // Weak Reference
|
||||
nsPIDOMEventTarget * mChromeEventHandler; //Weak Reference
|
||||
|
||||
eCharsetReloadState mCharsetReloadState;
|
||||
nsCOMPtr<nsICommandManager> mCommandManager;
|
||||
|
||||
#ifdef DEBUG
|
||||
PRBool mInEnsureScriptEnv;
|
||||
PRPackedBool mInEnsureScriptEnv;
|
||||
#endif
|
||||
|
||||
static nsIURIFixup *sURIFixup;
|
||||
|
|
Загрузка…
Ссылка в новой задаче