/src/mozilla-central/docshell/shistory/nsSHEntryShared.h
Line | Count | Source (jump to first uncovered line) |
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 "nsRect.h" |
16 | | #include "nsString.h" |
17 | | #include "nsStubMutationObserver.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 nsStubMutationObserver |
40 | | { |
41 | | public: |
42 | | static void EnsureHistoryTracker(); |
43 | | static void Shutdown(); |
44 | | |
45 | | nsSHEntryShared(); |
46 | | |
47 | | NS_DECL_ISUPPORTS |
48 | | NS_DECL_NSIBFCACHEENTRY |
49 | | |
50 | | // The nsIMutationObserver bits we actually care about. |
51 | | NS_DECL_NSIMUTATIONOBSERVER_CHARACTERDATACHANGED |
52 | | NS_DECL_NSIMUTATIONOBSERVER_ATTRIBUTECHANGED |
53 | | NS_DECL_NSIMUTATIONOBSERVER_CONTENTAPPENDED |
54 | | NS_DECL_NSIMUTATIONOBSERVER_CONTENTINSERTED |
55 | | NS_DECL_NSIMUTATIONOBSERVER_CONTENTREMOVED |
56 | | |
57 | 0 | nsExpirationState *GetExpirationState() { return &mExpirationState; } |
58 | | |
59 | | private: |
60 | | ~nsSHEntryShared(); |
61 | | |
62 | | friend class nsSHEntry; |
63 | | |
64 | | static already_AddRefed<nsSHEntryShared> Duplicate(nsSHEntryShared* aEntry); |
65 | | |
66 | | void RemoveFromExpirationTracker(); |
67 | | void SyncPresentationState(); |
68 | | void DropPresentationState(); |
69 | | |
70 | | nsresult SetContentViewer(nsIContentViewer* aViewer); |
71 | | |
72 | | // See nsISHEntry.idl for an explanation of these members. |
73 | | |
74 | | // These members are copied by nsSHEntryShared::Duplicate(). If you add a |
75 | | // member here, be sure to update the Duplicate() implementation. |
76 | | nsID mDocShellID; |
77 | | nsCOMArray<nsIDocShellTreeItem> mChildShells; |
78 | | nsCOMPtr<nsIPrincipal> mTriggeringPrincipal; |
79 | | nsCOMPtr<nsIPrincipal> mPrincipalToInherit; |
80 | | nsCString mContentType; |
81 | | |
82 | | uint32_t mCacheKey; |
83 | | uint32_t mLastTouched; |
84 | | |
85 | | // These members aren't copied by nsSHEntryShared::Duplicate() because |
86 | | // they're specific to a particular content viewer. |
87 | | uint64_t mID; |
88 | | nsCOMPtr<nsIContentViewer> mContentViewer; |
89 | | nsCOMPtr<nsIDocument> mDocument; |
90 | | nsCOMPtr<nsILayoutHistoryState> mLayoutHistoryState; |
91 | | nsCOMPtr<nsISupports> mWindowState; |
92 | | nsIntRect mViewerBounds; |
93 | | nsCOMPtr<nsIMutableArray> mRefreshURIList; |
94 | | nsExpirationState mExpirationState; |
95 | | nsAutoPtr<nsDocShellEditorData> mEditorData; |
96 | | nsWeakPtr mSHistory; |
97 | | |
98 | | bool mIsFrameNavigation; |
99 | | bool mSaveLayoutState; |
100 | | bool mSticky; |
101 | | bool mDynamicallyCreated; |
102 | | |
103 | | // This flag is about necko cache, not bfcache. |
104 | | bool mExpired; |
105 | | }; |
106 | | |
107 | | #endif |