blob: ea87bb15a53df23d01b6e5bc90766209c287b575 [file] [log] [blame]
// Copyright 2021 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef THIRD_PARTY_BLINK_RENDERER_PLATFORM_LOADER_FETCH_BACK_FORWARD_CACHE_LOADER_HELPER_H_
#define THIRD_PARTY_BLINK_RENDERER_PLATFORM_LOADER_FETCH_BACK_FORWARD_CACHE_LOADER_HELPER_H_
#include "third_party/blink/public/mojom/frame/back_forward_cache_controller.mojom-forward.h"
#include "third_party/blink/renderer/platform/heap/garbage_collected.h"
#include "third_party/blink/renderer/platform/heap/heap.h"
#include "third_party/blink/renderer/platform/heap/member.h"
#include "third_party/blink/renderer/platform/platform_export.h"
namespace blink {
// Helper class for in-flight network request support for back-forward cache.
class PLATFORM_EXPORT BackForwardCacheLoaderHelper
: public GarbageCollected<BackForwardCacheLoaderHelper> {
public:
// Evict the page from BackForwardCache. Should be called when handling an
// event which can't proceed if the page is in BackForwardCache and can't be
// easily deferred to handle later, for example network redirect handling.
virtual void EvictFromBackForwardCache(mojom::RendererEvictionReason reason) {
}
// Called when a network request buffered an additional `num_bytes` while the
// in back-forward cache. May be called multiple times.
virtual void DidBufferLoadWhileInBackForwardCache(size_t num_bytes) {}
// Returns true if we can still continue buffering data from in-flight network
// requests while in back-forward cache.
virtual bool CanContinueBufferingWhileInBackForwardCache() const {
return false;
}
virtual void Detach() {}
virtual void Trace(Visitor*) const {}
};
} // namespace blink
#endif // THIRD_PARTY_BLINK_RENDERER_PLATFORM_LOADER_FETCH_BACK_FORWARD_CACHE_LOADER_HELPER_H_