michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: #ifndef nsSHEntryShared_h__ michael@0: #define nsSHEntryShared_h__ michael@0: michael@0: #include "nsCOMPtr.h" michael@0: #include "nsAutoPtr.h" michael@0: #include "nsCOMArray.h" michael@0: #include "nsIBFCacheEntry.h" michael@0: #include "nsIMutationObserver.h" michael@0: #include "nsExpirationTracker.h" michael@0: #include "nsRect.h" michael@0: #include "nsString.h" michael@0: #include "mozilla/Attributes.h" michael@0: michael@0: class nsSHEntry; michael@0: class nsISHEntry; michael@0: class nsIDocument; michael@0: class nsIContentViewer; michael@0: class nsIDocShellTreeItem; michael@0: class nsILayoutHistoryState; michael@0: class nsDocShellEditorData; michael@0: class nsISupportsArray; michael@0: michael@0: // A document may have multiple SHEntries, either due to hash navigations or michael@0: // calls to history.pushState. SHEntries corresponding to the same document michael@0: // share many members; in particular, they share state related to the michael@0: // back/forward cache. michael@0: // michael@0: // nsSHEntryShared is the vehicle for this sharing. michael@0: class nsSHEntryShared MOZ_FINAL : public nsIBFCacheEntry, michael@0: public nsIMutationObserver michael@0: { michael@0: public: michael@0: static void Startup(); michael@0: static void Shutdown(); michael@0: michael@0: nsSHEntryShared(); michael@0: ~nsSHEntryShared(); michael@0: michael@0: NS_DECL_ISUPPORTS michael@0: NS_DECL_NSIMUTATIONOBSERVER michael@0: NS_DECL_NSIBFCACHEENTRY michael@0: michael@0: private: michael@0: friend class nsSHEntry; michael@0: michael@0: friend class HistoryTracker; michael@0: friend class nsExpirationTracker; michael@0: nsExpirationState *GetExpirationState() { return &mExpirationState; } michael@0: michael@0: static already_AddRefed Duplicate(nsSHEntryShared *aEntry); michael@0: michael@0: void RemoveFromExpirationTracker(); michael@0: void Expire(); michael@0: nsresult SyncPresentationState(); michael@0: void DropPresentationState(); michael@0: michael@0: nsresult SetContentViewer(nsIContentViewer *aViewer); michael@0: michael@0: // See nsISHEntry.idl for an explanation of these members. michael@0: michael@0: // These members are copied by nsSHEntryShared::Duplicate(). If you add a michael@0: // member here, be sure to update the Duplicate() implementation. michael@0: uint64_t mDocShellID; michael@0: nsCOMArray mChildShells; michael@0: nsCOMPtr mOwner; michael@0: nsCString mContentType; michael@0: bool mIsFrameNavigation; michael@0: bool mSaveLayoutState; michael@0: bool mSticky; michael@0: bool mDynamicallyCreated; michael@0: nsCOMPtr mCacheKey; michael@0: uint32_t mLastTouched; michael@0: michael@0: // These members aren't copied by nsSHEntryShared::Duplicate() because michael@0: // they're specific to a particular content viewer. michael@0: uint64_t mID; michael@0: nsCOMPtr mContentViewer; michael@0: nsCOMPtr mDocument; michael@0: nsCOMPtr mLayoutHistoryState; michael@0: bool mExpired; michael@0: nsCOMPtr mWindowState; michael@0: nsIntRect mViewerBounds; michael@0: nsCOMPtr mRefreshURIList; michael@0: nsExpirationState mExpirationState; michael@0: nsAutoPtr mEditorData; michael@0: }; michael@0: michael@0: #endif