Line data Source code
1 : /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 : /* vim: set ts=8 sts=2 et sw=2 tw=80: */
3 : /* This Source Code Form is subject to the terms of the Mozilla Public
4 : * License, v. 2.0. If a copy of the MPL was not distributed with this
5 : * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 :
7 : #ifndef nsSHEntryShared_h__
8 : #define nsSHEntryShared_h__
9 :
10 : #include "nsAutoPtr.h"
11 : #include "nsCOMArray.h"
12 : #include "nsCOMPtr.h"
13 : #include "nsExpirationTracker.h"
14 : #include "nsIBFCacheEntry.h"
15 : #include "nsIMutationObserver.h"
16 : #include "nsRect.h"
17 : #include "nsString.h"
18 : #include "nsWeakPtr.h"
19 :
20 : #include "mozilla/Attributes.h"
21 :
22 : class nsSHEntry;
23 : class nsISHEntry;
24 : class nsIDocument;
25 : class nsIContentViewer;
26 : class nsIDocShellTreeItem;
27 : class nsILayoutHistoryState;
28 : class nsDocShellEditorData;
29 : class nsIMutableArray;
30 :
31 : // A document may have multiple SHEntries, either due to hash navigations or
32 : // calls to history.pushState. SHEntries corresponding to the same document
33 : // share many members; in particular, they share state related to the
34 : // back/forward cache.
35 : //
36 : // nsSHEntryShared is the vehicle for this sharing.
37 : class nsSHEntryShared final
38 : : public nsIBFCacheEntry
39 : , public nsIMutationObserver
40 : {
41 : public:
42 : static void EnsureHistoryTracker();
43 : static void Shutdown();
44 :
45 : nsSHEntryShared();
46 :
47 : NS_DECL_ISUPPORTS
48 : NS_DECL_NSIMUTATIONOBSERVER
49 : NS_DECL_NSIBFCACHEENTRY
50 :
51 0 : nsExpirationState *GetExpirationState() { return &mExpirationState; }
52 :
53 : private:
54 : ~nsSHEntryShared();
55 :
56 : friend class nsSHEntry;
57 :
58 : static already_AddRefed<nsSHEntryShared> Duplicate(nsSHEntryShared* aEntry);
59 :
60 : void RemoveFromExpirationTracker();
61 : nsresult SyncPresentationState();
62 : void DropPresentationState();
63 :
64 : nsresult SetContentViewer(nsIContentViewer* aViewer);
65 :
66 : // See nsISHEntry.idl for an explanation of these members.
67 :
68 : // These members are copied by nsSHEntryShared::Duplicate(). If you add a
69 : // member here, be sure to update the Duplicate() implementation.
70 : nsID mDocShellID;
71 : nsCOMArray<nsIDocShellTreeItem> mChildShells;
72 : nsCOMPtr<nsIPrincipal> mTriggeringPrincipal;
73 : nsCOMPtr<nsIPrincipal> mPrincipalToInherit;
74 : nsCString mContentType;
75 :
76 : nsCOMPtr<nsISupports> mCacheKey;
77 : uint32_t mLastTouched;
78 :
79 : // These members aren't copied by nsSHEntryShared::Duplicate() because
80 : // they're specific to a particular content viewer.
81 : uint64_t mID;
82 : nsCOMPtr<nsIContentViewer> mContentViewer;
83 : nsCOMPtr<nsIDocument> mDocument;
84 : nsCOMPtr<nsILayoutHistoryState> mLayoutHistoryState;
85 : nsCOMPtr<nsISupports> mWindowState;
86 : nsIntRect mViewerBounds;
87 : nsCOMPtr<nsIMutableArray> mRefreshURIList;
88 : nsExpirationState mExpirationState;
89 : nsAutoPtr<nsDocShellEditorData> mEditorData;
90 : nsWeakPtr mSHistory;
91 :
92 : bool mIsFrameNavigation;
93 : bool mSaveLayoutState;
94 : bool mSticky;
95 : bool mDynamicallyCreated;
96 :
97 : // This flag is about necko cache, not bfcache.
98 : bool mExpired;
99 : };
100 :
101 : #endif
|