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 14 matching lines...) Expand all Loading... |
25 | 25 |
26 #include "core/CoreExport.h" | 26 #include "core/CoreExport.h" |
27 #include "core/fetch/CachedMetadataHandler.h" | 27 #include "core/fetch/CachedMetadataHandler.h" |
28 #include "core/fetch/ResourceLoaderOptions.h" | 28 #include "core/fetch/ResourceLoaderOptions.h" |
29 #include "platform/Timer.h" | 29 #include "platform/Timer.h" |
30 #include "platform/network/ResourceError.h" | 30 #include "platform/network/ResourceError.h" |
31 #include "platform/network/ResourceLoadPriority.h" | 31 #include "platform/network/ResourceLoadPriority.h" |
32 #include "platform/network/ResourceRequest.h" | 32 #include "platform/network/ResourceRequest.h" |
33 #include "platform/network/ResourceResponse.h" | 33 #include "platform/network/ResourceResponse.h" |
34 #include "public/platform/WebDataConsumerHandle.h" | 34 #include "public/platform/WebDataConsumerHandle.h" |
| 35 #include "wtf/Allocator.h" |
35 #include "wtf/HashCountedSet.h" | 36 #include "wtf/HashCountedSet.h" |
36 #include "wtf/HashSet.h" | 37 #include "wtf/HashSet.h" |
37 #include "wtf/OwnPtr.h" | 38 #include "wtf/OwnPtr.h" |
38 #include "wtf/text/WTFString.h" | 39 #include "wtf/text/WTFString.h" |
39 | 40 |
40 // FIXME(crbug.com/352043): This is temporarily enabled even on RELEASE to diagn
ose a wild crash. | 41 // FIXME(crbug.com/352043): This is temporarily enabled even on RELEASE to diagn
ose a wild crash. |
41 #define ENABLE_RESOURCE_IS_DELETED_CHECK | 42 #define ENABLE_RESOURCE_IS_DELETED_CHECK |
42 | 43 |
43 namespace blink { | 44 namespace blink { |
44 | 45 |
(...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
317 private: | 318 private: |
318 ResourceCallback(); | 319 ResourceCallback(); |
319 void timerFired(Timer<ResourceCallback>*); | 320 void timerFired(Timer<ResourceCallback>*); |
320 Timer<ResourceCallback> m_callbackTimer; | 321 Timer<ResourceCallback> m_callbackTimer; |
321 WillBeHeapHashSet<RawPtrWillBeMember<Resource>> m_resourcesWithPendingCl
ients; | 322 WillBeHeapHashSet<RawPtrWillBeMember<Resource>> m_resourcesWithPendingCl
ients; |
322 }; | 323 }; |
323 | 324 |
324 bool hasClient(ResourceClient* client) { return m_clients.contains(client) |
| m_clientsAwaitingCallback.contains(client); } | 325 bool hasClient(ResourceClient* client) { return m_clients.contains(client) |
| m_clientsAwaitingCallback.contains(client); } |
325 | 326 |
326 struct RedirectPair { | 327 struct RedirectPair { |
| 328 ALLOW_ONLY_INLINE_ALLOCATION(); |
327 public: | 329 public: |
328 explicit RedirectPair(const ResourceRequest& request, const ResourceResp
onse& redirectResponse) | 330 explicit RedirectPair(const ResourceRequest& request, const ResourceResp
onse& redirectResponse) |
329 : m_request(request) | 331 : m_request(request) |
330 , m_redirectResponse(redirectResponse) | 332 , m_redirectResponse(redirectResponse) |
331 { | 333 { |
332 } | 334 } |
333 | 335 |
334 ResourceRequest m_request; | 336 ResourceRequest m_request; |
335 ResourceResponse m_redirectResponse; | 337 ResourceResponse m_redirectResponse; |
336 }; | 338 }; |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 RawPtrWillBeMember<Resource> m_proxyResource; | 416 RawPtrWillBeMember<Resource> m_proxyResource; |
415 | 417 |
416 // These handles will need to be updated to point to the m_resourceToRevalid
ate in case we get 304 response. | 418 // These handles will need to be updated to point to the m_resourceToRevalid
ate in case we get 304 response. |
417 HashSet<ResourcePtrBase*> m_handlesToRevalidate; | 419 HashSet<ResourcePtrBase*> m_handlesToRevalidate; |
418 | 420 |
419 // Ordered list of all redirects followed while fetching this resource. | 421 // Ordered list of all redirects followed while fetching this resource. |
420 Vector<RedirectPair> m_redirectChain; | 422 Vector<RedirectPair> m_redirectChain; |
421 }; | 423 }; |
422 | 424 |
423 class ResourceFactory { | 425 class ResourceFactory { |
| 426 STACK_ALLOCATED(); |
424 public: | 427 public: |
425 virtual Resource* create(const ResourceRequest&, const String&) const = 0; | 428 virtual Resource* create(const ResourceRequest&, const String&) const = 0; |
426 Resource::Type type() const { return m_type; } | 429 Resource::Type type() const { return m_type; } |
427 | 430 |
428 protected: | 431 protected: |
429 ResourceFactory(Resource::Type type) : m_type(type) { } | 432 ResourceFactory(Resource::Type type) : m_type(type) { } |
430 | 433 |
431 Resource::Type m_type; | 434 Resource::Type m_type; |
432 }; | 435 }; |
433 | 436 |
434 #if !LOG_DISABLED | 437 #if !LOG_DISABLED |
435 // Intended to be used in LOG statements. | 438 // Intended to be used in LOG statements. |
436 const char* ResourceTypeName(Resource::Type); | 439 const char* ResourceTypeName(Resource::Type); |
437 #endif | 440 #endif |
438 | 441 |
439 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ | 442 #define DEFINE_RESOURCE_TYPE_CASTS(typeName) \ |
440 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->type() =
= Resource::typeName, resource.type() == Resource::typeName); \ | 443 DEFINE_TYPE_CASTS(typeName##Resource, Resource, resource, resource->type() =
= Resource::typeName, resource.type() == Resource::typeName); \ |
441 inline typeName##Resource* to##typeName##Resource(const ResourcePtr<Resource
>& ptr) { return to##typeName##Resource(ptr.get()); } | 444 inline typeName##Resource* to##typeName##Resource(const ResourcePtr<Resource
>& ptr) { return to##typeName##Resource(ptr.get()); } |
442 | 445 |
443 } | 446 } |
444 | 447 |
445 #endif | 448 #endif |
OLD | NEW |