| 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
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 Loading... |
| 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 Loading... |
| 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 // If cache-aware loading is activated, this is called when the first |
| 291 // disk-cache-only request failed due to cache miss. Calls to addClient() and |
| 292 // removeClient() is forbidden in ResourceClient callbacks to prevent |
| 293 // potential race issues. |
| 294 virtual void willReloadAfterDiskCacheMiss(); |
| 295 |
| 296 // TODO(632580): Workaround to persist cache-aware state, remove after fixed. |
| 297 void setResourceRequest(const ResourceRequest& resourceRequest) { |
| 298 m_resourceRequest = resourceRequest; |
| 299 } |
| 300 |
| 289 // Used by the MemoryCache to reduce the memory consumption of the entry. | 301 // Used by the MemoryCache to reduce the memory consumption of the entry. |
| 290 void prune(); | 302 void prune(); |
| 291 | 303 |
| 292 virtual void onMemoryDump(WebMemoryDumpLevelOfDetail, | 304 virtual void onMemoryDump(WebMemoryDumpLevelOfDetail, |
| 293 WebProcessMemoryDump*) const; | 305 WebProcessMemoryDump*) const; |
| 294 | 306 |
| 295 static const char* resourceTypeToString(Type, const FetchInitiatorInfo&); | 307 static const char* resourceTypeToString(Type, const FetchInitiatorInfo&); |
| 296 | 308 |
| 297 protected: | 309 protected: |
| 298 Resource(const ResourceRequest&, Type, const ResourceLoaderOptions&); | 310 Resource(const ResourceRequest&, Type, const ResourceLoaderOptions&); |
| (...skipping 103 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 402 | 414 |
| 403 unsigned m_preloadResult : 2; // PreloadResult | 415 unsigned m_preloadResult : 2; // PreloadResult |
| 404 unsigned m_type : 4; // Type | 416 unsigned m_type : 4; // Type |
| 405 unsigned m_status : 3; // Status | 417 unsigned m_status : 3; // Status |
| 406 | 418 |
| 407 unsigned m_needsSynchronousCacheHit : 1; | 419 unsigned m_needsSynchronousCacheHit : 1; |
| 408 unsigned m_linkPreload : 1; | 420 unsigned m_linkPreload : 1; |
| 409 bool m_isRevalidating : 1; | 421 bool m_isRevalidating : 1; |
| 410 bool m_isAlive : 1; | 422 bool m_isAlive : 1; |
| 411 | 423 |
| 424 bool m_isAddRemoveClientProhibited : 1; |
| 425 |
| 412 // Ordered list of all redirects followed while fetching this resource. | 426 // Ordered list of all redirects followed while fetching this resource. |
| 413 Vector<RedirectPair> m_redirectChain; | 427 Vector<RedirectPair> m_redirectChain; |
| 414 | 428 |
| 415 HeapHashCountedSet<WeakMember<ResourceClient>> m_clients; | 429 HeapHashCountedSet<WeakMember<ResourceClient>> m_clients; |
| 416 HeapHashCountedSet<WeakMember<ResourceClient>> m_clientsAwaitingCallback; | 430 HeapHashCountedSet<WeakMember<ResourceClient>> m_clientsAwaitingCallback; |
| 417 HeapHashCountedSet<WeakMember<ResourceClient>> m_finishedClients; | 431 HeapHashCountedSet<WeakMember<ResourceClient>> m_finishedClients; |
| 418 | 432 |
| 419 ResourceLoaderOptions m_options; | 433 ResourceLoaderOptions m_options; |
| 420 | 434 |
| 421 double m_responseTimestamp; | 435 double m_responseTimestamp; |
| (...skipping 23 matching lines...) Expand all Loading... |
| 445 }; | 459 }; |
| 446 | 460 |
| 447 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ | 461 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ |
| 448 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \ | 462 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, \ |
| 449 resource->getType() == Resource::typeName, \ | 463 resource->getType() == Resource::typeName, \ |
| 450 resource.getType() == Resource::typeName); | 464 resource.getType() == Resource::typeName); |
| 451 | 465 |
| 452 } // namespace blink | 466 } // namespace blink |
| 453 | 467 |
| 454 #endif | 468 #endif |
| OLD | NEW |