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

Unified Diff: Source/core/fetch/ScriptResource.h

Issue 1170503003: Remove resource type-specific fetching logic from ResourceFetcher (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Null-check Document::loader() before calling startPreload() Created 5 years, 6 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
« no previous file with comments | « Source/core/fetch/ResourceFetcherTest.cpp ('k') | Source/core/fetch/ScriptResource.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/fetch/ScriptResource.h
diff --git a/Source/core/fetch/ScriptResource.h b/Source/core/fetch/ScriptResource.h
index 29c08864f11f4bdb9508db469b2ebc24cac33de2..fd42d6810686c17f6a2da800641a5883c699804f 100644
--- a/Source/core/fetch/ScriptResource.h
+++ b/Source/core/fetch/ScriptResource.h
@@ -32,6 +32,7 @@
namespace blink {
+class FetchRequest;
class ScriptResource;
class CORE_EXPORT ScriptResourceClient : public ResourceClient {
@@ -46,10 +47,10 @@ public:
class CORE_EXPORT ScriptResource final : public TextResource {
public:
typedef ScriptResourceClient ClientType;
- static PassOwnPtrWillBeRawPtr<ScriptResource> create(const ResourceRequest& request, const String& charset)
- {
- return adoptPtrWillBeNoop(new ScriptResource(request, charset));
- }
+ static ResourcePtr<ScriptResource> fetch(FetchRequest&, ResourceFetcher*);
+
+ // Public for testing
+ ScriptResource(const ResourceRequest&, const String& charset);
virtual ~ScriptResource();
@@ -63,7 +64,16 @@ public:
bool mimeTypeAllowedByNosniff() const;
private:
- ScriptResource(const ResourceRequest&, const String& charset);
+ class ScriptResourceFactory : public ResourceFactory {
+ public:
+ ScriptResourceFactory()
+ : ResourceFactory(Resource::Script) { }
+
+ Resource* create(const ResourceRequest& request, const String& charset) const override
+ {
+ return new ScriptResource(request, charset);
+ }
+ };
AtomicString m_script;
};
« no previous file with comments | « Source/core/fetch/ResourceFetcherTest.cpp ('k') | Source/core/fetch/ScriptResource.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698