| OLD | NEW |
| 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 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 #include "wtf/HashCountedSet.h" | 43 #include "wtf/HashCountedSet.h" |
| 44 #include "wtf/HashSet.h" | 44 #include "wtf/HashSet.h" |
| 45 #include "wtf/text/WTFString.h" | 45 #include "wtf/text/WTFString.h" |
| 46 #include <memory> | 46 #include <memory> |
| 47 | 47 |
| 48 namespace blink { | 48 namespace blink { |
| 49 | 49 |
| 50 struct FetchInitiatorInfo; | 50 struct FetchInitiatorInfo; |
| 51 class FetchRequest; | 51 class FetchRequest; |
| 52 class ResourceClient; | 52 class ResourceClient; |
| 53 class ResourceFetcher; |
| 53 class ResourceTimingInfo; | 54 class ResourceTimingInfo; |
| 54 class ResourceLoader; | 55 class ResourceLoader; |
| 55 class SecurityOrigin; | 56 class SecurityOrigin; |
| 56 | 57 |
| 57 // A resource that is held in the cache. Classes who want to use this object | 58 // A resource that is held in the cache. Classes who want to use this object |
| 58 // should derive from ResourceClient, to get the function calls in case the | 59 // should derive from ResourceClient, to get the function calls in case the |
| 59 // requested data has arrived. This class also does the actual communication | 60 // requested data has arrived. This class also does the actual communication |
| 60 // with the loader to obtain the resource from the network. | 61 // with the loader to obtain the resource from the network. |
| 61 class CORE_EXPORT Resource : public GarbageCollectedFinalized<Resource>, | 62 class CORE_EXPORT Resource : public GarbageCollectedFinalized<Resource>, |
| 62 public MemoryCoordinatorClient { | 63 public MemoryCoordinatorClient { |
| (...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 DontMarkAsReferenced, | 101 DontMarkAsReferenced, |
| 101 }; | 102 }; |
| 102 | 103 |
| 103 virtual ~Resource(); | 104 virtual ~Resource(); |
| 104 | 105 |
| 105 DECLARE_VIRTUAL_TRACE(); | 106 DECLARE_VIRTUAL_TRACE(); |
| 106 | 107 |
| 107 virtual void setEncoding(const String&) {} | 108 virtual void setEncoding(const String&) {} |
| 108 virtual String encoding() const { return String(); } | 109 virtual String encoding() const { return String(); } |
| 109 virtual void appendData(const char*, size_t); | 110 virtual void appendData(const char*, size_t); |
| 110 virtual void error(const ResourceError&); | 111 // LoFi images can be reloaded using |fetcherForReload| (if non-null). |
| 112 virtual void error(const ResourceError&, |
| 113 ResourceFetcher* fetcherForReload = nullptr); |
| 111 virtual void setCORSFailed() {} | 114 virtual void setCORSFailed() {} |
| 112 | 115 |
| 113 void setNeedsSynchronousCacheHit(bool needsSynchronousCacheHit) { | 116 void setNeedsSynchronousCacheHit(bool needsSynchronousCacheHit) { |
| 114 m_needsSynchronousCacheHit = needsSynchronousCacheHit; | 117 m_needsSynchronousCacheHit = needsSynchronousCacheHit; |
| 115 } | 118 } |
| 116 | 119 |
| 117 void setLinkPreload(bool isLinkPreload) { m_linkPreload = isLinkPreload; } | 120 void setLinkPreload(bool isLinkPreload) { m_linkPreload = isLinkPreload; } |
| 118 bool isLinkPreload() const { return m_linkPreload; } | 121 bool isLinkPreload() const { return m_linkPreload; } |
| 119 | 122 |
| 120 void setPreloadDiscoveryTime(double preloadDiscoveryTime) { | 123 void setPreloadDiscoveryTime(double preloadDiscoveryTime) { |
| (...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 | 198 |
| 196 void setLoader(ResourceLoader*); | 199 void setLoader(ResourceLoader*); |
| 197 ResourceLoader* loader() const { return m_loader.get(); } | 200 ResourceLoader* loader() const { return m_loader.get(); } |
| 198 | 201 |
| 199 virtual bool isImage() const { return false; } | 202 virtual bool isImage() const { return false; } |
| 200 bool shouldBlockLoadEvent() const; | 203 bool shouldBlockLoadEvent() const; |
| 201 bool isLoadEventBlockingResourceType() const; | 204 bool isLoadEventBlockingResourceType() const; |
| 202 | 205 |
| 203 // Computes the status of an object after loading. Updates the expire date on | 206 // Computes the status of an object after loading. Updates the expire date on |
| 204 // the cache entry file | 207 // the cache entry file |
| 205 virtual void finish(double finishTime); | 208 // LoFi images can be reloaded using |fetcherForReload| (if non-null). |
| 209 virtual void finish(double finishTime, |
| 210 ResourceFetcher* fetcherForReload = nullptr); |
| 206 void finish() { finish(0.0); } | 211 void finish() { finish(0.0); } |
| 207 | 212 |
| 208 // FIXME: Remove the stringless variant once all the callsites' error messages | 213 // FIXME: Remove the stringless variant once all the callsites' error messages |
| 209 // are updated. | 214 // are updated. |
| 210 bool passesAccessControlCheck(SecurityOrigin*) const; | 215 bool passesAccessControlCheck(SecurityOrigin*) const; |
| 211 bool passesAccessControlCheck(SecurityOrigin*, | 216 bool passesAccessControlCheck(SecurityOrigin*, |
| 212 String& errorDescription) const; | 217 String& errorDescription) const; |
| 213 | 218 |
| 214 virtual PassRefPtr<const SharedBuffer> resourceBuffer() const { | 219 virtual PassRefPtr<const SharedBuffer> resourceBuffer() const { |
| 215 return m_data; | 220 return m_data; |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 382 // Returns the memory dump name used for tracing. See Resource::onMemoryDump. | 387 // Returns the memory dump name used for tracing. See Resource::onMemoryDump. |
| 383 String getMemoryDumpName() const; | 388 String getMemoryDumpName() const; |
| 384 | 389 |
| 385 const HeapHashCountedSet<WeakMember<ResourceClient>>& clients() const { | 390 const HeapHashCountedSet<WeakMember<ResourceClient>>& clients() const { |
| 386 return m_clients; | 391 return m_clients; |
| 387 } | 392 } |
| 388 DataBufferingPolicy dataBufferingPolicy() const { | 393 DataBufferingPolicy dataBufferingPolicy() const { |
| 389 return m_options.dataBufferingPolicy; | 394 return m_options.dataBufferingPolicy; |
| 390 } | 395 } |
| 391 | 396 |
| 392 void setCachePolicyBypassingCache(); | |
| 393 void setLoFiStateOff(); | |
| 394 void clearRangeRequestHeader(); | |
| 395 | |
| 396 SharedBuffer* data() const { return m_data.get(); } | 397 SharedBuffer* data() const { return m_data.get(); } |
| 397 void clearData(); | 398 void clearData(); |
| 398 | 399 |
| 399 class ProhibitAddRemoveClientInScope : public AutoReset<bool> { | 400 class ProhibitAddRemoveClientInScope : public AutoReset<bool> { |
| 400 public: | 401 public: |
| 401 ProhibitAddRemoveClientInScope(Resource* resource) | 402 ProhibitAddRemoveClientInScope(Resource* resource) |
| 402 : AutoReset(&resource->m_isAddRemoveClientProhibited, true) {} | 403 : AutoReset(&resource->m_isAddRemoveClientProhibited, true) {} |
| 403 }; | 404 }; |
| 404 | 405 |
| 405 private: | 406 private: |
| (...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 493 }; | 494 }; |
| 494 | 495 |
| 495 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ | 496 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ |
| 496 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \ | 497 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \ |
| 497 resource->getType() == Resource::typeName, \ | 498 resource->getType() == Resource::typeName, \ |
| 498 resource.getType() == Resource::typeName); | 499 resource.getType() == Resource::typeName); |
| 499 | 500 |
| 500 } // namespace blink | 501 } // namespace blink |
| 501 | 502 |
| 502 #endif | 503 #endif |
| OLD | NEW |