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

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

Issue 1928823002: Simplifying finishing a load on Resource (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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 rights reserved. 5 Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 virtual ~Resource(); 91 virtual ~Resource();
92 92
93 virtual void removedFromMemoryCache(); 93 virtual void removedFromMemoryCache();
94 DECLARE_VIRTUAL_TRACE(); 94 DECLARE_VIRTUAL_TRACE();
95 95
96 void load(ResourceFetcher*); 96 void load(ResourceFetcher*);
97 97
98 virtual void setEncoding(const String&) { } 98 virtual void setEncoding(const String&) { }
99 virtual String encoding() const { return String(); } 99 virtual String encoding() const { return String(); }
100 virtual void appendData(const char*, size_t); 100 virtual void appendData(const char*, size_t);
101 virtual void error(Resource::Status); 101 virtual void error(const ResourceError&);
102 virtual void setCORSFailed() { } 102 virtual void setCORSFailed() { }
103 103
104 void setNeedsSynchronousCacheHit(bool needsSynchronousCacheHit) { m_needsSyn chronousCacheHit = needsSynchronousCacheHit; } 104 void setNeedsSynchronousCacheHit(bool needsSynchronousCacheHit) { m_needsSyn chronousCacheHit = needsSynchronousCacheHit; }
105 105
106 void setLinkPreload(bool isLinkPreload) { m_linkPreload = isLinkPreload; } 106 void setLinkPreload(bool isLinkPreload) { m_linkPreload = isLinkPreload; }
107 bool isLinkPreload() const { return m_linkPreload; } 107 bool isLinkPreload() const { return m_linkPreload; }
108 108
109 void setResourceError(const ResourceError& error) { m_error = error; }
110 const ResourceError& resourceError() const { return m_error; } 109 const ResourceError& resourceError() const { return m_error; }
111 110
112 void setIdentifier(unsigned long identifier) { m_identifier = identifier; } 111 void setIdentifier(unsigned long identifier) { m_identifier = identifier; }
113 unsigned long identifier() const { return m_identifier; } 112 unsigned long identifier() const { return m_identifier; }
114 113
115 virtual bool shouldIgnoreHTTPStatusCodeErrors() const { return false; } 114 virtual bool shouldIgnoreHTTPStatusCodeErrors() const { return false; }
116 115
117 const ResourceRequest& resourceRequest() const { return m_resourceRequest; } 116 const ResourceRequest& resourceRequest() const { return m_resourceRequest; }
118 const ResourceRequest& lastResourceRequest() const; 117 const ResourceRequest& lastResourceRequest() const;
119 118
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 bool stillNeedsLoad() const { return m_status < Pending; } 155 bool stillNeedsLoad() const { return m_status < Pending; }
157 156
158 ResourceLoader* loader() const { return m_loader.get(); } 157 ResourceLoader* loader() const { return m_loader.get(); }
159 158
160 virtual bool isImage() const { return false; } 159 virtual bool isImage() const { return false; }
161 bool shouldBlockLoadEvent() const; 160 bool shouldBlockLoadEvent() const;
162 bool isLoadEventBlockingResourceType() const; 161 bool isLoadEventBlockingResourceType() const;
163 162
164 // Computes the status of an object after loading. 163 // Computes the status of an object after loading.
165 // Updates the expire date on the cache entry file 164 // Updates the expire date on the cache entry file
166 void setLoadFinishTime(double finishTime) { m_loadFinishTime = finishTime; } 165 virtual void finish(double finishTime = 0.0);
yhirano 2016/05/02 09:31:34 I feel a virtual function with default arguments a
Nate Chapin 2016/05/02 19:32:24 Sounds good. It might be worth it to remove the de
167 virtual void finish();
168 166
169 // FIXME: Remove the stringless variant once all the callsites' error messag es are updated. 167 // FIXME: Remove the stringless variant once all the callsites' error messag es are updated.
170 bool passesAccessControlCheck(SecurityOrigin*) const; 168 bool passesAccessControlCheck(SecurityOrigin*) const;
171 bool passesAccessControlCheck(SecurityOrigin*, String& errorDescription) con st; 169 bool passesAccessControlCheck(SecurityOrigin*, String& errorDescription) con st;
172 170
173 bool isEligibleForIntegrityCheck(SecurityOrigin*) const; 171 bool isEligibleForIntegrityCheck(SecurityOrigin*) const;
174 172
175 void clearLoader(); 173 void clearLoader();
176 174
177 SharedBuffer* resourceBuffer() const { return m_data.get(); } 175 SharedBuffer* resourceBuffer() const { return m_data.get(); }
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after
364 362
365 Resource::Type m_type; 363 Resource::Type m_type;
366 }; 364 };
367 365
368 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ 366 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \
369 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->getType( ) == Resource::typeName, resource.getType() == Resource::typeName); 367 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->getType( ) == Resource::typeName, resource.getType() == Resource::typeName);
370 368
371 } // namespace blink 369 } // namespace blink
372 370
373 #endif 371 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698