1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/docshell/shistory/src/nsSHEntryShared.h Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,92 @@ 1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.6 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.7 + 1.8 +#ifndef nsSHEntryShared_h__ 1.9 +#define nsSHEntryShared_h__ 1.10 + 1.11 +#include "nsCOMPtr.h" 1.12 +#include "nsAutoPtr.h" 1.13 +#include "nsCOMArray.h" 1.14 +#include "nsIBFCacheEntry.h" 1.15 +#include "nsIMutationObserver.h" 1.16 +#include "nsExpirationTracker.h" 1.17 +#include "nsRect.h" 1.18 +#include "nsString.h" 1.19 +#include "mozilla/Attributes.h" 1.20 + 1.21 +class nsSHEntry; 1.22 +class nsISHEntry; 1.23 +class nsIDocument; 1.24 +class nsIContentViewer; 1.25 +class nsIDocShellTreeItem; 1.26 +class nsILayoutHistoryState; 1.27 +class nsDocShellEditorData; 1.28 +class nsISupportsArray; 1.29 + 1.30 +// A document may have multiple SHEntries, either due to hash navigations or 1.31 +// calls to history.pushState. SHEntries corresponding to the same document 1.32 +// share many members; in particular, they share state related to the 1.33 +// back/forward cache. 1.34 +// 1.35 +// nsSHEntryShared is the vehicle for this sharing. 1.36 +class nsSHEntryShared MOZ_FINAL : public nsIBFCacheEntry, 1.37 + public nsIMutationObserver 1.38 +{ 1.39 + public: 1.40 + static void Startup(); 1.41 + static void Shutdown(); 1.42 + 1.43 + nsSHEntryShared(); 1.44 + ~nsSHEntryShared(); 1.45 + 1.46 + NS_DECL_ISUPPORTS 1.47 + NS_DECL_NSIMUTATIONOBSERVER 1.48 + NS_DECL_NSIBFCACHEENTRY 1.49 + 1.50 + private: 1.51 + friend class nsSHEntry; 1.52 + 1.53 + friend class HistoryTracker; 1.54 + friend class nsExpirationTracker<nsSHEntryShared, 3>; 1.55 + nsExpirationState *GetExpirationState() { return &mExpirationState; } 1.56 + 1.57 + static already_AddRefed<nsSHEntryShared> Duplicate(nsSHEntryShared *aEntry); 1.58 + 1.59 + void RemoveFromExpirationTracker(); 1.60 + void Expire(); 1.61 + nsresult SyncPresentationState(); 1.62 + void DropPresentationState(); 1.63 + 1.64 + nsresult SetContentViewer(nsIContentViewer *aViewer); 1.65 + 1.66 + // See nsISHEntry.idl for an explanation of these members. 1.67 + 1.68 + // These members are copied by nsSHEntryShared::Duplicate(). If you add a 1.69 + // member here, be sure to update the Duplicate() implementation. 1.70 + uint64_t mDocShellID; 1.71 + nsCOMArray<nsIDocShellTreeItem> mChildShells; 1.72 + nsCOMPtr<nsISupports> mOwner; 1.73 + nsCString mContentType; 1.74 + bool mIsFrameNavigation; 1.75 + bool mSaveLayoutState; 1.76 + bool mSticky; 1.77 + bool mDynamicallyCreated; 1.78 + nsCOMPtr<nsISupports> mCacheKey; 1.79 + uint32_t mLastTouched; 1.80 + 1.81 + // These members aren't copied by nsSHEntryShared::Duplicate() because 1.82 + // they're specific to a particular content viewer. 1.83 + uint64_t mID; 1.84 + nsCOMPtr<nsIContentViewer> mContentViewer; 1.85 + nsCOMPtr<nsIDocument> mDocument; 1.86 + nsCOMPtr<nsILayoutHistoryState> mLayoutHistoryState; 1.87 + bool mExpired; 1.88 + nsCOMPtr<nsISupports> mWindowState; 1.89 + nsIntRect mViewerBounds; 1.90 + nsCOMPtr<nsISupportsArray> mRefreshURIList; 1.91 + nsExpirationState mExpirationState; 1.92 + nsAutoPtr<nsDocShellEditorData> mEditorData; 1.93 +}; 1.94 + 1.95 +#endif