diff options
Diffstat (limited to 'Source/WebCore/loader/cache/CachedScript.h')
-rw-r--r-- | Source/WebCore/loader/cache/CachedScript.h | 55 |
1 files changed, 31 insertions, 24 deletions
diff --git a/Source/WebCore/loader/cache/CachedScript.h b/Source/WebCore/loader/cache/CachedScript.h index 80b073c2a..f8898d378 100644 --- a/Source/WebCore/loader/cache/CachedScript.h +++ b/Source/WebCore/loader/cache/CachedScript.h @@ -23,44 +23,51 @@ pages from the web. It has a memory cache for these objects. */ -#ifndef CachedScript_h -#define CachedScript_h +#pragma once #include "CachedResource.h" namespace WebCore { - class CachedResourceLoader; - class TextResourceDecoder; +class TextResourceDecoder; - class CachedScript final : public CachedResource { - public: - CachedScript(const ResourceRequest&, const String& charset); - virtual ~CachedScript(); +class CachedScript final : public CachedResource { +public: + CachedScript(CachedResourceRequest&&, SessionID); + virtual ~CachedScript(); - const String& script(); + StringView script(); + unsigned scriptHash(); - String mimeType() const; + String mimeType() const; #if ENABLE(NOSNIFF) - bool mimeTypeAllowedByNosniff() const; + bool mimeTypeAllowedByNosniff() const; #endif - private: - virtual PurgePriority purgePriority() const override { return PurgeLast; } - virtual bool mayTryReplaceEncodedData() const override { return true; } +private: + bool mayTryReplaceEncodedData() const final { return true; } - virtual bool shouldIgnoreHTTPStatusCodeErrors() const override; + bool shouldIgnoreHTTPStatusCodeErrors() const final; - virtual void setEncoding(const String&) override; - virtual String encoding() const override; - virtual void finishLoading(ResourceBuffer*) override; + void setEncoding(const String&) final; + String encoding() const final; + const TextResourceDecoder* textResourceDecoder() const final { return m_decoder.get(); } + void finishLoading(SharedBuffer*) final; - virtual void destroyDecodedData() override; + void destroyDecodedData() final; - String m_script; - RefPtr<TextResourceDecoder> m_decoder; - }; -} + void setBodyDataFrom(const CachedResource&) final; -#endif + String m_script; + unsigned m_scriptHash { 0 }; + + enum DecodingState { NeverDecoded, DataAndDecodedStringHaveSameBytes, DataAndDecodedStringHaveDifferentBytes }; + DecodingState m_decodingState { NeverDecoded }; + + RefPtr<TextResourceDecoder> m_decoder; +}; + +} // namespace WebCore + +SPECIALIZE_TYPE_TRAITS_CACHED_RESOURCE(CachedScript, CachedResource::Script) |