| 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 16 matching lines...) Expand all Loading... |
| 27 #include "platform/Timer.h" | 27 #include "platform/Timer.h" |
| 28 #include "platform/network/ResourceError.h" | 28 #include "platform/network/ResourceError.h" |
| 29 #include "platform/network/ResourceLoadPriority.h" | 29 #include "platform/network/ResourceLoadPriority.h" |
| 30 #include "platform/network/ResourceRequest.h" | 30 #include "platform/network/ResourceRequest.h" |
| 31 #include "platform/network/ResourceResponse.h" | 31 #include "platform/network/ResourceResponse.h" |
| 32 #include "wtf/HashCountedSet.h" | 32 #include "wtf/HashCountedSet.h" |
| 33 #include "wtf/HashSet.h" | 33 #include "wtf/HashSet.h" |
| 34 #include "wtf/OwnPtr.h" | 34 #include "wtf/OwnPtr.h" |
| 35 #include "wtf/text/WTFString.h" | 35 #include "wtf/text/WTFString.h" |
| 36 | 36 |
| 37 // FIXME(crbug.com/352043): This is temporarily enabled even on RELEASE to diagn
ose a wild crash. |
| 38 #define ENABLE_RESOURCE_IS_DELETED_CHECK |
| 39 |
| 37 namespace WebCore { | 40 namespace WebCore { |
| 38 | 41 |
| 39 struct FetchInitiatorInfo; | 42 struct FetchInitiatorInfo; |
| 40 class MemoryCache; | 43 class MemoryCache; |
| 41 class CachedMetadata; | 44 class CachedMetadata; |
| 42 class ResourceClient; | 45 class ResourceClient; |
| 43 class ResourcePtrBase; | 46 class ResourcePtrBase; |
| 44 class ResourceFetcher; | 47 class ResourceFetcher; |
| 45 class InspectorResource; | 48 class InspectorResource; |
| 46 class ResourceLoader; | 49 class ResourceLoader; |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 232 | 235 |
| 233 double loadFinishTime() const { return m_loadFinishTime; } | 236 double loadFinishTime() const { return m_loadFinishTime; } |
| 234 | 237 |
| 235 virtual bool canReuse(const ResourceRequest&) const { return true; } | 238 virtual bool canReuse(const ResourceRequest&) const { return true; } |
| 236 | 239 |
| 237 // Used by the MemoryCache to reduce the memory consumption of the entry. | 240 // Used by the MemoryCache to reduce the memory consumption of the entry. |
| 238 void prune(); | 241 void prune(); |
| 239 | 242 |
| 240 static const char* resourceTypeToString(Type, const FetchInitiatorInfo&); | 243 static const char* resourceTypeToString(Type, const FetchInitiatorInfo&); |
| 241 | 244 |
| 245 #ifdef ENABLE_RESOURCE_IS_DELETED_CHECK |
| 246 void assertAlive() const { RELEASE_ASSERT(!m_deleted); } |
| 247 #else |
| 248 void assertAlive() const { } |
| 249 #endif |
| 250 |
| 242 protected: | 251 protected: |
| 243 virtual void checkNotify(); | 252 virtual void checkNotify(); |
| 244 virtual void finishOnePart(); | 253 virtual void finishOnePart(); |
| 245 | 254 |
| 246 // Normal resource pointers will silently switch what Resource* they referen
ce when we | 255 // Normal resource pointers will silently switch what Resource* they referen
ce when we |
| 247 // successfully revalidated the resource. We need a way to guarantee that th
e Resource | 256 // successfully revalidated the resource. We need a way to guarantee that th
e Resource |
| 248 // that received the 304 response survives long enough to switch everything
over to the | 257 // that received the 304 response survives long enough to switch everything
over to the |
| 249 // revalidatedresource. The normal mechanisms for keeping a Resource alive e
xternally | 258 // revalidatedresource. The normal mechanisms for keeping a Resource alive e
xternally |
| 250 // (ResourcePtrs and ResourceClients registering themselves) don't work in t
his case, so | 259 // (ResourcePtrs and ResourceClients registering themselves) don't work in t
his case, so |
| 251 // have a separate internal protector). | 260 // have a separate internal protector). |
| (...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 360 | 369 |
| 361 unsigned m_switchingClientsToRevalidatedResource : 1; | 370 unsigned m_switchingClientsToRevalidatedResource : 1; |
| 362 | 371 |
| 363 unsigned m_type : 4; // Type | 372 unsigned m_type : 4; // Type |
| 364 unsigned m_status : 3; // Status | 373 unsigned m_status : 3; // Status |
| 365 | 374 |
| 366 unsigned m_wasPurged : 1; | 375 unsigned m_wasPurged : 1; |
| 367 | 376 |
| 368 unsigned m_needsSynchronousCacheHit : 1; | 377 unsigned m_needsSynchronousCacheHit : 1; |
| 369 | 378 |
| 370 #ifndef NDEBUG | 379 #ifdef ENABLE_RESOURCE_IS_DELETED_CHECK |
| 371 bool m_deleted; | 380 bool m_deleted; |
| 372 #endif | 381 #endif |
| 373 | 382 |
| 374 // If this field is non-null we are using the resource as a proxy for checki
ng whether an existing resource is still up to date | 383 // If this field is non-null we are using the resource as a proxy for checki
ng whether an existing resource is still up to date |
| 375 // using HTTP If-Modified-Since/If-None-Match headers. If the response is 30
4 all clients of this resource are moved | 384 // using HTTP If-Modified-Since/If-None-Match headers. If the response is 30
4 all clients of this resource are moved |
| 376 // to to be clients of m_resourceToRevalidate and the resource is deleted. I
f not, the field is zeroed and this | 385 // to to be clients of m_resourceToRevalidate and the resource is deleted. I
f not, the field is zeroed and this |
| 377 // resources becomes normal resource load. | 386 // resources becomes normal resource load. |
| 378 Resource* m_resourceToRevalidate; | 387 Resource* m_resourceToRevalidate; |
| 379 | 388 |
| 380 // If this field is non-null, the resource has a proxy for checking whether
it is still up to date (see m_resourceToRevalidate). | 389 // If this field is non-null, the resource has a proxy for checking whether
it is still up to date (see m_resourceToRevalidate). |
| (...skipping 11 matching lines...) Expand all Loading... |
| 392 const char* ResourceTypeName(Resource::Type); | 401 const char* ResourceTypeName(Resource::Type); |
| 393 #endif | 402 #endif |
| 394 | 403 |
| 395 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ | 404 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ |
| 396 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->type() =
= Resource::typeName, resource.type() == Resource::typeName); \ | 405 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->type() =
= Resource::typeName, resource.type() == Resource::typeName); \ |
| 397 inline typeName##Resource* to##typeName##Resource(const ResourcePtr<Resource
>& ptr) { return to##typeName##Resource(ptr.get()); } | 406 inline typeName##Resource* to##typeName##Resource(const ResourcePtr<Resource
>& ptr) { return to##typeName##Resource(ptr.get()); } |
| 398 | 407 |
| 399 } | 408 } |
| 400 | 409 |
| 401 #endif | 410 #endif |
| OLD | NEW |