Bug 1618292 - Make ScriptLoadRequest derive and use PreloaderBase to support new preload as speculative load feature, r=smaug
Depends on D67483 Differential Revision: https://phabricator.services.mozilla.com/D67481
This commit is contained in:
@@ -12,12 +12,14 @@
|
||||
#include "mozilla/dom/SRIMetadata.h"
|
||||
#include "mozilla/LinkedList.h"
|
||||
#include "mozilla/Maybe.h"
|
||||
#include "mozilla/PreloaderBase.h"
|
||||
#include "mozilla/Utf8.h" // mozilla::Utf8Unit
|
||||
#include "mozilla/Variant.h"
|
||||
#include "mozilla/Vector.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsCycleCollectionParticipant.h"
|
||||
#include "nsIScriptElement.h"
|
||||
#include "ScriptKind.h"
|
||||
|
||||
class nsICacheInfoChannel;
|
||||
|
||||
@@ -27,8 +29,6 @@ namespace dom {
|
||||
class ModuleLoadRequest;
|
||||
class ScriptLoadRequestList;
|
||||
|
||||
enum class ScriptKind { eClassic, eModule };
|
||||
|
||||
/*
|
||||
* Some options used when fetching script resources. This only loosely
|
||||
* corresponds to HTML's "script fetch options".
|
||||
@@ -61,7 +61,7 @@ class ScriptFetchOptions {
|
||||
*/
|
||||
|
||||
class ScriptLoadRequest
|
||||
: public nsISupports,
|
||||
: public PreloaderBase,
|
||||
private mozilla::LinkedListElement<ScriptLoadRequest> {
|
||||
typedef LinkedListElement<ScriptLoadRequest> super;
|
||||
|
||||
@@ -80,6 +80,10 @@ class ScriptLoadRequest
|
||||
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
||||
NS_DECL_CYCLE_COLLECTION_SCRIPT_HOLDER_CLASS(ScriptLoadRequest)
|
||||
|
||||
// PreloaderBase
|
||||
static void PrioritizeAsPreload(nsIChannel* aChannel);
|
||||
virtual void PrioritizeAsPreload() override;
|
||||
|
||||
bool IsModuleRequest() const { return mKind == ScriptKind::eModule; }
|
||||
|
||||
ModuleLoadRequest* AsModuleRequest();
|
||||
|
||||
Reference in New Issue
Block a user