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

Side by Side Diff: third_party/WebKit/Source/core/fetch/Resource.h

Issue 2399473002: Remove Resource::create() to ensure proper subclasses of Resource are created (Closed)
Patch Set: Rebase Created 4 years, 2 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de) 2 Copyright (C) 1998 Lars Knoll (knoll@mpi-hd.mpg.de)
3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org> 3 Copyright (C) 2001 Dirk Mueller <mueller@kde.org>
4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com) 4 Copyright (C) 2006 Samuel Weinig (sam.weinig@gmail.com)
5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Apple Inc. All
6 rights reserved. 6 rights reserved.
7 7
8 This library is free software; you can redistribute it and/or 8 This library is free software; you can redistribute it and/or
9 modify it under the terms of the GNU Library General Public 9 modify it under the terms of the GNU Library General Public
10 License as published by the Free Software Foundation; either 10 License as published by the Free Software Foundation; either
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 DecodeError 91 DecodeError
92 }; 92 };
93 93
94 // Whether a resource client for a preload should mark the preload as 94 // Whether a resource client for a preload should mark the preload as
95 // referenced. 95 // referenced.
96 enum PreloadReferencePolicy { 96 enum PreloadReferencePolicy {
97 MarkAsReferenced, 97 MarkAsReferenced,
98 DontMarkAsReferenced, 98 DontMarkAsReferenced,
99 }; 99 };
100 100
101 // Exposed for testing.
102 static Resource* create(
103 const ResourceRequest& request,
104 Type type,
105 const ResourceLoaderOptions& options = ResourceLoaderOptions()) {
106 return new Resource(request, type, options);
107 }
108 virtual ~Resource(); 101 virtual ~Resource();
109 102
110 DECLARE_VIRTUAL_TRACE(); 103 DECLARE_VIRTUAL_TRACE();
111 104
112 virtual void setEncoding(const String&) {} 105 virtual void setEncoding(const String&) {}
113 virtual String encoding() const { return String(); } 106 virtual String encoding() const { return String(); }
114 virtual void appendData(const char*, size_t); 107 virtual void appendData(const char*, size_t);
115 virtual void error(const ResourceError&); 108 virtual void error(const ResourceError&);
116 virtual void setCORSFailed() {} 109 virtual void setCORSFailed() {}
117 110
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
450 }; 443 };
451 444
452 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ 445 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \
453 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \ 446 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \
454 resource->getType() == Resource::typeName, \ 447 resource->getType() == Resource::typeName, \
455 resource.getType() == Resource::typeName); 448 resource.getType() == Resource::typeName);
456 449
457 } // namespace blink 450 } // namespace blink
458 451
459 #endif 452 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/MemoryCacheTest.cpp ('k') | third_party/WebKit/Source/core/fetch/ResourceFetcherTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698