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

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

Issue 1852663002: Oilpan: Remove WillBe types (part 9) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 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 21 matching lines...) Expand all
32 namespace blink { 32 namespace blink {
33 class FetchRequest; 33 class FetchRequest;
34 class RawResourceClient; 34 class RawResourceClient;
35 class ResourceFetcher; 35 class ResourceFetcher;
36 class SubstituteData; 36 class SubstituteData;
37 37
38 class CORE_EXPORT RawResource final : public Resource { 38 class CORE_EXPORT RawResource final : public Resource {
39 public: 39 public:
40 using ClientType = RawResourceClient; 40 using ClientType = RawResourceClient;
41 41
42 static PassRefPtrWillBeRawPtr<Resource> fetchSynchronously(FetchRequest&, Re sourceFetcher*); 42 static RawPtr<Resource> fetchSynchronously(FetchRequest&, ResourceFetcher*);
43 static PassRefPtrWillBeRawPtr<RawResource> fetch(FetchRequest&, ResourceFetc her*); 43 static RawPtr<RawResource> fetch(FetchRequest&, ResourceFetcher*);
44 static PassRefPtrWillBeRawPtr<RawResource> fetchMainResource(FetchRequest&, ResourceFetcher*, const SubstituteData&); 44 static RawPtr<RawResource> fetchMainResource(FetchRequest&, ResourceFetcher* , const SubstituteData&);
45 static PassRefPtrWillBeRawPtr<RawResource> fetchImport(FetchRequest&, Resour ceFetcher*); 45 static RawPtr<RawResource> fetchImport(FetchRequest&, ResourceFetcher*);
46 static PassRefPtrWillBeRawPtr<RawResource> fetchMedia(FetchRequest&, Resourc eFetcher*); 46 static RawPtr<RawResource> fetchMedia(FetchRequest&, ResourceFetcher*);
47 static PassRefPtrWillBeRawPtr<RawResource> fetchTextTrack(FetchRequest&, Res ourceFetcher*); 47 static RawPtr<RawResource> fetchTextTrack(FetchRequest&, ResourceFetcher*);
48 static PassRefPtrWillBeRawPtr<RawResource> fetchManifest(FetchRequest&, Reso urceFetcher*); 48 static RawPtr<RawResource> fetchManifest(FetchRequest&, ResourceFetcher*);
49 49
50 // Exposed for testing 50 // Exposed for testing
51 static RefPtrWillBeRawPtr<RawResource> create(const ResourceRequest& request , Type type) 51 static RawPtr<RawResource> create(const ResourceRequest& request, Type type)
52 { 52 {
53 return adoptRefWillBeNoop(new RawResource(request, type, ResourceLoaderO ptions())); 53 return new RawResource(request, type, ResourceLoaderOptions());
54 } 54 }
55 55
56 // FIXME: AssociatedURLLoader shouldn't be a DocumentThreadableLoader and th erefore shouldn't 56 // FIXME: AssociatedURLLoader shouldn't be a DocumentThreadableLoader and th erefore shouldn't
57 // use RawResource. However, it is, and it needs to be able to defer loading . 57 // use RawResource. However, it is, and it needs to be able to defer loading .
58 // This can be fixed by splitting CORS preflighting out of DocumentThreacabl eLoader. 58 // This can be fixed by splitting CORS preflighting out of DocumentThreacabl eLoader.
59 void setDefersLoading(bool); 59 void setDefersLoading(bool);
60 60
61 bool canReuse(const ResourceRequest&) const override; 61 bool canReuse(const ResourceRequest&) const override;
62 62
63 private: 63 private:
64 class RawResourceFactory : public ResourceFactory { 64 class RawResourceFactory : public ResourceFactory {
65 public: 65 public:
66 RawResourceFactory(Resource::Type type) 66 RawResourceFactory(Resource::Type type)
67 : ResourceFactory(type) { } 67 : ResourceFactory(type) { }
68 68
69 PassRefPtrWillBeRawPtr<Resource> create(const ResourceRequest& request, const ResourceLoaderOptions& options, const String& charset) const override 69 RawPtr<Resource> create(const ResourceRequest& request, const ResourceLo aderOptions& options, const String& charset) const override
70 { 70 {
71 return adoptRefWillBeNoop(new RawResource(request, m_type, options)) ; 71 return new RawResource(request, m_type, options);
72 } 72 }
73 }; 73 };
74 74
75 RawResource(const ResourceRequest&, Type, const ResourceLoaderOptions&); 75 RawResource(const ResourceRequest&, Type, const ResourceLoaderOptions&);
76 76
77 void didAddClient(ResourceClient*) override; 77 void didAddClient(ResourceClient*) override;
78 void appendData(const char*, size_t) override; 78 void appendData(const char*, size_t) override;
79 79
80 bool shouldIgnoreHTTPStatusCodeErrors() const override { return !isLinkPrelo ad(); } 80 bool shouldIgnoreHTTPStatusCodeErrors() const override { return !isLinkPrelo ad(); }
81 81
82 void willFollowRedirect(ResourceRequest&, const ResourceResponse&) override; 82 void willFollowRedirect(ResourceRequest&, const ResourceResponse&) override;
83 void responseReceived(const ResourceResponse&, PassOwnPtr<WebDataConsumerHan dle>) override; 83 void responseReceived(const ResourceResponse&, PassOwnPtr<WebDataConsumerHan dle>) override;
84 void setSerializedCachedMetadata(const char*, size_t) override; 84 void setSerializedCachedMetadata(const char*, size_t) override;
85 void didSendData(unsigned long long bytesSent, unsigned long long totalBytes ToBeSent) override; 85 void didSendData(unsigned long long bytesSent, unsigned long long totalBytes ToBeSent) override;
86 void didDownloadData(int) override; 86 void didDownloadData(int) override;
87 void reportResourceTimingToClients(const ResourceTimingInfo&) override; 87 void reportResourceTimingToClients(const ResourceTimingInfo&) override;
88 }; 88 };
89 89
90 #if ENABLE(SECURITY_ASSERT) 90 #if ENABLE(SECURITY_ASSERT)
91 inline bool isRawResource(const Resource& resource) 91 inline bool isRawResource(const Resource& resource)
92 { 92 {
93 Resource::Type type = resource.getType(); 93 Resource::Type type = resource.getType();
94 return type == Resource::MainResource || type == Resource::Raw || type == Re source::TextTrack || type == Resource::Media || type == Resource::Manifest || ty pe == Resource::ImportResource; 94 return type == Resource::MainResource || type == Resource::Raw || type == Re source::TextTrack || type == Resource::Media || type == Resource::Manifest || ty pe == Resource::ImportResource;
95 } 95 }
96 #endif 96 #endif
97 inline PassRefPtrWillBeRawPtr<RawResource> toRawResource(const PassRefPtrWillBeR awPtr<Resource>& resource) 97 inline RawPtr<RawResource> toRawResource(const RawPtr<Resource>& resource)
98 { 98 {
99 ASSERT_WITH_SECURITY_IMPLICATION(!resource || isRawResource(*resource.get()) ); 99 ASSERT_WITH_SECURITY_IMPLICATION(!resource || isRawResource(*resource.get()) );
100 return static_cast<RawResource*>(resource.get()); 100 return static_cast<RawResource*>(resource.get());
101 } 101 }
102 102
103 class CORE_EXPORT RawResourceClient : public ResourceClient { 103 class CORE_EXPORT RawResourceClient : public ResourceClient {
104 public: 104 public:
105 ~RawResourceClient() override {} 105 ~RawResourceClient() override {}
106 static bool isExpectedType(ResourceClient* client) { return client->getResou rceClientType() == RawResourceType; } 106 static bool isExpectedType(ResourceClient* client) { return client->getResou rceClientType() == RawResourceType; }
107 ResourceClientType getResourceClientType() const final { return RawResourceT ype; } 107 ResourceClientType getResourceClientType() const final { return RawResourceT ype; }
108 108
109 virtual void dataSent(Resource*, unsigned long long /* bytesSent */, unsigne d long long /* totalBytesToBeSent */) { } 109 virtual void dataSent(Resource*, unsigned long long /* bytesSent */, unsigne d long long /* totalBytesToBeSent */) { }
110 virtual void responseReceived(Resource*, const ResourceResponse&, PassOwnPtr <WebDataConsumerHandle>) { } 110 virtual void responseReceived(Resource*, const ResourceResponse&, PassOwnPtr <WebDataConsumerHandle>) { }
111 virtual void setSerializedCachedMetadata(Resource*, const char*, size_t) { } 111 virtual void setSerializedCachedMetadata(Resource*, const char*, size_t) { }
112 virtual void dataReceived(Resource*, const char* /* data */, size_t /* lengt h */) { } 112 virtual void dataReceived(Resource*, const char* /* data */, size_t /* lengt h */) { }
113 virtual void redirectReceived(Resource*, ResourceRequest&, const ResourceRes ponse&) { } 113 virtual void redirectReceived(Resource*, ResourceRequest&, const ResourceRes ponse&) { }
114 virtual void dataDownloaded(Resource*, int) { } 114 virtual void dataDownloaded(Resource*, int) { }
115 virtual void didReceiveResourceTiming(Resource*, const ResourceTimingInfo&) { } 115 virtual void didReceiveResourceTiming(Resource*, const ResourceTimingInfo&) { }
116 }; 116 };
117 117
118 } // namespace blink 118 } // namespace blink
119 119
120 #endif // RawResource_h 120 #endif // RawResource_h
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698