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