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

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

Issue 2527353002: Phase II Step 3: Reload LoFi/placeholder images via new ImageResource
Patch Set: Reflect comments and rebase Created 3 years, 9 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 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 324
325 // Used by the MemoryCache to reduce the memory consumption of the entry. 325 // Used by the MemoryCache to reduce the memory consumption of the entry.
326 void prune(); 326 void prune();
327 327
328 virtual void onMemoryDump(WebMemoryDumpLevelOfDetail, 328 virtual void onMemoryDump(WebMemoryDumpLevelOfDetail,
329 WebProcessMemoryDump*) const; 329 WebProcessMemoryDump*) const;
330 330
331 // If this Resource is ImageResource and has the Lo-Fi response headers or is 331 // If this Resource is ImageResource and has the Lo-Fi response headers or is
332 // a placeholder, reload the full original image with the Lo-Fi state set to 332 // a placeholder, reload the full original image with the Lo-Fi state set to
333 // off and optionally bypassing the cache. 333 // off and optionally bypassing the cache.
334 virtual void reloadIfLoFiOrPlaceholderImage(ResourceFetcher*, 334 // If reloading is started, this method returns a new Resource that is used
335 ReloadLoFiOrPlaceholderPolicy) {} 335 // for reloading, and |this| should be no longer used.
336 // Otherwise, this method returns nullptr.
337 virtual Resource* reloadIfLoFiOrPlaceholderImage(
338 ResourceFetcher*,
339 ReloadLoFiOrPlaceholderPolicy) {
340 return nullptr;
341 }
336 342
337 static const char* resourceTypeToString( 343 static const char* resourceTypeToString(
338 Type, 344 Type,
339 const AtomicString& fetchInitiatorName); 345 const AtomicString& fetchInitiatorName);
340 346
341 protected: 347 protected:
342 Resource(const ResourceRequest&, Type, const ResourceLoaderOptions&); 348 Resource(const ResourceRequest&, Type, const ResourceLoaderOptions&);
343 349
344 virtual void checkNotify(); 350 virtual void checkNotify();
345 351
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
383 389
384 virtual void destroyDecodedDataIfPossible() {} 390 virtual void destroyDecodedDataIfPossible() {}
385 391
386 // Returns the memory dump name used for tracing. See Resource::onMemoryDump. 392 // Returns the memory dump name used for tracing. See Resource::onMemoryDump.
387 String getMemoryDumpName() const; 393 String getMemoryDumpName() const;
388 394
389 const HeapHashCountedSet<WeakMember<ResourceClient>>& clients() const { 395 const HeapHashCountedSet<WeakMember<ResourceClient>>& clients() const {
390 return m_clients; 396 return m_clients;
391 } 397 }
392 398
393 void setCachePolicyBypassingCache();
394 void setPreviewsStateNoTransform();
395 void clearRangeRequestHeader();
396
397 SharedBuffer* data() const { return m_data.get(); } 399 SharedBuffer* data() const { return m_data.get(); }
398 void clearData(); 400 void clearData();
399 401
400 class ProhibitAddRemoveClientInScope : public AutoReset<bool> { 402 class ProhibitAddRemoveClientInScope : public AutoReset<bool> {
401 public: 403 public:
402 ProhibitAddRemoveClientInScope(Resource* resource) 404 ProhibitAddRemoveClientInScope(Resource* resource)
403 : AutoReset(&resource->m_isAddRemoveClientProhibited, true) {} 405 : AutoReset(&resource->m_isAddRemoveClientProhibited, true) {}
404 }; 406 };
405 407
406 class RevalidationStartForbiddenScope : public AutoReset<bool> { 408 class RevalidationStartForbiddenScope : public AutoReset<bool> {
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
501 }; 503 };
502 504
503 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ 505 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \
504 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \ 506 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \
505 resource->getType() == Resource::typeName, \ 507 resource->getType() == Resource::typeName, \
506 resource.getType() == Resource::typeName); 508 resource.getType() == Resource::typeName);
507 509
508 } // namespace blink 510 } // namespace blink
509 511
510 #endif 512 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698