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

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

Issue 2390583002: [WIP] WebFonts cache-aware timeout adaption (Closed)
Patch Set: Created 4 years, 2 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 17 matching lines...) Expand all
28 #include "core/fetch/ResourceLoaderOptions.h" 28 #include "core/fetch/ResourceLoaderOptions.h"
29 #include "platform/MemoryCoordinator.h" 29 #include "platform/MemoryCoordinator.h"
30 #include "platform/SharedBuffer.h" 30 #include "platform/SharedBuffer.h"
31 #include "platform/Timer.h" 31 #include "platform/Timer.h"
32 #include "platform/network/ResourceError.h" 32 #include "platform/network/ResourceError.h"
33 #include "platform/network/ResourceLoadPriority.h" 33 #include "platform/network/ResourceLoadPriority.h"
34 #include "platform/network/ResourceRequest.h" 34 #include "platform/network/ResourceRequest.h"
35 #include "platform/network/ResourceResponse.h" 35 #include "platform/network/ResourceResponse.h"
36 #include "platform/scheduler/CancellableTaskFactory.h" 36 #include "platform/scheduler/CancellableTaskFactory.h"
37 #include "platform/web_process_memory_dump.h" 37 #include "platform/web_process_memory_dump.h"
38 #include "public/platform/WebCachePolicy.h"
38 #include "public/platform/WebDataConsumerHandle.h" 39 #include "public/platform/WebDataConsumerHandle.h"
39 #include "wtf/Allocator.h" 40 #include "wtf/Allocator.h"
40 #include "wtf/HashCountedSet.h" 41 #include "wtf/HashCountedSet.h"
41 #include "wtf/HashSet.h" 42 #include "wtf/HashSet.h"
42 #include "wtf/text/WTFString.h" 43 #include "wtf/text/WTFString.h"
43 #include <memory> 44 #include <memory>
44 45
45 namespace blink { 46 namespace blink {
46 47
47 struct FetchInitiatorInfo; 48 struct FetchInitiatorInfo;
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 280
280 void addToEncodedBodyLength(int value) { 281 void addToEncodedBodyLength(int value) {
281 m_response.addToEncodedBodyLength(value); 282 m_response.addToEncodedBodyLength(value);
282 } 283 }
283 void addToDecodedBodyLength(int value) { 284 void addToDecodedBodyLength(int value) {
284 m_response.addToDecodedBodyLength(value); 285 m_response.addToDecodedBodyLength(value);
285 } 286 }
286 287
287 virtual bool canReuse(const ResourceRequest&) const { return true; } 288 virtual bool canReuse(const ResourceRequest&) const { return true; }
288 289
290 virtual void willReloadAfterDiskCacheMiss();
yhirano 2016/10/04 05:27:10 Please add a comment that add (/ remove?)-ing clie
Shao-Chuan Lee 2016/10/04 09:08:04 Done.
291
292 // TODO(632580): Workaround to persist cache-aware state, remove after fixed.
kouhei (in TOK) 2016/10/03 08:11:47 hiroshige-san: Would you take a look?
hiroshige 2016/10/03 08:28:20 Nate is working on the issue: https://codereview.c
293 void setResourceRequest(const ResourceRequest& resourceRequest) {
294 m_resourceRequest = resourceRequest;
295 }
296
289 // Used by the MemoryCache to reduce the memory consumption of the entry. 297 // Used by the MemoryCache to reduce the memory consumption of the entry.
290 void prune(); 298 void prune();
291 299
292 virtual void onMemoryDump(WebMemoryDumpLevelOfDetail, 300 virtual void onMemoryDump(WebMemoryDumpLevelOfDetail,
293 WebProcessMemoryDump*) const; 301 WebProcessMemoryDump*) const;
294 302
295 static const char* resourceTypeToString(Type, const FetchInitiatorInfo&); 303 static const char* resourceTypeToString(Type, const FetchInitiatorInfo&);
296 304
297 protected: 305 protected:
298 Resource(const ResourceRequest&, Type, const ResourceLoaderOptions&); 306 Resource(const ResourceRequest&, Type, const ResourceLoaderOptions&);
(...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after
402 410
403 unsigned m_preloadResult : 2; // PreloadResult 411 unsigned m_preloadResult : 2; // PreloadResult
404 unsigned m_type : 4; // Type 412 unsigned m_type : 4; // Type
405 unsigned m_status : 3; // Status 413 unsigned m_status : 3; // Status
406 414
407 unsigned m_needsSynchronousCacheHit : 1; 415 unsigned m_needsSynchronousCacheHit : 1;
408 unsigned m_linkPreload : 1; 416 unsigned m_linkPreload : 1;
409 bool m_isRevalidating : 1; 417 bool m_isRevalidating : 1;
410 bool m_isAlive : 1; 418 bool m_isAlive : 1;
411 419
420 bool m_isAddClientProhibited : 1;
yhirano 2016/10/04 05:27:10 Is it a good idea to prohibit removeClient as well
Shao-Chuan Lee 2016/10/04 09:08:04 Done.
421
412 // Ordered list of all redirects followed while fetching this resource. 422 // Ordered list of all redirects followed while fetching this resource.
413 Vector<RedirectPair> m_redirectChain; 423 Vector<RedirectPair> m_redirectChain;
414 424
415 HeapHashCountedSet<WeakMember<ResourceClient>> m_clients; 425 HeapHashCountedSet<WeakMember<ResourceClient>> m_clients;
416 HeapHashCountedSet<WeakMember<ResourceClient>> m_clientsAwaitingCallback; 426 HeapHashCountedSet<WeakMember<ResourceClient>> m_clientsAwaitingCallback;
417 HeapHashCountedSet<WeakMember<ResourceClient>> m_finishedClients; 427 HeapHashCountedSet<WeakMember<ResourceClient>> m_finishedClients;
418 428
419 ResourceLoaderOptions m_options; 429 ResourceLoaderOptions m_options;
420 430
421 double m_responseTimestamp; 431 double m_responseTimestamp;
(...skipping 23 matching lines...) Expand all
445 }; 455 };
446 456
447 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ 457 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \
448 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \ 458 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \
449 resource->getType() == Resource::typeName, \ 459 resource->getType() == Resource::typeName, \
450 resource.getType() == Resource::typeName); 460 resource.getType() == Resource::typeName);
451 461
452 } // namespace blink 462 } // namespace blink
453 463
454 #endif 464 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698