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

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

Issue 2454983002: Cache-aware Resource loading (Closed)
Patch Set: check synchronous policy 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.
315 virtual void willReloadAfterDiskCacheMiss() {}
kinuko 2016/11/08 06:10:18 nit/optional: This method naming feels a little w
Shao-Chuan Lee 2016/11/08 06:28:01 SGTM, but I wonder if it's better to mention "disk
kinuko 2016/11/08 06:42:15 Oh that's true, so maybe the current name is just
Shao-Chuan Lee 2016/11/08 07:19:06 Done, PTAL
316
317 // TODO(shaochuan): This is for saving back the actual ResourceRequest sent
318 // in ResourceFetcher::startLoad() for retry in cache-aware loading, remove
319 // once ResourceRequest is not modified in startLoad(). crbug.com/632580
320 void setResourceRequest(const ResourceRequest& resourceRequest) {
321 m_resourceRequest = resourceRequest;
322 }
323
313 // Used by the MemoryCache to reduce the memory consumption of the entry. 324 // Used by the MemoryCache to reduce the memory consumption of the entry.
314 void prune(); 325 void prune();
315 326
316 virtual void onMemoryDump(WebMemoryDumpLevelOfDetail, 327 virtual void onMemoryDump(WebMemoryDumpLevelOfDetail,
317 WebProcessMemoryDump*) const; 328 WebProcessMemoryDump*) const;
318 329
319 static const char* resourceTypeToString(Type, const FetchInitiatorInfo&); 330 static const char* resourceTypeToString(Type, const FetchInitiatorInfo&);
320 331
321 protected: 332 protected:
322 Resource(const ResourceRequest&, Type, const ResourceLoaderOptions&); 333 Resource(const ResourceRequest&, Type, const ResourceLoaderOptions&);
(...skipping 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
481 }; 492 };
482 493
483 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ 494 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \
484 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \ 495 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \
485 resource->getType() == Resource::typeName, \ 496 resource->getType() == Resource::typeName, \
486 resource.getType() == Resource::typeName); 497 resource.getType() == Resource::typeName);
487 498
488 } // namespace blink 499 } // namespace blink
489 500
490 #endif 501 #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