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

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

Issue 2637063002: Use MockResource as much as possibler in MemoryCacheCorrectnessTest (Closed)
Patch Set: override related style nits Created 3 years, 11 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 Apple Inc. All rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007 Apple Inc. All rights reserved.
6 6
7 This library is free software; you can redistribute it and/or 7 This library is free software; you can redistribute it and/or
8 modify it under the terms of the GNU Library General Public 8 modify it under the terms of the GNU Library General Public
9 License as published by the Free Software Foundation; either 9 License as published by the Free Software Foundation; either
10 version 2 of the License, or (at your option) any later version. 10 version 2 of the License, or (at your option) any later version.
(...skipping 22 matching lines...) Expand all
33 namespace blink { 33 namespace blink {
34 class FetchRequest; 34 class FetchRequest;
35 class RawResourceClient; 35 class RawResourceClient;
36 class ResourceFetcher; 36 class ResourceFetcher;
37 class SubstituteData; 37 class SubstituteData;
38 38
39 class CORE_EXPORT RawResource final : public Resource { 39 class CORE_EXPORT RawResource final : public Resource {
40 public: 40 public:
41 using ClientType = RawResourceClient; 41 using ClientType = RawResourceClient;
42 42
43 static Resource* fetchSynchronously(FetchRequest&, ResourceFetcher*); 43 static RawResource* fetchSynchronously(FetchRequest&, ResourceFetcher*);
44 static RawResource* fetch(FetchRequest&, ResourceFetcher*); 44 static RawResource* fetch(FetchRequest&, ResourceFetcher*);
45 static RawResource* fetchMainResource(FetchRequest&, 45 static RawResource* fetchMainResource(FetchRequest&,
46 ResourceFetcher*, 46 ResourceFetcher*,
47 const SubstituteData&); 47 const SubstituteData&);
48 static RawResource* fetchImport(FetchRequest&, ResourceFetcher*); 48 static RawResource* fetchImport(FetchRequest&, ResourceFetcher*);
49 static RawResource* fetchMedia(FetchRequest&, ResourceFetcher*); 49 static RawResource* fetchMedia(FetchRequest&, ResourceFetcher*);
50 static RawResource* fetchTextTrack(FetchRequest&, ResourceFetcher*); 50 static RawResource* fetchTextTrack(FetchRequest&, ResourceFetcher*);
51 static RawResource* fetchManifest(FetchRequest&, ResourceFetcher*); 51 static RawResource* fetchManifest(FetchRequest&, ResourceFetcher*);
52 52
53 // Exposed for testing 53 // Exposed for testing
54 static RawResource* create(const ResourceRequest& request, Type type) { 54 static RawResource* create(const ResourceRequest& request, Type type) {
55 return new RawResource(request, type, ResourceLoaderOptions()); 55 return new RawResource(request, type, ResourceLoaderOptions());
56 } 56 }
57 57
58 // FIXME: AssociatedURLLoader shouldn't be a DocumentThreadableLoader and 58 // FIXME: AssociatedURLLoader shouldn't be a DocumentThreadableLoader and
59 // therefore shouldn't use RawResource. However, it is, and it needs to be 59 // therefore shouldn't use RawResource. However, it is, and it needs to be
60 // able to defer loading. This can be fixed by splitting CORS preflighting out 60 // able to defer loading. This can be fixed by splitting CORS preflighting out
61 // of DocumentThreadableLoader. 61 // of DocumentThreadableLoader.
62 void setDefersLoading(bool); 62 void setDefersLoading(bool);
63 63
64 // Resource implementation
64 bool canReuse(const ResourceRequest&) const override; 65 bool canReuse(const ResourceRequest&) const override;
66 bool willFollowRedirect(const ResourceRequest&,
67 const ResourceResponse&) override;
65 68
66 private: 69 private:
67 class RawResourceFactory : public ResourceFactory { 70 class RawResourceFactory : public ResourceFactory {
68 public: 71 public:
69 explicit RawResourceFactory(Resource::Type type) : ResourceFactory(type) {} 72 explicit RawResourceFactory(Resource::Type type) : ResourceFactory(type) {}
70 73
71 Resource* create(const ResourceRequest& request, 74 Resource* create(const ResourceRequest& request,
72 const ResourceLoaderOptions& options, 75 const ResourceLoaderOptions& options,
73 const String& charset) const override { 76 const String& charset) const override {
74 return new RawResource(request, m_type, options); 77 return new RawResource(request, m_type, options);
75 } 78 }
76 }; 79 };
77 80
78 RawResource(const ResourceRequest&, Type, const ResourceLoaderOptions&); 81 RawResource(const ResourceRequest&, Type, const ResourceLoaderOptions&);
79 82
83 // Resource implementation
80 void didAddClient(ResourceClient*) override; 84 void didAddClient(ResourceClient*) override;
81 void appendData(const char*, size_t) override; 85 void appendData(const char*, size_t) override;
82
83 bool shouldIgnoreHTTPStatusCodeErrors() const override { 86 bool shouldIgnoreHTTPStatusCodeErrors() const override {
84 return !isLinkPreload(); 87 return !isLinkPreload();
85 } 88 }
86
87 bool willFollowRedirect(const ResourceRequest&,
88 const ResourceResponse&) override;
89 void willNotFollowRedirect() override; 89 void willNotFollowRedirect() override;
90 void responseReceived(const ResourceResponse&, 90 void responseReceived(const ResourceResponse&,
91 std::unique_ptr<WebDataConsumerHandle>) override; 91 std::unique_ptr<WebDataConsumerHandle>) override;
92 void setSerializedCachedMetadata(const char*, size_t) override; 92 void setSerializedCachedMetadata(const char*, size_t) override;
93 void didSendData(unsigned long long bytesSent, 93 void didSendData(unsigned long long bytesSent,
94 unsigned long long totalBytesToBeSent) override; 94 unsigned long long totalBytesToBeSent) override;
95 void didDownloadData(int) override; 95 void didDownloadData(int) override;
96 void reportResourceTimingToClients(const ResourceTimingInfo&) override; 96 void reportResourceTimingToClients(const ResourceTimingInfo&) override;
97 }; 97 };
98 98
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
187 DataReceived, 187 DataReceived,
188 DataDownloaded, 188 DataDownloaded,
189 NotifyFinished 189 NotifyFinished
190 }; 190 };
191 State m_state; 191 State m_state;
192 }; 192 };
193 193
194 } // namespace blink 194 } // namespace blink
195 195
196 #endif // RawResource_h 196 #endif // RawResource_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698