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

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

Issue 2454983002: Cache-aware Resource loading (Closed)
Patch Set: nit Created 4 years, 1 month 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 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
303 303
304 void addToEncodedBodyLength(int value) { 304 void addToEncodedBodyLength(int value) {
305 m_response.addToEncodedBodyLength(value); 305 m_response.addToEncodedBodyLength(value);
306 } 306 }
307 void addToDecodedBodyLength(int value) { 307 void addToDecodedBodyLength(int value) {
308 m_response.addToDecodedBodyLength(value); 308 m_response.addToDecodedBodyLength(value);
309 } 309 }
310 310
311 virtual bool canReuse(const ResourceRequest&) const { return true; } 311 virtual bool canReuse(const ResourceRequest&) const { return true; }
312 312
313 // If cache-aware loading is activated, this callback is called when the first
314 // disk-cache-only request failed due to cache miss. After this callback,
315 // cache-aware loading is deactivated and a reload with original request will
316 // be triggered right away in ResourceLoader.
317 virtual void willReloadAfterDiskCacheMiss() {}
318
319 // TODO(shaochuan): This is for saving back the actual ResourceRequest sent
320 // in ResourceFetcher::startLoad() for retry in cache-aware loading, remove
321 // once ResourceRequest is not modified in startLoad(). crbug.com/632580
322 void setResourceRequest(const ResourceRequest& resourceRequest) {
323 m_resourceRequest = resourceRequest;
324 }
325
313 // Used by the MemoryCache to reduce the memory consumption of the entry. 326 // Used by the MemoryCache to reduce the memory consumption of the entry.
314 void prune(); 327 void prune();
315 328
316 virtual void onMemoryDump(WebMemoryDumpLevelOfDetail, 329 virtual void onMemoryDump(WebMemoryDumpLevelOfDetail,
317 WebProcessMemoryDump*) const; 330 WebProcessMemoryDump*) const;
318 331
319 static const char* resourceTypeToString(Type, const FetchInitiatorInfo&); 332 static const char* resourceTypeToString(Type, const FetchInitiatorInfo&);
320 333
321 protected: 334 protected:
322 Resource(const ResourceRequest&, Type, const ResourceLoaderOptions&); 335 Resource(const ResourceRequest&, Type, const ResourceLoaderOptions&);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 }; 494 };
482 495
483 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ 496 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \
484 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \ 497 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \
485 resource->getType() == Resource::typeName, \ 498 resource->getType() == Resource::typeName, \
486 resource.getType() == Resource::typeName); 499 resource.getType() == Resource::typeName);
487 500
488 } // namespace blink 501 } // namespace blink
489 502
490 #endif 503 #endif
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/fetch/FetchRequest.h ('k') | third_party/WebKit/Source/core/fetch/ResourceFetcher.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698