зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1839916 - Update BrowsingContextWebProgress to hold BounceTrackingState objects. r=bvandersloot,nika
Differential Revision: https://phabricator.services.mozilla.com/D182342
This commit is contained in:
Родитель
f611ad5d39
Коммит
73968fc9fa
|
@ -3,6 +3,8 @@
|
|||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#include "BrowsingContextWebProgress.h"
|
||||
#include "mozilla/AlreadyAddRefed.h"
|
||||
#include "mozilla/BounceTrackingState.h"
|
||||
#include "mozilla/dom/CanonicalBrowsingContext.h"
|
||||
#include "mozilla/ErrorNames.h"
|
||||
#include "mozilla/Logging.h"
|
||||
|
@ -12,6 +14,7 @@
|
|||
#include "nsPrintfCString.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "xptinfo.h"
|
||||
#include "mozilla/RefPtr.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
@ -164,6 +167,14 @@ void BrowsingContextWebProgress::ContextReplaced(
|
|||
mCurrentBrowsingContext = aNewContext;
|
||||
}
|
||||
|
||||
already_AddRefed<BounceTrackingState>
|
||||
BrowsingContextWebProgress::GetBounceTrackingState() {
|
||||
if (!mBounceTrackingState) {
|
||||
mBounceTrackingState = BounceTrackingState::GetOrCreate(this);
|
||||
}
|
||||
return do_AddRef(mBounceTrackingState);
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////
|
||||
// nsIWebProgressListener
|
||||
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
#include "nsTObserverArray.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "mozilla/BounceTrackingState.h"
|
||||
|
||||
namespace mozilla::dom {
|
||||
|
||||
|
@ -61,6 +62,8 @@ class BrowsingContextWebProgress final : public nsIWebProgress,
|
|||
|
||||
void SetLoadType(uint32_t aLoadType) { mLoadType = aLoadType; }
|
||||
|
||||
already_AddRefed<BounceTrackingState> GetBounceTrackingState();
|
||||
|
||||
private:
|
||||
virtual ~BrowsingContextWebProgress();
|
||||
|
||||
|
@ -91,6 +94,8 @@ class BrowsingContextWebProgress final : public nsIWebProgress,
|
|||
// discarded while loading a document to avoid noise caused by process
|
||||
// switches.
|
||||
bool mIsLoadingDocument = false;
|
||||
|
||||
RefPtr<mozilla::BounceTrackingState> mBounceTrackingState;
|
||||
};
|
||||
|
||||
} // namespace mozilla::dom
|
||||
|
|
|
@ -3034,6 +3034,14 @@ CanonicalBrowsingContext::GetMostRecentLoadingSessionHistoryEntry() {
|
|||
return entry.forget();
|
||||
}
|
||||
|
||||
already_AddRefed<BounceTrackingState>
|
||||
CanonicalBrowsingContext::GetBounceTrackingState() {
|
||||
if (!mWebProgress) {
|
||||
return nullptr;
|
||||
}
|
||||
return mWebProgress->GetBounceTrackingState();
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_CLASS(CanonicalBrowsingContext)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(CanonicalBrowsingContext,
|
||||
|
|
|
@ -37,6 +37,7 @@ class nsITimer;
|
|||
|
||||
namespace mozilla {
|
||||
enum class CallState;
|
||||
class BounceTrackingState;
|
||||
|
||||
namespace embedding {
|
||||
class PrintData;
|
||||
|
@ -381,6 +382,8 @@ class CanonicalBrowsingContext final : public BrowsingContext {
|
|||
|
||||
already_AddRefed<nsISHEntry> GetMostRecentLoadingSessionHistoryEntry();
|
||||
|
||||
already_AddRefed<BounceTrackingState> GetBounceTrackingState();
|
||||
|
||||
protected:
|
||||
// Called when the browsing context is being discarded.
|
||||
void CanonicalDiscard();
|
||||
|
|
Загрузка…
Ссылка в новой задаче