Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(926)

Unified Diff: Source/core/html/parser/HTMLResourcePreloader.h

Issue 1108303002: HTMLPreloadScanner unit tests (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: nit Created 5 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/core/html/parser/HTMLResourcePreloader.h
diff --git a/Source/core/html/parser/HTMLResourcePreloader.h b/Source/core/html/parser/HTMLResourcePreloader.h
index 316decf81c47f5b1cc0360d034dce7528fc3ba3d..a7a47980fb5d93fd65ba2a392c97bed46ab8218e 100644
--- a/Source/core/html/parser/HTMLResourcePreloader.h
+++ b/Source/core/html/parser/HTMLResourcePreloader.h
@@ -28,81 +28,25 @@
#include "core/fetch/FetchRequest.h"
#include "core/fetch/Resource.h"
+#include "core/html/parser/PreloadRequest.h"
+#include "core/html/parser/ResourcePreloader.h"
#include "wtf/CurrentTime.h"
#include "wtf/text/TextPosition.h"
namespace blink {
-class Document;
-
-class PreloadRequest {
-public:
- static PassOwnPtr<PreloadRequest> create(const String& initiatorName, const TextPosition& initiatorPosition, const String& resourceURL, const KURL& baseURL, Resource::Type resourceType, const FetchRequest::ResourceWidth& resourceWidth = FetchRequest::ResourceWidth())
- {
- return adoptPtr(new PreloadRequest(initiatorName, initiatorPosition, resourceURL, baseURL, resourceType, resourceWidth));
- }
-
- bool isSafeToSendToAnotherThread() const;
-
- FetchRequest resourceRequest(Document*);
-
- const String& charset() const { return m_charset; }
- double discoveryTime() const { return m_discoveryTime; }
- void setDefer(FetchRequest::DeferOption defer) { m_defer = defer; }
- void setCharset(const String& charset) { m_charset = charset.isolatedCopy(); }
- void setCrossOriginEnabled(StoredCredentials allowCredentials)
- {
- m_isCORSEnabled = true;
- m_allowCredentials = allowCredentials;
- }
-
- Resource::Type resourceType() const { return m_resourceType; }
-
-private:
- PreloadRequest(const String& initiatorName, const TextPosition& initiatorPosition, const String& resourceURL, const KURL& baseURL, Resource::Type resourceType, const FetchRequest::ResourceWidth& resourceWidth)
- : m_initiatorName(initiatorName)
- , m_initiatorPosition(initiatorPosition)
- , m_resourceURL(resourceURL.isolatedCopy())
- , m_baseURL(baseURL.copy())
- , m_resourceType(resourceType)
- , m_isCORSEnabled(false)
- , m_allowCredentials(DoNotAllowStoredCredentials)
- , m_discoveryTime(monotonicallyIncreasingTime())
- , m_defer(FetchRequest::NoDefer)
- , m_resourceWidth(resourceWidth)
- {
- }
-
- KURL completeURL(Document*);
-
- String m_initiatorName;
- TextPosition m_initiatorPosition;
- String m_resourceURL;
- KURL m_baseURL;
- String m_charset;
- Resource::Type m_resourceType;
- bool m_isCORSEnabled;
- StoredCredentials m_allowCredentials;
- double m_discoveryTime;
- FetchRequest::DeferOption m_defer;
- FetchRequest::ResourceWidth m_resourceWidth;
-};
-
-typedef Vector<OwnPtr<PreloadRequest>> PreloadRequestStream;
-
-class HTMLResourcePreloader final : public NoBaseWillBeGarbageCollected<HTMLResourcePreloader> {
+class HTMLResourcePreloader final : public NoBaseWillBeGarbageCollected<HTMLResourcePreloader>, public ResourcePreloader {
WTF_MAKE_NONCOPYABLE(HTMLResourcePreloader); WTF_MAKE_FAST_ALLOCATED_WILL_BE_REMOVED(HTMLResourcePreloader);
public:
static PassOwnPtrWillBeRawPtr<HTMLResourcePreloader> create(Document&);
DECLARE_TRACE();
- void takeAndPreload(PreloadRequestStream&);
+protected:
+ virtual void preload(PassOwnPtr<PreloadRequest>) override;
private:
explicit HTMLResourcePreloader(Document&);
- void preload(PassOwnPtr<PreloadRequest>);
-
RawPtrWillBeMember<Document> m_document;
};
« no previous file with comments | « Source/core/html/parser/HTMLPreloadScannerTest.cpp ('k') | Source/core/html/parser/HTMLResourcePreloader.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698